The control room, on the primitives from the previous commit. Being the first page it also settles the shape of the rest: shadcn components for chrome, one feature folder per page, Lucide imported at the call site. Carried across deliberately, because each was a fix rather than a layout: - Live activity's detail is cut to one line and clamped again in the cell, so a long unbroken token (a path, a URL, a hash) cannot widen the column past the table. Unclamped, one agent_finish row made the dashboard 7,481px tall. - Each HEALTH card takes its own content height. Matching them was right while both held a checklist; once setup is done that card is a title and a line while Gate pulse carries a gauge and four rows, so equalising them left a mostly-empty box taking a quarter of the first screen. The task links are router paths now, not the `#/tasks` hashes the Preact build used. History routing means a hash is not a route any more, so one that survived here would navigate nowhere. Also in this change: - Button gains an `attention` variant, in the project's own cva. An action that exists because something needs a human has to look unlike one that is always present, and `destructive` would overstate it: nothing is broken, it is waiting. - The setup panel branches on the state machine rather than on "is setup present at all". Guarding on presence showed a 100% checklist with every step struck through where the complete state belongs.
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
const ATTENTION_STATUSES = new Set(["waiting_human", "parked"]);
|
|
|
|
/** The task fields these links are derived from. */
|
|
export interface TaskTarget {
|
|
id: number | string;
|
|
status?: string;
|
|
}
|
|
|
|
export interface TaskTargets {
|
|
attention: { count: number; href: string };
|
|
running: { count: number; href: string };
|
|
}
|
|
|
|
// Dashboard task links are derived from the actual task list, not just count
|
|
// aggregates, so a single item can open directly while a group opens a useful
|
|
// filtered board.
|
|
//
|
|
// The hrefs are router paths, not the `#/tasks` hashes the Preact build used.
|
|
// History routing means a hash is not a route any more, so one that survived
|
|
// here would navigate nowhere.
|
|
export function dashboardTaskTargets(tasks: TaskTarget[] = []): TaskTargets {
|
|
const attention = tasks.filter((task) => ATTENTION_STATUSES.has(task.status ?? ""));
|
|
const running = tasks.filter((task) => task.status === "running");
|
|
return {
|
|
attention: {
|
|
count: attention.length,
|
|
href:
|
|
attention.length === 1
|
|
? `/tasks?task=${encodeURIComponent(attention[0].id)}`
|
|
: "/tasks?status=needs_you",
|
|
},
|
|
running: {
|
|
count: running.length,
|
|
href: "/tasks?status=running",
|
|
},
|
|
};
|
|
}
|