From e0673d30291b4bd5b8e8145358710c4bca32fef0 Mon Sep 17 00:00:00 2001 From: nourshoreibah Date: Sat, 17 Oct 2026 07:44:13 -0400 Subject: [PATCH 1/2] fix(staff): stop the Act as confirm reading like a delete MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The staff console reuses ConfirmDeleteDialog, which hard-coded "Delete {itemName}?", "This cannot be undone." and "Deleting…". Add optional prompt, irreversible and pendingLabel props and pass switch-in wording from the staff page. Co-Authored-By: Claude Opus 5.5 --- .../app/components/ConfirmDeleteDialog.tsx | 22 ++++++++++++++----- apps/frontend/src/app/staff/page.tsx | 14 ++++++++++-- .../test/components/StaffConsolePage.test.tsx | 2 ++ 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/apps/frontend/src/app/components/ConfirmDeleteDialog.tsx b/apps/frontend/src/app/components/ConfirmDeleteDialog.tsx index 7b4adc05..132145ce 100644 --- a/apps/frontend/src/app/components/ConfirmDeleteDialog.tsx +++ b/apps/frontend/src/app/components/ConfirmDeleteDialog.tsx @@ -20,7 +20,12 @@ interface ConfirmDeleteDialogProps { * (a project's expenses, a donor's donations) — say so explicitly. */ consequences?: React.ReactNode; + /** Replaces the "Delete {itemName}?" line, for confirms that aren't deletes. */ + prompt?: React.ReactNode; + /** Set false when the action can be reversed, to drop "This cannot be undone." */ + irreversible?: boolean; confirmLabel?: string; + pendingLabel?: string; /** * Gate the confirm button behind retyping `itemName`. For deletes that * reach into financial history, where a misclick is costly to undo. @@ -40,7 +45,10 @@ export default function ConfirmDeleteDialog({ title, itemName, consequences, + prompt, + irreversible = true, confirmLabel = 'Delete', + pendingLabel = 'Deleting…', requireTypedConfirmation = false, }: ConfirmDeleteDialogProps) { const [deleting, setDeleting] = useState(false); @@ -114,22 +122,24 @@ export default function ConfirmDeleteDialog({

- {itemName ? ( + {prompt ?? (itemName ? ( <> Delete {itemName}? ) : ( 'Are you sure you want to delete this?' - )} + ))}

{consequences && (
{consequences}
)} -

- This cannot be undone. -

+ {irreversible && ( +

+ This cannot be undone. +

+ )} {requireTypedConfirmation && itemName && ( {confirmLabel} diff --git a/apps/frontend/src/app/staff/page.tsx b/apps/frontend/src/app/staff/page.tsx index a68eb60b..a14fa0bd 100644 --- a/apps/frontend/src/app/staff/page.tsx +++ b/apps/frontend/src/app/staff/page.tsx @@ -175,11 +175,21 @@ export default function StaffConsolePage() { confirmFull ? switchInto(confirmFull, 'full') : undefined } title="Act as this user with full access?" - itemName={ - confirmFull ? `${confirmFull.name} (${confirmFull.email})` : undefined + prompt={ + confirmFull && ( + <> + Switch into{' '} + + {`${confirmFull.name} (${confirmFull.email})`} + {' '} + for one hour? + + ) } consequences="Anything you create, edit, approve or delete is real and is saved as this user. Each change is also recorded against your staff account." + irreversible={false} confirmLabel="Act as" + pendingLabel="Switching…" />
); diff --git a/apps/frontend/test/components/StaffConsolePage.test.tsx b/apps/frontend/test/components/StaffConsolePage.test.tsx index 93e843d3..d00e4124 100644 --- a/apps/frontend/test/components/StaffConsolePage.test.tsx +++ b/apps/frontend/test/components/StaffConsolePage.test.tsx @@ -88,6 +88,8 @@ describe('StaffConsolePage', () => { expect(await screen.findByText('Act as this user with full access?')).toBeInTheDocument(); expect(screen.getByText('Sam Okafor (sam@branch.org)')).toBeInTheDocument(); + expect(screen.queryByText(/delete sam okafor/i)).not.toBeInTheDocument(); + expect(screen.queryByText('This cannot be undone.')).not.toBeInTheDocument(); // The dialog portals to the end of , so its confirm is the last "Act as". const confirm = screen.getAllByRole('button', { name: 'Act as' }).at(-1)!; await userEvent.click(confirm); From 3006ead71b4e51f7a3eab6755848a83bdbd4e551 Mon Sep 17 00:00:00 2001 From: nourshoreibah Date: Sat, 17 Oct 2026 07:44:51 -0400 Subject: [PATCH 2/2] chore: trim comments Co-Authored-By: Claude Opus 5.5 --- apps/frontend/src/app/components/ConfirmDeleteDialog.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/frontend/src/app/components/ConfirmDeleteDialog.tsx b/apps/frontend/src/app/components/ConfirmDeleteDialog.tsx index 132145ce..b9e1d7c1 100644 --- a/apps/frontend/src/app/components/ConfirmDeleteDialog.tsx +++ b/apps/frontend/src/app/components/ConfirmDeleteDialog.tsx @@ -20,9 +20,7 @@ interface ConfirmDeleteDialogProps { * (a project's expenses, a donor's donations) — say so explicitly. */ consequences?: React.ReactNode; - /** Replaces the "Delete {itemName}?" line, for confirms that aren't deletes. */ prompt?: React.ReactNode; - /** Set false when the action can be reversed, to drop "This cannot be undone." */ irreversible?: boolean; confirmLabel?: string; pendingLabel?: string;