From bcbfe4659d36b5010e330fac9855b12920c0c028 Mon Sep 17 00:00:00 2001 From: centdix Date: Sat, 21 Feb 2026 02:03:06 +0000 Subject: [PATCH] feat: add remove button to each worktree in sidebar list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Show an × button on hover for non-main worktrees. Replace the boolean showConfirmRemove with a removeBranch string so the confirm dialog works from both sidebar and top bar. Co-Authored-By: Claude Opus 4.6 --- dev-dashboard/frontend/src/App.svelte | 20 +++++++++---------- .../frontend/src/lib/WorktreeList.svelte | 15 +++++++++++--- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/dev-dashboard/frontend/src/App.svelte b/dev-dashboard/frontend/src/App.svelte index 7ad0108e28..2ddb228277 100644 --- a/dev-dashboard/frontend/src/App.svelte +++ b/dev-dashboard/frontend/src/App.svelte @@ -16,7 +16,7 @@ let worktrees = $state([]); let selectedBranch = $state(null); - let showConfirmRemove = $state(false); + let removeBranch = $state(null); let showCreateDialog = $state(false); let creating = $state(false); let removing = $state(false); @@ -63,12 +63,12 @@ } async function handleRemove() { - if (!selectedBranch) return; + if (!removeBranch) return; removing = true; try { - await api.removeWorktree(selectedBranch); - showConfirmRemove = false; - selectedBranch = null; + await api.removeWorktree(removeBranch); + if (selectedBranch === removeBranch) selectedBranch = null; + removeBranch = null; await refresh(); } catch (err) { alert(`Failed to remove: ${err instanceof Error ? err.message : err}`); @@ -95,14 +95,14 @@ title="New Worktree" >+ New - (selectedBranch = b)} /> + (selectedBranch = b)} onremove={(b) => (removeBranch = b)} />
(showConfirmRemove = true)} + onremove={() => { if (selectedBranch) removeBranch = selectedBranch; }} /> {#if canConnect} @@ -161,11 +161,11 @@
(showCreateDialog = false)}>
{/if} -{#if showConfirmRemove} +{#if removeBranch} (showConfirmRemove = false)} + oncancel={() => (removeBranch = null)} /> {/if} diff --git a/dev-dashboard/frontend/src/lib/WorktreeList.svelte b/dev-dashboard/frontend/src/lib/WorktreeList.svelte index 9798295a50..b4d009b0a6 100644 --- a/dev-dashboard/frontend/src/lib/WorktreeList.svelte +++ b/dev-dashboard/frontend/src/lib/WorktreeList.svelte @@ -1,10 +1,11 @@