From 3dd79fd5e514cd99049bd911eeb453cbb00e2779 Mon Sep 17 00:00:00 2001 From: g-but <41178744+g-but@users.noreply.github.com> Date: Wed, 20 May 2026 21:59:34 +0200 Subject: [PATCH] fix(control): Remove confirm strip replaces full tile action row MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously the confirm strip rendered inline alongside Focus + Launch which squeezed everything below ~360px viewport. Lift the remove stage state into ProjectTile so when confirming, the entire chips+icons row is replaced by "Remove ? · Yes, remove · No" spanning the full tile width. - removeStage idle → original action row (chips + icons) - removeStage confirm/removing → full-width RemoveConfirmStrip - onCancel/onRemoved → snap back to idle RemoveTriggerIcon and RemoveConfirmStrip are local helpers; the old TileRemoveButton (icon + state co-located) is gone since the parent now owns the state. Project name appears in the prompt so a user reviewing multiple Stale tiles can't accidentally confirm the wrong one. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/components/control/ProjectTile.tsx | 176 +++++++++++++++---------- 1 file changed, 110 insertions(+), 66 deletions(-) diff --git a/src/components/control/ProjectTile.tsx b/src/components/control/ProjectTile.tsx index 8bda2e2c8..d880fd33c 100644 --- a/src/components/control/ProjectTile.tsx +++ b/src/components/control/ProjectTile.tsx @@ -23,48 +23,13 @@ type Props = { onRemoved?: () => void; }; -function TileRemoveButton({ projectId, onRemoved }: { projectId: string; onRemoved: () => void }) { - const [stage, setStage] = useState<"idle" | "confirm" | "removing">("idle"); - const [error, setError] = useState(null); +type RemoveStage = "idle" | "confirm" | "removing"; - if (stage === "confirm" || stage === "removing") { - const handleConfirm = async (e: React.MouseEvent) => { - e.stopPropagation(); - haptic(); - setStage("removing"); - setError(null); - try { - const res = await deleteJson(`/api/user-projects/${projectId}`); - if (!res.ok) await throwApiError(res, "Failed to remove"); - onRemoved(); - } catch (err) { - setError(err instanceof Error ? err.message : "Failed to remove"); - setStage("confirm"); - } - }; - return ( -
e.stopPropagation()}> - Remove? - - - {error && {error}} -
- ); - } +/** Trash icon used in the action row when stage === "idle". */ +function RemoveTriggerIcon({ onClick }: { onClick: (e: React.MouseEvent) => void }) { return ( + + + {error &&

{error}

} + + ); +} + export function ProjectTile({ project, currentAdapter, zellijTabs, onExpand, onLaunch, onFocus, onRemoved }: Props) { const { tab, session, agentRunning, dir } = project; const display = getProjectDisplayState(project, zellijTabs, Math.floor(Date.now() / 1000)); @@ -91,6 +101,12 @@ export function ProjectTile({ project, currentAdapter, zellijTabs, onExpand, onL const [launching, setLaunching] = useState(false); const canLaunch = !!dir; + // Lift remove-confirm state into the tile so the strip can replace the whole + // action row instead of squeezing Yes/No alongside Focus + Launch on narrow widths. + const [removeStage, setRemoveStage] = useState("idle"); + const [removeError, setRemoveError] = useState(null); + const removeEnabled = !!onRemoved && !!project.id; + const handleLaunch = async (e: React.MouseEvent) => { e.stopPropagation(); if (!canLaunch || launching) return; @@ -98,6 +114,22 @@ export function ProjectTile({ project, currentAdapter, zellijTabs, onExpand, onL try { onLaunch(); } finally { setLaunching(false); } }; + const handleRemoveConfirm = async (e: React.MouseEvent) => { + e.stopPropagation(); + if (!onRemoved || !project.id) return; + haptic(); + setRemoveStage("removing"); + setRemoveError(null); + try { + const res = await deleteJson(`/api/user-projects/${project.id}`); + if (!res.ok) await throwApiError(res, "Failed to remove"); + onRemoved(); + } catch (err) { + setRemoveError(err instanceof Error ? err.message : "Failed to remove"); + setRemoveStage("confirm"); + } + }; + return (
-
- +
+ {removeStage !== "idle" ? ( + { e.stopPropagation(); setRemoveStage("idle"); setRemoveError(null); }} + /> + ) : ( +
+ -
- {onRemoved && project.id && ( - - )} - - {canLaunch && !agentRunning && ( - - )} -
+
+ {removeEnabled && ( + { e.stopPropagation(); setRemoveStage("confirm"); }} /> + )} + + {canLaunch && !agentRunning && ( + + )} +
+
+ )}
);