-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/15873666 edit #3320
base: master
Are you sure you want to change the base?
Feat/15873666 edit #3320
Conversation
c0099a8
to
c60c833
Compare
This one also needs a rebase @CzarekDryl |
b6eed1c
to
b98a6fc
Compare
@jakubcolony @arrenv Branch rebased and ready to review |
b98a6fc
to
d4f0dcd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work overall @CzarekDryl, this was not a simple feature to handle 👍
Some notes from my testing:
- Missing translations:


-
Should the Make changes button be disabled if there are no changes? Otherwise it is just sending empty transactions.
-
After making changes, the values only update after a few seconds. I can't see this mentioned in the spec, but we may want to update them manually in cache so that they're visible to the user straightaway.
-
If amount is 0, the row should be hidden, that is how they get deleted on the contracts level:

- When I select an edit action, should it be the slots after the changes that are shown? That's what seems to be the case, but they change order when clicked on (could be also related to the issue below):


- The payment table should be sorted by slot ID, after editing the slots returned from the backend are not necessarily in order (see slot with ID 1 is displayed under slot with ID 2):


- I feel like this could be related to the above, I edited only the claim delay but the UI mentions 6 changes:
"expenditureSlotChanges": {
"oldSlots": [
{
"id": 1,
"recipientAddress": "0xb77D57F4959eAfA0339424b83FcFaf9c15407461",
"claimDelay": "0",
"payouts": [
{
"amount": "1000000000000000000000",
"tokenAddress": "0xeF841fe1611ce41bFCf0265097EFaf50486F5111"
}
]
},
{
"id": 2,
"recipientAddress": "0x9dF24e73f40b2a911Eb254A8825103723E13209C",
"claimDelay": "3600",
"payouts": [
{
"amount": "2000000000000000000000",
"tokenAddress": "0xeF841fe1611ce41bFCf0265097EFaf50486F5111"
}
]
}
],
"newSlots": [
{
"id": 2,
"recipientAddress": "0x9dF24e73f40b2a911Eb254A8825103723E13209C",
"claimDelay": "3600",
"payouts": [
{
"amount": "2000000000000000000000",
"tokenAddress": "0xeF841fe1611ce41bFCf0265097EFaf50486F5111"
}
]
},
{
"id": 1,
"recipientAddress": "0xb77D57F4959eAfA0339424b83FcFaf9c15407461",
"claimDelay": "18000",
"payouts": [
{
"amount": "1000000000000000000000",
"tokenAddress": "0xeF841fe1611ce41bFCf0265097EFaf50486F5111"
}
]
}
]
}
-
After making a change that required another funding step, I'm being asked to fund the entire amount instead of just the difference between payout sum and current expenditure balance for a given token
-
Adding slots seems to work fine ✅

- Editing in different steps shows correctly in the list, nicely done:

