import { useConsole } from "../context"; import { shortId } from "../api/client"; import { firstChar, durationOf, tokenOf } from "../api/taskMeta"; import { chvAvailability, chvQueueHint, chvVmBadge } from "../api/chv"; // 任务列表行 meta:首字 / 总耗时 / token,计算见 api/taskMeta.ts, // 与任务详情共用同一口径。 // GitHub issues-style task list: search on top, the project selector // (the auto-project fix — do not remove it), a 主要聊天 header with a // + button, then hairline rows with a Primer status dot at the left, // a 14px title and a 12px muted meta line. The search input IS the // existing task search (id/prompt); status and executor filters stay // as a compact row below it. The selected row gets the light // blue-grey background (#ddf4ff), not a bubble. export default function TaskListSection({ onNew }: { onNew: () => void }) { const ctx = useConsole(); const chvAvail = chvAvailability(ctx.workers, ctx.workersSummary, ctx.workersError); return (
ctx.setSearchText(e.target.value)} />
主要聊天
{ctx.taskCountText}
第 {ctx.taskPage + 1} / {ctx.taskTotalPages} 页(每页 20 条,最新在前)
{ctx.taskError ?
{ctx.taskError}
: !ctx.projectId ?
先选项目
: ctx.filteredTasks.length === 0 ?
{ctx.taskTotal ? "没有符合筛选条件的任务" : "该项目暂无任务"}
: ( )}
); }