fix: resolve final workbench review findings

This commit is contained in:
2026-07-19 20:20:09 +08:00
parent 43d0b9f049
commit 27ff659c30
12 changed files with 172 additions and 30 deletions

View File

@@ -3,35 +3,25 @@
export let tasks: WorkTask[];
export let onInspect: (item: InspectorItem) => void;
let taskStates: WorkTask[] = [];
let sourceTasks: WorkTask[] | undefined;
$: if (tasks !== sourceTasks) {
sourceTasks = tasks;
taskStates = tasks.map((task) => ({ ...task }));
}
export let onToggleTask: (taskID: string) => void = () => {};
function inspectTask(task: WorkTask) {
onInspect({ title: task.title, type: 'Task', description: task.summary, properties: [{ label: 'Status', value: task.completed ? 'Completed' : 'Open' }, { label: 'Owner', value: task.owner }, { label: 'Due', value: task.due }, { label: 'Tag', value: task.tag }] });
}
function toggleTask(taskID: string) {
taskStates = taskStates.map((task) => task.id === taskID ? { ...task, completed: !task.completed } : task);
}
</script>
<section class="channel-page tasks-channel">
<header class="channel-header"><p>Work Plan</p><h1>Tasks</h1></header>
<div class="task-list">
{#each taskStates as task}
{#each tasks as task}
<article class:completed={task.completed} class="task-card">
<input
class="task-check"
type="checkbox"
aria-label={`Mark ${task.title} complete`}
checked={task.completed}
on:change={() => toggleTask(task.id)}
on:change={() => onToggleTask(task.id)}
/>
<div>
<h2>{task.title}</h2>