From 561c2843b15e2b830ecf8eca03bbb858e7ebd1fd Mon Sep 17 00:00:00 2001 From: Giancarmine Salucci Date: Tue, 12 May 2026 23:05:44 +0200 Subject: [PATCH] feat(ui): add delete button to RecipeSheet + fix NaNd ago + full QueueItem in POST response - RecipeSheet: add onDelete prop and 'Remove from queue' button at bottom of sheet - +page.svelte: wire onDelete -> removeItem in RecipeSheet - POST /api/queue: return full QueueItem (with createdAt, phases) instead of stripped subset - TimelineRow: defensive relTime() handles undefined/NaN, uses createdAt ?? enqueuedAt Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/routes/+page.svelte | 1 + src/routes/components/RecipeSheet.svelte | 31 +++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 62419c1..ae858d3 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -352,6 +352,7 @@ item={selectedItem} onClose={() => (selectedItem = null)} onRetry={(id) => { retryItem(id); selectedItem = null; }} + onDelete={(id) => { removeItem(id); selectedItem = null; }} /> {/if} diff --git a/src/routes/components/RecipeSheet.svelte b/src/routes/components/RecipeSheet.svelte index f0845d0..4f50fd7 100644 --- a/src/routes/components/RecipeSheet.svelte +++ b/src/routes/components/RecipeSheet.svelte @@ -14,8 +14,9 @@ item: QueueItem | null; onClose?: () => void; onRetry?: (id: string) => void; + onDelete?: (id: string) => void; } - let { item, onClose, onRetry }: Props = $props(); + let { item, onClose, onRetry, onDelete }: Props = $props(); const PALETTE = ['#E1306C', '#FD7E14', '#FCAF45', '#833AB4', '#C13584']; function strHash(s: string): number { @@ -164,6 +165,14 @@ Open in Tandoor {/if} + + + {#if onDelete} + + {/if} @@ -432,4 +441,24 @@ box-shadow: var(--shadow-lg); text-decoration: none; } + .delete-btn { + width: 100%; + margin-top: 12px; + padding: 14px; + border-radius: 99px; + background: transparent; + color: var(--muted); + font-size: 13px; + font-weight: 600; + display: flex; + align-items: center; + justify-content: center; + gap: 6px; + border: 1px solid var(--border); + } + .delete-btn:active { + background: rgba(255, 59, 48, 0.08); + color: var(--status-error); + border-color: var(--status-error); + }