import Link from "next/link"; import CheckSourcesButton from "@/components/system/CheckSourcesButton"; import { Panel } from "@/components/ui/panel"; import type { ActivityItem } from "@/lib/activity"; import { SOURCES_STALE_DAYS, type StateRow } from "@/lib/system/status"; import { fmtAgo, fmtBytes } from "@/lib/format"; import { projectHref, projectsHref } from "@/lib/hrefs"; import type { ProjectSummary } from "@/lib/project-types"; import NowLive from "./NowLive"; // --------------------------------------------------------------------------- // Settings · system's status panels (the old dashboard's, P3; moved here and // cut to status lines in P6). Everything is read from the index, the job // registries and the summaries -- nothing here probes or shells out. // --------------------------------------------------------------------------- /** umtool's own jobs: the one running (live), then the newest that ended. */ export function ActivityPanel({ running, recent }: { running: ActivityItem | null; recent: ActivityItem[] }) { const done = recent.filter((a) => a.state !== "running"); return ( umtool's jobs}> {done.length > 0 && ( )} ); } // One row per kind, the six states as proportional segments. ONE meaningful // colour: `stale` (a deliverable older than what describes it) is the doubt // word; every other state is a step on a neutral ramp. const FILL: Record = { draft: "var(--color-panel-2)", windows: "var(--color-line)", fetched: "color-mix(in srgb, var(--color-dim) 45%, transparent)", built: "color-mix(in srgb, var(--color-text) 55%, transparent)", shipped: "var(--color-text)", stale: "var(--color-dirty)", }; export function ProjectsPanel({ rows, note }: { rows: StateRow[]; note: string }) { return ( Every project → } >

{note}

{rows.map((r) => (
{r.label} {r.total}
{r.segments .filter((s) => s.n > 0) .map((s) => ( ))}
{r.segments .filter((s) => s.n > 0) .map((s) => `${s.n} ${s.state}`) .join(" · ")}
))}
); } /** Report projects whose sources nobody checked, checked long ago, or found dead -- from summaries, never probed. */ export function SourcesPanel({ never, old, bad }: { never: ProjectSummary[]; old: ProjectSummary[]; bad: ProjectSummary[] }) { const List = ({ items, attr, label }: { items: ProjectSummary[]; attr: string; label: string }) => ( <>
{label}
); const recheck = [...never, ...old].map((p) => p.id); return ( }>

{never.length} never checked · {old.length} older than{" "} {SOURCES_STALE_DAYS} d · {bad.length} dead or missing

{bad.length > 0 && } {never.length > 0 && } {old.length > 0 && }
); } /** Built count, bytes, newest, stale -- from each summary's `final-bytes` and state; nothing here stats a file. */ export function DeliverablesPanel({ projects }: { projects: ProjectSummary[] }) { const built = projects.filter((p) => p.attrs?.["final-bytes"]); const bytes = built.reduce((n, p) => n + Number(p.attrs?.["final-bytes"] ?? 0), 0); const newest = [...built].sort((a, b) => b.newestMtimeMs - a.newestMtimeMs)[0] ?? null; const stale = projects.filter((p) => p.state === "stale"); return ( Built → } >

{built.length} built · {fmtBytes(bytes)} {newest && ( newest{" "} {newest.id} {" "} {fmtAgo(newest.newestMtimeMs)} )} {stale.length > 0 && ( {stale.length} stale )}

); }