From 4f4711a22ae6a88e7bf76718a3b49404ac372107 Mon Sep 17 00:00:00 2001 From: weichen Date: Wed, 30 Sep 2026 08:13:13 +0000 Subject: [PATCH] Add the tidy action and collapsed-rail pending badge (T5) Why: T5 notification strategy - the collapsed right rail must still surface the pending count (badge), and the inbox needs a one-key tidy (done cards dismissed; resolved verdicts keep their stamp). Evidence: tsc clean; vitest 9/9; vite build ok; delegation-only logic. Impact: App collapsed rail badge, store tidyCards (done->dismiss via existing cardDismiss), Workbench tidy button, styles. Refs: docs/proposals/2026-09-30-ui-inbox-command-workspace.md T5; task card feature/polish-r1 --- src/App.tsx | 5 ++++- src/components/Workbench.tsx | 1 + src/store.ts | 8 ++++++++ src/styles.css | 5 +++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/App.tsx b/src/App.tsx index 48b7a77..b0381ab 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -51,6 +51,7 @@ export function App() { const toast = useStore(s => s.toast) const trackerRunId = useStore(s => s.ui.trackerRunId) const viewingArtifact = useStore(s => s.ui.viewingArtifact) + const pendingBadge = useStore(s => s.cards.filter(c => c.status === 'action_required').length) // authState:checking → ok(放行)| required(登录门)。 const [authState, setAuthState] = useState<'checking' | 'required' | 'ok'>('checking') @@ -140,7 +141,9 @@ export function App() { ) : (
- +
)} diff --git a/src/components/Workbench.tsx b/src/components/Workbench.tsx index 8532c3e..10257f1 100644 --- a/src/components/Workbench.tsx +++ b/src/components/Workbench.tsx @@ -23,6 +23,7 @@ export function Workbench() { <>
收件箱{pending > 0 ? ` ${pending}` : ''} +
diff --git a/src/store.ts b/src/store.ts index 9e16cd1..24422e7 100644 --- a/src/store.ts +++ b/src/store.ts @@ -418,6 +418,14 @@ export const store = { toggleLeft() { setUI({ leftCollapsed: !state.ui.leftCollapsed }) }, toggleRight() { setUI({ rightCollapsed: !state.ui.rightCollapsed }) }, openWorkspace(id: string) { setUI({ activeWorkspace: id }) }, + /** 收纳策略(T5):一键收纳已完成卡(done→dismissed;resolved 盖章留痕不动)。 */ + async tidyCards() { + const done = state.cards.filter(c => c.status === 'done') + for (const c of done) { + try { const out = await api.cardDismiss(c.id); store.upsertCard(out.card) } catch { /* 单卡失败不阻断 */ } + } + if (done.length > 0) store.toast(`已收纳 ${done.length} 张完成卡`) + }, closeWorkspace() { setUI({ activeWorkspace: null }) }, openInbox(cardId?: string) { setUI({ rightCollapsed: false, rightTab: 'inbox' }) diff --git a/src/styles.css b/src/styles.css index 4d43a27..517b4aa 100644 --- a/src/styles.css +++ b/src/styles.css @@ -196,3 +196,8 @@ button { font-family: inherit; } .project-badge{font-size:11px;padding:1px 8px;border-radius:8px;background:rgba(120,160,255,.15);color:var(--accent);white-space:nowrap} .tab-hint{font-size:10px;color:var(--text-faint);align-self:center} .empty-note{color:var(--text-faint);font-size:12px;padding:12px 4px} + +/* 收纳策略(T5):收起态角标 + 收纳按钮 */ +.rail-badge{position:absolute;top:-4px;right:-6px;font-size:10px;background:var(--warn,#d29922);color:#fff;border-radius:8px;padding:0 5px;min-width:14px} +.right-panel.collapsed .icon-only button{position:relative} +.tab-action{font-size:11px;color:var(--text-faint)} -- 2.54.0