Skip to content

Commit 358a22e

Browse files
committed
feat: add edit to payment builder action
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
1 parent f16362d commit 358a22e

File tree

40 files changed

+2437
-317
lines changed

40 files changed

+2437
-317
lines changed

docker/colony-cdapp-dev-env-block-ingestor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM colony-cdapp-dev-env/base:latest
22

3-
ENV BLOCK_INGESTOR_HASH=1b94ee2fdd9d2a20014d53cf7550ac2dbd3b8e0c
3+
ENV BLOCK_INGESTOR_HASH=6d15a210fdef298f94fc2706548f6b0e06dee829
44

55
# Declare volumes to set up metadata
66
VOLUME [ "/colonyCDapp/amplify/mock-data" ]

src/components/v5/common/ActionSidebar/ActionSidebar.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ const ActionSidebar: FC<PropsWithChildren<ActionSidebarProps>> = ({
6565
} = useGetActionData(transactionId);
6666

6767
const {
68+
isEditMode,
6869
actionSidebarToggle: [
6970
isActionSidebarOpen,
7071
{ toggle: toggleActionSidebarOff, registerContainerRef },
@@ -257,7 +258,7 @@ const ActionSidebar: FC<PropsWithChildren<ActionSidebarProps>> = ({
257258
ref={registerContainerRef}
258259
>
259260
<div className="relative">
260-
<div className="flex w-full items-center justify-between border-b border-gray-200 px-6 py-4">
261+
<div className="flex w-full items-center justify-between px-6 py-4">
261262
<div className="flex items-center gap-2">
262263
<button
263264
type="button"
@@ -288,6 +289,7 @@ const ActionSidebar: FC<PropsWithChildren<ActionSidebarProps>> = ({
288289
!isMotion &&
289290
!isMultiSig &&
290291
!expenditure &&
292+
!isEditMode &&
291293
!loadingExpenditure && (
292294
<PillsBase
293295
className="bg-success-100 text-success-400"
@@ -305,6 +307,25 @@ const ActionSidebar: FC<PropsWithChildren<ActionSidebarProps>> = ({
305307
{(!!isMotion || !!isMultiSig) && motionState && (
306308
<MotionOutcomeBadge motionState={motionState} />
307309
)}
310+
{!!expenditure && isEditMode && (
311+
<Tooltip
312+
tooltipContent={
313+
<span className="font-medium">
314+
{formatText({
315+
id: 'expenditure.edit.tooltip',
316+
})}
317+
</span>
318+
}
319+
placement="bottom-start"
320+
>
321+
<PillsBase
322+
className="bg-warning-100 text-warning-400"
323+
isCapitalized={false}
324+
>
325+
{formatText({ id: 'badge.edit' })}
326+
</PillsBase>
327+
</Tooltip>
328+
)}
308329
</div>
309330
)}
310331
{isMobile && getShareButton()}

src/components/v5/common/ActionSidebar/partials/Motions/Motions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ const Motions: FC<MotionsProps> = ({ transactionId }) => {
339339
>
340340
<Stepper<Steps>
341341
activeStepKey={activeStepKey}
342-
setActiveStepKey={setActiveStepKey}
342+
setActiveStepKey={(key: Steps) => setActiveStepKey(key)}
343343
items={items}
344344
/>
345345
</MotionProvider>

src/components/v5/common/ActionSidebar/partials/MultiSigSidebar/partials/MultiSigWidget/MultiSigWidget.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ const MultiSigWidget: FC<MultiSigWidgetProps> = ({ action }) => {
146146
<Stepper<MultiSigState>
147147
items={items}
148148
activeStepKey={activeStepKey}
149-
setActiveStepKey={setActiveStepKey}
149+
setActiveStepKey={(key: MultiSigState) => setActiveStepKey(key)}
150150
/>
151151
</div>
152152
);

src/components/v5/common/ActionSidebar/partials/forms/PaymentBuilderForm/partials/PaymentBuilderRecipientsField/PaymentBuilderRecipientsField.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ const PaymentBuilderRecipientsField: FC<PaymentBuilderRecipientsFieldProps> = ({
132132
item.tokenAddress === nativeToken?.tokenAddress,
133133
);
134134

135+
const latestSlotId = value.sort((a, b) => {
136+
if (!a.slotId || !b.slotId) return 0;
137+
138+
return b.slotId - a.slotId;
139+
})[0]?.slotId;
140+
135141
return (
136142
<div>
137143
<h5 className="mb-3 mt-6 text-2">
@@ -178,10 +184,12 @@ const PaymentBuilderRecipientsField: FC<PaymentBuilderRecipientsFieldProps> = ({
178184
isFullSize={isMobile}
179185
onClick={() => {
180186
fieldArrayMethods.append({
187+
// @TODO: Add slotId (find highest existing slotId and add 1)
181188
recipient: '',
182189
amount: '',
183190
tokenAddress: nativeToken?.tokenAddress || '',
184191
delay: '',
192+
slotId: latestSlotId ? latestSlotId + 1 : undefined,
185193
});
186194
}}
187195
disabled={hasNoDecisionMethods || data.length === 400}

src/components/v5/common/ActionSidebar/partials/forms/PaymentBuilderForm/partials/PaymentBuilderRecipientsField/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ export interface PaymentBuilderRecipientsFieldModel {
1111
amount?: string;
1212
tokenAddress?: string;
1313
delay?: string;
14+
slotId?: number;
1415
}

src/components/v5/common/CompletedAction/CompletedAction.tsx

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import clsx from 'clsx';
22
import React from 'react';
33

4+
import { useActionSidebarContext } from '~context/ActionSidebarContext/ActionSidebarContext.ts';
45
import { useColonyContext } from '~context/ColonyContext/ColonyContext.ts';
56
import { ColonyActionType } from '~gql';
67
import { ExtendedColonyActionType } from '~types/actions.ts';
@@ -14,6 +15,7 @@ import MultiSigSidebar from '../ActionSidebar/partials/MultiSigSidebar/MultiSigS
1415
import AddVerifiedMembers from './partials/AddVerifiedMembers/index.ts';
1516
import CreateDecision from './partials/CreateDecision/index.ts';
1617
import EditColonyDetails from './partials/EditColonyDetails/index.ts';
18+
import ExitEditModeModal from './partials/ExitEditModeModal/ExitEditModeModal.tsx';
1719
import ManageReputation from './partials/ManageReputation/index.ts';
1820
import ManageTeam from './partials/ManageTeam/index.ts';
1921
import ManageTokens from './partials/ManageTokens/ManageTokens.tsx';
@@ -39,6 +41,13 @@ const CompletedAction = ({ action }: CompletedActionProps) => {
3941
const { colony } = useColonyContext();
4042

4143
const actionType = getExtendedActionType(action, colony.metadata);
44+
const {
45+
isEditMode,
46+
cancelEditModalToggle: [
47+
isCancelModalOpen,
48+
{ toggleOff: toggleOffCancelModal },
49+
],
50+
} = useActionSidebarContext();
4251

4352
const getActionContent = () => {
4453
switch (actionType) {
@@ -157,37 +166,38 @@ const CompletedAction = ({ action }: CompletedActionProps) => {
157166
return <PermissionSidebar action={action} />;
158167
}
159168
};
160-
161169
return (
162-
<div className="flex flex-grow flex-col-reverse justify-end overflow-auto sm:flex-row sm:justify-start">
163-
<div
164-
className={clsx('w-full overflow-y-auto px-6 pb-6 pt-8', {
165-
'sm:w-[calc(100%-23.75rem)]': action.isMotion,
166-
})}
167-
>
168-
{getActionContent()}
169-
</div>
170+
<>
171+
<div className="relative flex flex-grow flex-col-reverse justify-end overflow-auto sm:flex-row sm:justify-start">
172+
<div
173+
className={clsx(
174+
'w-full overflow-y-auto px-6 pb-6 pt-8 sm:border sm:border-gray-200',
175+
{
176+
'sm:w-[calc(100%-23.75rem)]': action.isMotion,
177+
'mb-[8.5rem] sm:mb-[5.5rem] sm:border-warning-400': isEditMode,
178+
'sm:border-b-0 sm:border-l-0': !isEditMode,
179+
},
180+
)}
181+
>
182+
{getActionContent()}
183+
</div>
170184

171-
<div
172-
className={`
173-
w-full
174-
border-b
175-
border-b-gray-200
176-
bg-gray-25
177-
px-6
178-
py-8
179-
sm:h-full
180-
sm:w-[23.75rem]
181-
sm:flex-shrink-0
182-
sm:overflow-y-auto
183-
sm:border-b-0
184-
sm:border-l
185-
sm:border-l-gray-200
186-
`}
187-
>
188-
{getSidebarWidgetContent()}
185+
<div
186+
className={clsx(
187+
'w-full border-b border-b-gray-200 bg-gray-25 px-6 py-8 sm:h-full sm:w-[23.75rem] sm:flex-shrink-0 sm:overflow-y-auto sm:border-b-0 sm:border-t sm:border-gray-200',
188+
{
189+
'border-b-warning-400': isEditMode,
190+
},
191+
)}
192+
>
193+
{getSidebarWidgetContent()}
194+
</div>
189195
</div>
190-
</div>
196+
<ExitEditModeModal
197+
isOpen={isCancelModalOpen}
198+
onClose={toggleOffCancelModal}
199+
/>
200+
</>
191201
);
192202
};
193203

0 commit comments

Comments
 (0)