Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(todo): refine checklist dock presentation

Hanawa70f7b381bc36
diff --git a/apps/desktop/src/components/TodoDock.tsx b/apps/desktop/src/components/TodoDock.tsx
index 919a09358..be5fcbe7b 100644
--- a/apps/desktop/src/components/TodoDock.tsx
+++ b/apps/desktop/src/components/TodoDock.tsx
@@ -2,7 +2,7 @@ import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import type { SessionTodo, TodoStatus } from "@pi-desktop/shared";
import { Button } from "./ui";
-import { IconChevronDown, IconChevronUp } from "./icons";
+import { IconCheck, IconChevronDown, IconChevronUp } from "./icons";
import { api } from "../lib/api";
import { useAppStore } from "../stores/app-store";
@@ -10,8 +10,6 @@ const VISIBLE_LIMIT = 8;
function statusSymbol(status: TodoStatus): string {
switch (status) {
- case "completed":
- return "✓";
case "in_progress":
return "◐";
case "cancelled":
@@ -44,7 +42,7 @@ export function TodoDock({ sessionId }: { sessionId: string }) {
const finished = snapshot.todos.every(
(todo) => todo.status === "completed" || todo.status === "cancelled",
);
- const visible = expanded ? snapshot.todos.slice(0, VISIBLE_LIMIT) : [];
+ const visible = snapshot.todos.slice(0, VISIBLE_LIMIT);
const remaining = Math.max(0, snapshot.todos.length - VISIBLE_LIMIT);
const statusLabel = allCancelled
? t("chat.todo.status.cancelled")
@@ -69,7 +67,7 @@ export function TodoDock({ sessionId }: { sessionId: string }) {
<span className="todo-dock-header-text">{statusLabel}</span>
{expanded ? <IconChevronUp size={14} /> : <IconChevronDown size={14} />}
</Button>
- {expanded ? (
+ <div className="todo-dock-content" aria-hidden={!expanded}>
<div className="todo-dock-list" role="list">
{visible.map((todo, index) => (
<TodoRow key={`${index}:${todo.content}`} todo={todo} />
@@ -80,7 +78,7 @@ export function TodoDock({ sessionId }: { sessionId: string }) {
</div>
) : null}
</div>
- ) : null}
+ </div>
</div>
);
}
@@ -88,10 +86,11 @@ export function TodoDock({ sessionId }: { sessionId: string }) {
function TodoRow({ todo }: { todo: SessionTodo }) {
const { t } = useTranslation();
const label = t(`chat.todo.status.${todo.status}`);
+ const completed = todo.status === "completed";
return (
<div className={`todo-dock-row todo-dock-row-${todo.status}`} role="listitem">
<span className="todo-dock-row-symbol" role="img" aria-label={label} title={label}>
- {statusSymbol(todo.status)}
+ {completed ? <IconCheck size={13} aria-hidden /> : statusSymbol(todo.status)}
</span>
<span className="todo-dock-row-content" title={todo.content}>
{todo.content}
diff --git a/apps/desktop/src/styles/composer.css b/apps/desktop/src/styles/composer.css
index c57b94ab3..c7def50bb 100644
--- a/apps/desktop/src/styles/composer.css
+++ b/apps/desktop/src/styles/composer.css
@@ -790,6 +790,7 @@
}
.todo-dock {
+ margin-bottom: 8px;
border: 1px solid var(--ds-border-subtle);
border-radius: var(--radius-md);
background: var(--ds-bg-dock-raised);
@@ -807,6 +808,13 @@
color: var(--ds-text-primary);
text-align: left;
cursor: pointer;
+ transition: background-color var(--motion-duration-fast) var(--motion-ease-out);
+}
+
+/* TodoDock is a disclosure surface; avoid the shared button's scale press
+ feedback, which reads as a jelly effect on this compact header. */
+.todo-dock-header:active:not(:disabled) {
+ transform: none;
}
.todo-dock-header:hover,
@@ -816,7 +824,11 @@
.todo-dock-header-symbol,
.todo-dock-row-symbol {
+ display: grid;
flex: 0 0 auto;
+ width: 18px;
+ height: 18px;
+ place-items: center;
color: var(--ds-text-secondary);
font-size: var(--text-sm);
}
@@ -830,10 +842,29 @@
white-space: nowrap;
}
+.todo-dock-content {
+ display: grid;
+ grid-template-rows: 0fr;
+ opacity: 0;
+ transform: translateY(-4px);
+ transition:
+ grid-template-rows var(--motion-duration-normal) var(--motion-ease-out),
+ opacity var(--motion-duration-fast) var(--motion-ease-out),
+ transform var(--motion-duration-normal) var(--motion-ease-out);
+}
+
+.todo-dock.is-expanded .todo-dock-content {
+ grid-template-rows: 1fr;
+ opacity: 1;
+ transform: translateY(0);
+}
+
.todo-dock-list {
display: grid;
- gap: 2px;
- padding: 0 10px 8px;
+ min-height: 0;
+ gap: 6px;
+ padding: 0 10px 10px;
+ overflow: hidden;
}
.todo-dock-row {
@@ -841,16 +872,37 @@
min-width: 0;
align-items: center;
gap: 8px;
- padding: 3px 0;
+ min-height: 30px;
+ border-radius: var(--radius-sm);
+ padding: 4px 8px;
+ background: var(--ds-tile-deep);
color: var(--ds-text-secondary);
font-size: var(--text-xs);
+ transition:
+ background-color var(--motion-duration-fast) var(--motion-ease-out),
+ color var(--motion-duration-fast) var(--motion-ease-out);
+}
+
+.todo-dock-row-completed {
+ background: color-mix(in oklab, var(--ds-success) 14%, var(--ds-tile-deep));
+ color: var(--ds-text-primary);
+}
+
+.todo-dock-row-completed .todo-dock-row-symbol {
+ color: var(--ds-success);
}
.todo-dock-row-in_progress {
+ background: color-mix(in oklab, var(--ds-accent) 10%, var(--ds-tile-deep));
color: var(--ds-text-primary);
font-weight: var(--font-weight-medium);
}
+.todo-dock-row-cancelled {
+ color: var(--ds-text-muted);
+ opacity: 0.72;
+}
+
.todo-dock-row-content {
min-width: 0;
overflow: hidden;
@@ -862,3 +914,11 @@
color: var(--ds-text-muted);
font-size: var(--text-2xs);
}
+
+@media (prefers-reduced-motion: reduce) {
+ .todo-dock-header,
+ .todo-dock-content,
+ .todo-dock-row {
+ transition: none;
+ }
+}
diff --git a/apps/desktop/test/todo-dock-rendering.test.mjs b/apps/desktop/test/todo-dock-rendering.test.mjs
index 838622f4e..ffd424985 100644
--- a/apps/desktop/test/todo-dock-rendering.test.mjs
+++ b/apps/desktop/test/todo-dock-rendering.test.mjs
@@ -50,9 +50,11 @@ test("TodoDock renders bounded session progress and cancelled state", async () =
},
});
const html = render();
- assert.match(html, /1\/12 · Current: second/);
- assert.doesNotMatch(html, /extra-0/);
assert.match(html, /aria-expanded="false"/);
+ assert.match(html, /class="todo-dock-content" aria-hidden="true"/);
+ assert.match(html, /extra-0/);
+ assert.match(html, /4 more items/);
+ assert.match(html, /lucide-check/);
Object.assign(useAppStore.getInitialState(), {
sessionTodos: {
@@ -72,3 +74,13 @@ test("TodoDock renders bounded session progress and cancelled state", async () =
await server.close();
}
});
+
+test("TodoDock uses a quiet disclosure animation and state surfaces", async () => {
+ const { readFile } = await import("node:fs/promises");
+ const css = await readFile(new URL("../src/styles/composer.css", import.meta.url), "utf8");
+ assert.match(css, /\.todo-dock-header:active:not\(:disabled\)\s*\{[\s\S]*?transform:\s*none;/);
+ assert.match(css, /\.todo-dock-content\s*\{[\s\S]*?grid-template-rows:\s*0fr;[\s\S]*?opacity:\s*0;/);
+ assert.match(css, /\.todo-dock\.is-expanded \.todo-dock-content\s*\{[\s\S]*?grid-template-rows:\s*1fr;/);
+ assert.match(css, /\.todo-dock-row-completed\s*\{[\s\S]*?var\(--ds-success\)/);
+ assert.match(css, /@media \(prefers-reduced-motion: reduce\)\s*\{[\s\S]*?\.todo-dock-content/);
+});
diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.md
index 955c034a4..7e85f174d 100644
--- a/docs/spec/04-ux/08-component-spec.md
+++ b/docs/spec/04-ux/08-component-spec.md
@@ -2840,8 +2840,12 @@ reasoning-level control.
cancelled label instead of a misleading `0/0 completed` count.
- The disclosure is keyboard accessible, does not take focus on updates, resets
closed when the active session changes, and shows at most eight ordered rows.
- Each status symbol has a localized accessible name and each row renders plain
- text content.
+ The list stays mounted while collapsed so opening and closing can animate with
+ a bounded height/opacity transition; collapsed content is `aria-hidden` and
+ reduced-motion users receive an immediate state change. Completed rows use a
+ success-tinted tile with a check icon, in-progress rows use the accent tint,
+ and cancelled rows are muted; each status symbol has a localized accessible
+ name and each row renders plain text.
- Renderer snapshots are keyed by session id. A `todos.changed` event with an
older or equal revision is ignored. The initial `todos.get` recovery is
skipped for `remote:` sessions because remote Todo parity is deferred until an
diff --git a/docs/zh-CN/spec/04-ux/08-component-spec.md b/docs/zh-CN/spec/04-ux/08-component-spec.md
index 9ff84e2ea..f1b038240 100644
--- a/docs/zh-CN/spec/04-ux/08-component-spec.md
+++ b/docs/zh-CN/spec/04-ux/08-component-spec.md
@@ -2004,7 +2004,7 @@ MainChat 底部的输入区域,用于撰写和发送提示。支持多行输
- 当活动会话拥有非空的主机清单时,TodoDock 位于 Composer 栈中并显示在 Plan/Goal 批准表面上方;空清单不占布局空间。
- 收起标题显示完成/活动进度和当前 `in_progress` 内容;全部取消时显示明确的取消状态,不显示误导性的 `0/0 completed`。
-- 展开控件可键盘操作,不因更新抢焦点;切换活动会话时保持收起,最多显示八条有序行。每个状态符号都有本地化辅助名称,行内容按纯文本渲染。
+- 展开控件可键盘操作,不因更新抢焦点;切换活动会话时保持收起,最多显示八条有序行。列表在收起时仍保持挂载,通过有界的高度/透明度过渡播放展开和收起动画;收起内容设置为 `aria-hidden`,开启减少动画时立即切换状态。完成项使用带 check icon 的成功色区块,进行中使用强调色区块,取消项降低对比度;每个状态符号都有本地化辅助名称,行内容按纯文本渲染。
- 渲染器按 session id 保存快照并忽略旧或相同 revision。对于 `remote:` 会话跳过本地 `todos.get` 恢复,远程 Todo 对等能力留待新增 RACP 契约。
### 11.4 状态