5381094bba
- Add react-markdown with remark-breaks and remark-gfm for markdown rendering - Improve WebSocket client with better reconnection handling - Enhanced task chat panel with markdown support for comments - Add comment type and metadata support for tool call rendering - Improve connection status indicator - Update task page with improved agent controls - Add WebSocket router for better message handling - Update state store with enhanced type safety
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import type { AppState, KanbanState } from '@/lib/state/store';
|
|
import type { BoardSnapshot, Task } from '@/lib/types/http';
|
|
|
|
type KanbanTask = KanbanState['tasks'][number];
|
|
|
|
export function snapshotToState(snapshot: BoardSnapshot): Partial<AppState> {
|
|
const tasks = snapshot.tasks
|
|
.map((task) => {
|
|
const columnId = task.column_id;
|
|
if (!columnId) return null;
|
|
return {
|
|
id: task.id,
|
|
columnId,
|
|
title: task.title,
|
|
description: task.description ?? undefined,
|
|
position: task.position ?? 0,
|
|
state: task.state,
|
|
} as KanbanTask;
|
|
})
|
|
.filter((task): task is KanbanTask => task !== null);
|
|
|
|
return {
|
|
kanban: {
|
|
boardId: snapshot.board.id,
|
|
columns: snapshot.columns.map((column) => ({
|
|
id: column.id,
|
|
title: column.name,
|
|
color: column.color ?? 'bg-neutral-400',
|
|
position: column.position,
|
|
})),
|
|
tasks,
|
|
},
|
|
};
|
|
}
|
|
|
|
export function taskToState(task: Task): Partial<AppState> {
|
|
return {
|
|
tasks: {
|
|
activeTaskId: task.id,
|
|
},
|
|
};
|
|
}
|