From 3159d856d77a0d5530cfec96f810e0fc3e0550fa Mon Sep 17 00:00:00 2001 From: abccodes Date: Fri, 26 Jun 2026 01:53:42 -0700 Subject: [PATCH] [aidan] workflows/steps: confirm before removing a step --- .../src/app/pages/Workflows/app/StepsCard.tsx | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/pages/Workflows/app/StepsCard.tsx b/frontend/src/app/pages/Workflows/app/StepsCard.tsx index e4e7c686..e6092a56 100644 --- a/frontend/src/app/pages/Workflows/app/StepsCard.tsx +++ b/frontend/src/app/pages/Workflows/app/StepsCard.tsx @@ -1,4 +1,5 @@ import React, { useEffect, useState } from 'react'; +import Dialog from '@mui/material/Dialog'; import { useAppDispatch } from '@/shared/hooks'; import { commitDraft } from '@/shared/state/workflowsSlice'; import type { Workflow, WorkflowStep } from '@/shared/state/workflowsSlice'; @@ -21,6 +22,7 @@ const StepsCard: React.FC<{ workflow: Workflow }> = ({ workflow }) => { const patch = useWorkflowPatch(); const [local, setLocal] = useState(() => toLocal(workflow.steps)); const [draft, setDraft] = useState(''); + const [pendingDelete, setPendingDelete] = useState(null); // Agent-proposed step changes apply silently (no Apply/Discard popup): commit any staged draft as soon as it lands so the steps just update live. Guarded on real content, the edit session snapshots an empty draft on open and committing that 400s. useEffect(() => { @@ -76,9 +78,15 @@ const StepsCard: React.FC<{ workflow: Workflow }> = ({ workflow }) => { commit(next); }; const onDelete = (id: string) => { - const next = local.filter((s) => s.id !== id); + const step = local.find((s) => s.id === id); + if (step) setPendingDelete(step); + }; + const confirmDelete = () => { + if (!pendingDelete) return; + const next = local.filter((s) => s.id !== pendingDelete.id); setLocal(next); commit(next); + setPendingDelete(null); }; return ( @@ -139,6 +147,29 @@ const StepsCard: React.FC<{ workflow: Workflow }> = ({ workflow }) => { + + setPendingDelete(null)} + PaperProps={{ style: { background: WC.paper, borderRadius: WC.radius.lg, border: `1px solid rgba(${WC.inkRGB},0.10)`, boxShadow: WC.shadow.lg, maxWidth: 340, margin: 16 } }} + > +
+
+
+ +
+ Remove step? +
+
+ {(pendingDelete?.label || pendingDelete?.text || 'This step').trim()} + {' '}will be removed from this workflow. +
+
+ + +
+
+
); };