Phase 2: Refactor Tasks cluster to MCP SDK types
Replace ad hoc TaskCardProps data shape with SDK Task type across the Tasks group components and TasksScreen. - TaskCard: accept `task: Task` instead of flat props (taskId, status, method, target, progress, etc.); derive all display fields from the SDK Task object (taskId, status, ttl, createdAt, lastUpdatedAt, statusMessage); remove fields not present on SDK Task (method, target, progress as number, error, completedAt, elapsed) - TaskControls: type statusFilter as `TaskStatus | undefined`; add runtime validation guard on Select onChange - TaskListPanel: accept `Task[]` instead of `TaskCardProps[]`; pass `onCancel(taskId)` through to each TaskCard; use `task.taskId` as key - TasksScreen: accept `Task[]` + `onCancel(taskId)` callback; type internal statusFilter state as `TaskStatus | undefined` - Delete re-export of `TaskStatus` from TaskCard (import directly from SDK where needed) - Update all stories with real SDK `Task` fixtures - Update ConnectedView TasksActive story Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a1052a1b9d
commit
6abb39a5fe
1 changed files with 140 additions and 262 deletions
|
|
@ -16,9 +16,9 @@ const ToolbarButton = Button.withProps({
|
|||
|
||||
export interface TaskControlsProps {
|
||||
searchText: string;
|
||||
statusFilter?: string;
|
||||
statusFilter?: TaskStatus;
|
||||
onSearchChange: (text: string) => void;
|
||||
onStatusFilterChange: (status: string) => void;
|
||||
onStatusFilterChange: (status: TaskStatus | undefined) => void;
|
||||
onRefresh: () => void;
|
||||
}
|
||||
|
||||
|
|
@ -47,7 +47,13 @@ export function TaskControls({
|
|||
placeholder="All statuses"
|
||||
data={STATUS_OPTIONS}
|
||||
value={statusFilter ?? null}
|
||||
onChange={(value) => onStatusFilterChange(value ?? "")}
|
||||
onChange={(value) =>
|
||||
onStatusFilterChange(
|
||||
value && STATUS_OPTIONS.includes(value as TaskStatus)
|
||||
? (value as TaskStatus)
|
||||
: undefined,
|
||||
)
|
||||
}
|
||||
clearable
|
||||
/>
|
||||
</Stack>
|
||||
|
|
|
|||
Loading…
Reference in a new issue