diff options
| author | Adam Malczewski <[email protected]> | 2026-06-21 14:21:53 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-21 14:21:53 +0900 |
| commit | 1b09eea04911d73cdf3f979d4f19dcf5dc20c461 (patch) | |
| tree | 979da96aa142fababc5c5f2d1ac019bb0d1c61db /src/features/surface-host/ui | |
| parent | d98a63ce17519983dcf58c27432723e2f4b96e75 (diff) | |
| download | dispatch-web-1b09eea04911d73cdf3f979d4f19dcf5dc20c461.tar.gz dispatch-web-1b09eea04911d73cdf3f979d4f19dcf5dc20c461.zip | |
feat(surfaces): todo task list sidebar view
Add a dedicated "Tasks" sidebar view for the per-conversation todo surface
(model-maintained via todo_write tool; read-only, conversation-scoped).
- parseTodoPayload: pure parser for the rendererId: "todo" custom field
(TodoItem { content, status, priority } — types defined FE-side, not in wire)
- TodoList.svelte: renders the task list with status indicators (spinner for
in_progress, checkmark for completed, X for cancelled, empty circle for
pending) + priority dots (red/yellow/gray)
- SurfaceView dispatches rendererId: "todo" to TodoList
- App.svelte: "Tasks" view kind (always visible; "No tasks yet" empty state),
todo surface pulled out of the generic Extensions list, re-mounts per
conversation via {#key}
681 tests green.
Diffstat (limited to 'src/features/surface-host/ui')
| -rw-r--r-- | src/features/surface-host/ui/SurfaceView.svelte | 3 | ||||
| -rw-r--r-- | src/features/surface-host/ui/TodoList.svelte | 70 |
2 files changed, 73 insertions, 0 deletions
diff --git a/src/features/surface-host/ui/SurfaceView.svelte b/src/features/surface-host/ui/SurfaceView.svelte index e5f807a..3f92e3b 100644 --- a/src/features/surface-host/ui/SurfaceView.svelte +++ b/src/features/surface-host/ui/SurfaceView.svelte @@ -8,6 +8,7 @@ import Selector from "./Selector.svelte"; import StatTable from "./StatTable.svelte"; import SurfaceTable from "./SurfaceTable.svelte"; + import TodoList from "./TodoList.svelte"; import Toggle from "./Toggle.svelte"; let { @@ -43,6 +44,8 @@ <SurfaceTable payload={group.field.payload} /> {:else if group.field.rendererId === "message-queue"} <MessageQueueList payload={group.field.payload} /> + {:else if group.field.rendererId === "todo"} + <TodoList payload={group.field.payload} /> {/if} {/if} {/each} diff --git a/src/features/surface-host/ui/TodoList.svelte b/src/features/surface-host/ui/TodoList.svelte new file mode 100644 index 0000000..8dbd995 --- /dev/null +++ b/src/features/surface-host/ui/TodoList.svelte @@ -0,0 +1,70 @@ +<script lang="ts"> + import { parseTodoPayload, type TodoPriority, type TodoStatus } from "../logic/todo"; + + let { payload }: { readonly payload: unknown } = $props(); + + const data = $derived(parseTodoPayload(payload)); + + const priorityDot: Record<TodoPriority, string> = { + high: "bg-error", + medium: "bg-warning", + low: "bg-base-content/30", + }; +</script> + +{#if data !== null && data.todos.length > 0} + <ul class="flex flex-col gap-1"> + {#each data.todos as todo, i (i)} + <li class="flex items-start gap-2 rounded-box bg-base-200 px-3 py-2 text-sm"> + <!-- Status indicator --> + <span class="mt-0.5 shrink-0"> + {#if todo.status === "in_progress"} + <span class="loading loading-spinner loading-xs text-primary"></span> + {:else if todo.status === "completed"} + <svg + xmlns="http://www.w3.org/2000/svg" + viewBox="0 0 24 24" + fill="none" + stroke="currentColor" + stroke-width="3" + stroke-linecap="round" + stroke-linejoin="round" + class="h-4 w-4 text-success" + > + <polyline points="20 6 9 17 4 12"></polyline> + </svg> + {:else if todo.status === "cancelled"} + <svg + xmlns="http://www.w3.org/2000/svg" + viewBox="0 0 24 24" + fill="none" + stroke="currentColor" + stroke-width="3" + stroke-linecap="round" + stroke-linejoin="round" + class="h-4 w-4 text-base-content/40" + > + <line x1="18" y1="6" x2="6" y2="18"></line> + <line x1="6" y1="6" x2="18" y2="18"></line> + </svg> + {:else} + <!-- pending: empty circle --> + <span class="block h-4 w-4 rounded-full border-2 border-base-content/30"></span> + {/if} + </span> + + <!-- Content --> + <span + class:flex-1={true} + class:line-through={todo.status === "completed" || todo.status === "cancelled"} + class:opacity-50={todo.status === "completed" || todo.status === "cancelled"} + > + {todo.content} + </span> + + <!-- Priority dot --> + <span class="mt-1 h-2 w-2 shrink-0 rounded-full {priorityDot[todo.priority]}"></span> + </li> + {/each} + </ul> +{/if} |
