Redesign Tasks screen: expandable TaskCard, sidebar controls, and list panel

- Redesign TaskCard to match v1 Task Details panel layout:
  header with task ID + status badge + cancel button,
  always-visible summary row (Status, Last Updated, Created At, TTL)
  with Expand/Collapse button, expandable section with status message,
  progress bar, error, and Full Task Object JSON viewer
- Add TaskControls group: search input + status filter dropdown +
  Refresh/Clear History buttons (mirrors HistoryControls pattern)
- Add TaskListPanel group: scrollable panel with ListToggle for
  expand/collapse all, splits tasks into Active/Completed sections
  with counts, filters by search text and status
- Refactor TasksScreen to sidebar + panel layout matching HistoryScreen:
  manages search/filter state internally, flat tasks array
- Simplify TaskCard callbacks to just onCancel
- Extract named .withProps() subcomponents (HeaderLeftGroup,
  HeaderRightGroup, SectionTitle, SummaryRow, DetailRow) for
  AGENTS.md compliance
- Update all stories (TaskCard, TaskControls, TaskListPanel,
  TasksScreen, ConnectedView)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
cliffhall 2026-03-29 22:03:54 -04:00
commit c494d2feb4

View file

@ -6,10 +6,8 @@ const meta: Meta<typeof TaskCard> = {
title: "Groups/TaskCard",
component: TaskCard,
args: {
onViewDetails: fn(),
onViewResult: fn(),
onCancel: fn(),
onDismiss: fn(),
isListExpanded: true,
},
};
@ -18,77 +16,82 @@ type Story = StoryObj<typeof TaskCard>;
export const Running: Story = {
args: {
taskId: "task-abc-123",
taskId: "d0b22eba71fa36229ce5c4dfadeaa7de",
status: "running",
method: "tools/call",
target: "generate_report",
progress: 80,
progressDescription: "Generating report section 4 of 5...",
startedAt: "2026-03-17T10:30:00Z",
elapsed: "2m 15s",
},
};
export const RunningWithProgress: Story = {
args: {
taskId: "task-def-456",
status: "running",
method: "tools/call",
target: "analyze_data",
progress: 45,
progressDescription: "Analyzing dataset...",
startedAt: "2026-03-17T10:32:00Z",
elapsed: "30s",
progressDescription: "Synthesizing findings...",
startedAt: "3/29/2026, 8:18:20 PM",
lastUpdated: "3/29/2026, 8:18:22 PM",
ttl: 300000,
},
};
export const Waiting: Story = {
args: {
taskId: "task-ghi-789",
taskId: "4100b5e0b0ed9cd0023330342d1bf647",
status: "waiting",
method: "resources/read",
target: "file:///data/report.csv",
progress: 0,
startedAt: "2026-03-17T10:35:00Z",
startedAt: "3/29/2026, 8:17:55 PM",
lastUpdated: "3/29/2026, 8:17:55 PM",
ttl: 300000,
},
};
export const Completed: Story = {
args: {
taskId: "task-jkl-012",
taskId: "d487b49aa39023d907b5a2a5b506cb3",
status: "completed",
method: "tools/call",
target: "generate_summary",
progress: 100,
startedAt: "2026-03-17T10:20:00Z",
completedAt: "2026-03-17T10:25:00Z",
elapsed: "5m 00s",
startedAt: "3/29/2026, 8:16:47 PM",
completedAt: "3/29/2026, 8:16:51 PM",
lastUpdated: "3/29/2026, 8:16:51 PM",
ttl: 300000,
progressDescription: "Generating report...",
},
};
export const Failed: Story = {
args: {
taskId: "task-mno-345",
taskId: "e6ebffd9cca84ddd1646d3c579a4d453",
status: "failed",
method: "tools/call",
target: "fetch_remote_data",
progress: 45,
startedAt: "2026-03-17T10:28:00Z",
completedAt: "2026-03-17T10:29:30Z",
elapsed: "1m 30s",
startedAt: "3/29/2026, 8:17:27 PM",
completedAt: "3/29/2026, 8:17:28 PM",
lastUpdated: "3/29/2026, 8:17:28 PM",
ttl: 300000,
error: "Connection refused: upstream server not responding after 3 retries",
},
};
export const Cancelled: Story = {
args: {
taskId: "task-pqr-678",
taskId: "c416bc183cb04468d3f81696f1b868f6",
status: "cancelled",
method: "tools/call",
target: "long_running_analysis",
progress: 30,
startedAt: "2026-03-17T10:15:00Z",
completedAt: "2026-03-17T10:18:00Z",
elapsed: "3m 00s",
startedAt: "3/29/2026, 8:18:15 PM",
completedAt: "3/29/2026, 8:18:18 PM",
lastUpdated: "3/29/2026, 8:18:18 PM",
ttl: 300000,
},
};
export const Collapsed: Story = {
args: {
taskId: "d0b22eba71fa36229ce5c4dfadeaa7de",
status: "running",
method: "tools/call",
target: "generate_report",
progress: 80,
progressDescription: "Synthesizing findings...",
startedAt: "3/29/2026, 8:18:20 PM",
lastUpdated: "3/29/2026, 8:18:22 PM",
ttl: 300000,
isListExpanded: false,
},
};