diff --git a/apps/desktop/src/lib/components/Board.svelte b/apps/desktop/src/lib/components/Board.svelte index 4b55d65..012a4df 100644 --- a/apps/desktop/src/lib/components/Board.svelte +++ b/apps/desktop/src/lib/components/Board.svelte @@ -13,6 +13,7 @@ moveList, deleteList } from '$lib/stores/board'; + import { collapsed, toggleCollapsed } from '$lib/stores/collapsed'; import type { List, Ticket } from '$lib/types'; let { onopen, onadd }: { onopen: (t: Ticket) => void; onadd: (id: string, name: string) => void } = @@ -158,6 +159,7 @@ {flipMs} {dragActive} {overTrash} + collapsed={$collapsed.includes(col.list)} dragDisabled={$rewinding} canMoveLeft={i > 0} canMoveRight={i < cols.length - 1} @@ -166,6 +168,7 @@ onmove={handleMove} onrename={(id, name) => renameList(id, name)} ondelete={(id) => deleteList(id)} + oncollapse={toggleCollapsed} onconsider={handleConsider} onfinalize={handleFinalize} ondragel={(el) => (draggedEl = el)} diff --git a/apps/desktop/src/lib/components/Column.svelte b/apps/desktop/src/lib/components/Column.svelte index 3cd82ca..d1da47e 100644 --- a/apps/desktop/src/lib/components/Column.svelte +++ b/apps/desktop/src/lib/components/Column.svelte @@ -6,6 +6,8 @@ MoreHorizontal, ChevronLeft, ChevronRight, + ChevronsLeftRight, + ChevronsRightLeft, Pencil, Trash2, Bell, @@ -25,6 +27,7 @@ dragDisabled, dragActive = false, overTrash = false, + collapsed = false, canMoveLeft = false, canMoveRight = false, onopen, @@ -32,6 +35,7 @@ onmove, onrename, ondelete, + oncollapse, onconsider, onfinalize, ondragel @@ -43,6 +47,7 @@ dragDisabled: boolean; dragActive?: boolean; overTrash?: boolean; + collapsed?: boolean; canMoveLeft?: boolean; canMoveRight?: boolean; onopen: (t: Ticket) => void; @@ -50,6 +55,7 @@ onmove?: (listId: string, dir: -1 | 1) => void; onrename?: (listId: string, name: string) => void; ondelete?: (listId: string) => void; + oncollapse?: (listId: string) => void; onconsider: (listId: string, items: Ticket[]) => void; onfinalize: (listId: string, items: Ticket[], info: { id: string; trigger: string }) => void; ondragel?: (el: HTMLElement | null) => void; @@ -157,6 +163,18 @@ if (before?.size && zone) play(zone, before); }); + // A collapsed list is a narrow strip: name, count, expand button. It stays a + // drop zone (the strip itself), but shows no cards, so there is no position to + // aim for - a card dropped on it goes to the top of the list, where it is the + // first thing seen when the list is expanded again. + function finalize(items: Ticket[], info: { id: string; trigger: string }) { + if (collapsed && info.trigger === 'droppedIntoZone') { + const dropped = items.find((t) => t.id === info.id); + if (dropped) items = [dropped, ...items.filter((t) => t.id !== info.id)]; + } + onfinalize(listId, items, info); + } + let renaming = $state(false); let renameDraft = $state(''); @@ -171,7 +189,25 @@ } -
+
+ {#if collapsed} + + + {/if}
{#if renaming} @@ -194,8 +230,19 @@ >{#if $searchMatches}{shown}/{tickets.length}{:else}{tickets.length}{/if} {/if} + {#if !renaming} + + {/if} {#if !dragDisabled} - @@ -276,7 +323,10 @@ // A release over the trash is outside every zone, so the library would // first animate the card back to its origin and only then let it vanish. // Over the bin, skip that return trip: the card is being deleted. - dropAnimationDisabled: overTrash, + // Nor is there a slot to fly to in a collapsed list, or a card size to take + // on there: the card keeps its shape over the strip and lands at once. + dropAnimationDisabled: overTrash || collapsed, + morphDisabled: collapsed, // Disable the library's built-in target styling: it highlights EVERY valid // zone. We glow just the hovered column ourselves via `isTarget` below. dropTargetStyle: {}, @@ -298,8 +348,7 @@ } }} onconsider={(e: CustomEvent>) => onconsider(listId, e.detail.items)} - onfinalize={(e: CustomEvent>) => - onfinalize(listId, e.detail.items, e.detail.info)} + onfinalize={(e: CustomEvent>) => finalize(e.detail.items, e.detail.info)} > {#each tickets as ticket (ticket.id)}
- {#if marker in ticket} + {#if collapsed} + + {:else if marker in ticket}
@@ -323,7 +375,7 @@ - {#if !dragDisabled} + {#if !dragDisabled && !collapsed} @@ -332,7 +384,7 @@