import Link from "next/link"; import type { ProjectSummary } from "@/lib/project-types"; import { fmtAgo, fmtBytes } from "@/lib/format"; import Panel from "./Panel"; // Built count, total bytes, newest, stale -- all from `attrs.finalBytes` and // each project's state. Nothing here stats a file; the summariser already did. export default 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.length} built {fmtBytes(bytes)} on disk {newest && ( newest{" "} {newest.id} {" "} {fmtAgo(newest.newestMtimeMs)} )} {stale.length > 0 && ( {stale.length} stale )}
); }