mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-16 13:03:31 +08:00
- Settings: new Providers tab with full CRUD, activation, and connectivity test; Model tab shows active provider name; General tab simplified - Tasks: new CLI Tasks page displaying task lists from ~/.claude/tasks/ with status, owner, and dependency (blocks/blockedBy) visualization - NewTaskModal: add Advanced options (model, permission mode, working dir) - Backend: fix TaskService to parse CLI V2 task format; extend /api/tasks with /lists endpoint for grouped queries - Fix ModelInfo.context type from number to string Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
import { create } from 'zustand'
|
|
import { cliTasksApi } from '../api/cliTasks'
|
|
import type { CLITask, TaskListSummary } from '../types/cliTask'
|
|
|
|
type CLITaskStore = {
|
|
taskLists: TaskListSummary[]
|
|
selectedListId: string | null
|
|
tasks: CLITask[]
|
|
isLoading: boolean
|
|
|
|
fetchTaskLists: () => Promise<void>
|
|
selectTaskList: (id: string) => Promise<void>
|
|
clearSelection: () => void
|
|
}
|
|
|
|
export const useCLITaskStore = create<CLITaskStore>((set) => ({
|
|
taskLists: [],
|
|
selectedListId: null,
|
|
tasks: [],
|
|
isLoading: false,
|
|
|
|
fetchTaskLists: async () => {
|
|
set({ isLoading: true })
|
|
try {
|
|
const { lists } = await cliTasksApi.listTaskLists()
|
|
set({ taskLists: lists, isLoading: false })
|
|
} catch {
|
|
set({ isLoading: false })
|
|
}
|
|
},
|
|
|
|
selectTaskList: async (id) => {
|
|
set({ selectedListId: id, isLoading: true })
|
|
try {
|
|
const { tasks } = await cliTasksApi.getTasksForList(id)
|
|
set({ tasks, isLoading: false })
|
|
} catch {
|
|
set({ tasks: [], isLoading: false })
|
|
}
|
|
},
|
|
|
|
clearSelection: () => {
|
|
set({ selectedListId: null, tasks: [] })
|
|
},
|
|
}))
|