const getEditContent = () => { | ||
switch (actionType) { | ||
case ColonyActionType.CreateExpenditure: | ||
return <PaymentBuilderEdit action={action} />; | ||
default: | ||
return <div>Not implemented yet</div>; | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be handled at the level of PaymentBuilder
component? It would keep the generic CompletedAction free of feature-specific logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I've moved this to PaymentBuilder
component
d4f0dcd
to
75ce3d4
Compare
Preferably not disabled, but, we should validate on click if no changes have been made. With a validation message: "No changes have been made yet."
My concern with showing cached values is if there is an issue with the transaction, you are going to get a flashing of the new then back to old values. My thinking here is that it would probably be better to show a skeleton loading state on the whole table. This could be done in a separate issue.
Yes, I agree, the ones with 0 values should be hidden.
Good pickup Jakub, yes, it would be good to have a consistent order. |
6505b7d
to
358a22e
Compare
@jakubcolony I've sorted all data by slotId, please check it now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we might still be missing sorting by slot ID when viewing changes. The newly added slot is shown at the top:




When I select a change request straight after it appears, the blue outline doesn't show:
Screen.Recording.2024-11-08.at.00.10.04.mov
Slots with amounts of 0 should not be shown in the edit mode:
Screen.Recording.2024-11-08.at.00.14.19.mov
In this scenario, I had a single slot and changed the token from CREDS to ETH. It counted 3 changes (should be one) and got a bit confused when displaying the differences:
I suspect this could be because you are comparing old and new payouts by indexes rather than token addresses.
The exit modal should not show if there weren't any changes to the expenditure.
@@ -178,10 +184,12 @@ const PaymentBuilderRecipientsField: FC<PaymentBuilderRecipientsFieldProps> = ({ | |||
isFullSize={isMobile} | |||
onClick={() => { | |||
fieldArrayMethods.append({ | |||
// @TODO: Add slotId (find highest existing slotId and add 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comment can now be removed
success: ActionTypes.EXPENDITURE_EDIT_SUCCESS, | ||
}); | ||
|
||
const handleEditExpenditureViaMotion = async ({ decisionMethod }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to handle editing expenditures via both action and motion, so the name should be updated
const showEditOption = | ||
expenditure?.status !== ExpenditureStatus.Cancelled && | ||
expenditure?.status !== ExpenditureStatus.Draft && | ||
expenditure?.status !== ExpenditureStatus.Finalized && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about doing it the other way around, ie. checking for statuses that allow editing (Locked, Funding)?
@@ -0,0 +1,72 @@ | |||
import clsx from 'clsx'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If #3162 gets merged first, please try to reuse the shared component introduced there
const sortedOldSlots = oldSlots | ||
? [...oldSlots].sort((a, b) => a.id - b.id) | ||
: []; | ||
const sortedNewSlots = newSlots | ||
? [...newSlots].sort((a, b) => a.id - b.id) | ||
: []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
old and new slots should be defined according to their types
if (newSlots.length !== oldSlots.length) { | ||
changes += newSlots.length - oldSlots.length; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it would subtract if there were less new slots than old ones, even though normally it shouldn't happen. Still, it feels sensible to wrap this in Math.abs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I accidentally submitted my previous review too soon. Adding a few more comments
@@ -52,6 +52,7 @@ fragment Expenditure on Expenditure { | |||
filter: { | |||
or: [ | |||
{ type: { eq: MOVE_FUNDS } } | |||
{ type: { eq: MOVE_FUNDS_MOTION } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was the reason behind adding this? Did you come across some funding motions misclassified as move funds?
const [editValues, setEditValues] = useState< | ||
ExpenditurePayoutFieldValue[] | undefined | ||
>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could that be moved to expenditure-specific component, such as PaymentBuilderEdit?
() => | ||
object() | ||
.shape({ | ||
payments: array() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is almost the same as validation in src/components/v5/common/ActionSidebar/partials/forms/PaymentBuilderForm/hooks.ts
. Is there a way to reuse it?
if (!createdAt || !transactionHash) return; | ||
|
||
const fundingActionTime = new Date(createdAt); | ||
const actionKey = `${createdAt}-${transactionHash}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
transactionHash, for now, is a unique identifier of an action so you can just use that
import { type ExpenditureActionFragment, ExpenditureStatus } from '~gql'; | ||
import { type ExpenditureAction, type Expenditure } from '~types/graphql.ts'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ExpenditureActionFragment is the same as ExpenditureAction
358a22e
to
a404cde
Compare
@jakubcolony When you click to view the changes, the modified items are at the top of the table and separated by a blue line. This is the desired behavior. |
c9bc973
to
42ab64b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @CzarekDryl, coming along well! I noticed the following:
-
If you click on the meatball menu, it sits under the action timeline.
-
Can we remove the bold on the dash, align the values and max the font size of all text the same at
text-3
to match the design.
-
I also removed a recipient row completely, is there any way to see that? When returning, as I can see it says 4 changes, but clicking on it shows only 3 recipients changed.
-
I did a change where I removed leela, then funded, then went into edit mode again and I can see leela again in the list, removed rows should not show up again if removed. It also causes issues with validation and I need to remove it again.
-
Submitting that second change using Reputation did not have any affect, the motion did not show up despite the transaction succeeding. It did show up if using Permissions.
-
Increasing the total amount did prompt another funding step, meaning the payment was not fully funded, but allowed me to go to the Release step, however, that fails as the payment was not fully funded.
@arrenv Everything except the last point has been fixed because I cannot reproduce it |
c90c33f
to
3aa94eb
Compare
Hey @CzarekDryl - looks like this one needs another rebase. I tried to test it by editing an advanced payment but got an error, maybe a rebase will fix it? ![]() ![]() ![]() |
I know this PR has been kicking around for a while now so would be good to get it rebased and we can try to get it pushed through! I just wanted to leave a comment here as I've noticed whilst doing another piece of work that the |
3aa94eb
to
8ff7435
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First off, great work on this very complicated issue, there is a LOT going on here.
A lot of it is working great, I'm able to edit at the correct stage of the process, the edit button does not appear for users without permissions, validation messages are showing correctly, etc. On to the issues though, I'm sure some of these could just be handled as separate issues, it maybe even makes sense to make this a mini feature branch just to handle all the cases here.
The number of recipients in the subtitle is not updating correctly. I think it's maybe just not accounting for the rows where the amount is 0.
There is an issue with the slotId not being properly set.
There is an issue with the accordion rows on the changes view not closing properly.
Here is a video:
Screen.Recording.2025-01-21.at.10.40.34.mov
The blue border is also having some issues:
Screen.Recording.2025-01-21.at.10.42.07.mov
There should be a "No changes have been made" validation error if you click the "Make changes" button without making any changes.
Screen.Recording.2025-01-21.at.10.48.02.mov
The additional funding steps also failed to show for me when I added an extra payment row resulting in failed release transaction.
Screen.Recording.2025-01-21.at.10.51.53.mov
I'm not sure if this is intended or not, but I think rows which have been removed in previous edits should not continue to show in future edits. (So for this example, Amy was removed in the first edit, then in the second edit the amount for Leela was changed. When viewing the second edit, I don't think Amy should show at all.)
The change request buttons should be disabled whilst edit mode is active.
Screen.Recording.2025-01-21.at.11.15.06.mov
As mentioned in my previous comment, I suspect there will be issues with large payments over 164 rows, but we'll have to check this once the slotId issue is resolved.
Thanks again though for your work on this so far!
fixes after rebase fix: translations, table borders Fix: Editing expenditure to not change slot IDs or override recipients Chore: Add comments with guidance on edit expenditure implementation Update ingestor image hash fix: table styles fix: remove unused prop CR fixes fixes after rebase fix: edit changes
e7196e5
to
e625f48
Compare
@iamsamgibbs I fixed all comments from the list except the error that occurs after release transaction. I have no idea what it is caused by. I don't know if it's on the frontend or backend side, but I noticed that it occurs if we remove the row before the Funding step. |
Description
This PR adds the ability to edit actions after the locked state during the Funding, Release steps. Editing in Payment step is not possible for now.
Edit Mode:
Change Payment Modal:
Changes Step in Stepper:
If there is funding needed after editing, new pill should show after changes one
Testing
Closed PR with comments - #3075
Design
Resolves #2238