Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 9035e9d58c0c01f6d16a3ee580b10bf036394a79
parent 6e9335e517a88b52a5a8452fcf39106561fdbe00
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 14 Oct 2026 02:28:31 -0400

umtool: Work, Tools, Settings · system

/work lists every piece as one lit list -- stage bar, kind, lifecycle, open
calls -- with facets (stage, kind, site, lifecycle, search) and the old
/browse, /articles and /sites keys (lib/work/facets.mjs, unit-tested). /tools
and /tools/song index the tools; /settings/system holds the dashboard's
panels; /settings lists both settings pages. Park, Mark done and Reactivate
POST the lifecycle with an Undo bar.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Aumtool/app/settings/page.tsx | 28++++++++++++++++++++++++++++
Aumtool/app/settings/system/page.tsx | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aumtool/app/tools/page.tsx | 41+++++++++++++++++++++++++++++++++++++++++
Aumtool/app/tools/song/page.tsx | 20++++++++++++++++++++
Aumtool/app/work/page.tsx | 292+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dumtool/components/dashboard/DecisionsPanel.tsx | 51---------------------------------------------------
Mumtool/components/dashboard/DeliverablesPanel.tsx | 6+++---
Mumtool/components/dashboard/InboxList.tsx | 4++--
Aumtool/components/dashboard/SlashFocus.tsx | 23+++++++++++++++++++++++
Mumtool/components/dashboard/SourcesPanel.tsx | 2+-
Mumtool/components/dashboard/StateStrip.tsx | 4++--
Aumtool/components/dashboard/ToolList.tsx | 36++++++++++++++++++++++++++++++++++++
Mumtool/lib/dashboard.ts | 8++++----
13 files changed, 515 insertions(+), 63 deletions(-)

diff --git a/umtool/app/settings/page.tsx b/umtool/app/settings/page.tsx @@ -0,0 +1,28 @@ +import AppShell from "@/components/shell/AppShell"; +import ToolList from "@/components/dashboard/ToolList"; +import { generationPolicyHref, systemHref } from "@/lib/hrefs"; + +export const dynamic = "force-dynamic"; + +// SETTINGS: the two pages. /settings/generation arrives with P5; until then +// the generation policy is set on the new-article form, its current home. +export default function SettingsPage() { + return ( + <div className="flex h-full flex-col"> + <AppShell active="settings" crumbs={[{ label: "Settings" }]} /> + <main className="deck-main flex-1 px-4 pb-6 pt-4"> + <ToolList + groups={[ + { + title: "Settings", + tools: [ + { href: systemHref(), name: "system", what: "Tools, disk, index, sources, deliverables, recent jobs", testid: "system" }, + { href: generationPolicyHref(), name: "generation policy", what: "Routes, models and caps — on the new-article form until P5", testid: "generation" }, + ], + }, + ]} + /> + </main> + </div> + ); +} diff --git a/umtool/app/settings/system/page.tsx b/umtool/app/settings/system/page.tsx @@ -0,0 +1,63 @@ +import Link from "next/link"; +import DeliverablesPanel from "@/components/dashboard/DeliverablesPanel"; +import NowPanel from "@/components/dashboard/NowPanel"; +import SourcesPanel from "@/components/dashboard/SourcesPanel"; +import StateStrip from "@/components/dashboard/StateStrip"; +import ToolsPanel from "@/components/dashboard/ToolsPanel"; +import AppShell from "@/components/shell/AppShell"; +import { listActivity, runningActivity } from "@/lib/activity"; +import { projectsNote, sourceBuckets, stateRows } from "@/lib/dashboard"; +import { toolsCache } from "@/lib/doctor"; +import { generationPolicyHref } from "@/lib/hrefs"; +import { freeBytesUnder } from "@/lib/machine"; +import { REPORTS_ROOT } from "@/lib/paths"; +import { KINDS, decisionCounts, indexHealth, listProjects } from "@/lib/projects"; + +export const dynamic = "force-dynamic"; + +// SETTINGS · SYSTEM (plans/umtool-redesign.md, P3): the machine and the +// collection at a glance -- what ran, where every project stands, which +// sources nobody has checked, what has been built, and whether the machine can +// build at all. These were the dashboard's panels; what in them is a CALL +// (a required tool missing, a disk nearly full) is an Inbox card instead. +// +// Everything is read from the index and the job registries; nothing here +// shells out -- the tools panel shows a cache or "not checked", and probing is +// its button. P5 adds the doctor, index and storage actions. + +export default async function SystemPage() { + const projects = await listProjects(); + const counts = await decisionCounts(); + const running = runningActivity(); + const recent = listActivity(8); + const tools = toolsCache(); + const ix = indexHealth(); + const free = await freeBytesUnder(REPORTS_ROOT); + + const blocking = [...counts.values()].reduce((n, c) => n + c.blocking, 0); + const openN = [...counts.values()].reduce((n, c) => n + c.open, 0); + const buckets = sourceBuckets(projects); + + return ( + <div className="flex h-full flex-col"> + <AppShell + active="system" + crumbs={[{ href: "/settings", label: "settings" }, { label: "system" }]} + actions={ + <Link href={generationPolicyHref()} data-policy-link="" className="ink-link text-[12.5px]"> + Generation policy → + </Link> + } + /> + <main className="deck-main flex-1 p-4"> + <div className="grid gap-3 lg:grid-cols-2 2xl:grid-cols-3"> + <ToolsPanel initial={tools} freeBytes={free} index={ix} /> + <NowPanel running={running} recent={recent} /> + <StateStrip rows={stateRows(KINDS, projects)} note={projectsNote(projects.length, blocking, openN)} /> + <SourcesPanel never={buckets.never} old={buckets.old} bad={buckets.bad} /> + <DeliverablesPanel projects={projects} /> + </div> + </main> + </div> + ); +} diff --git a/umtool/app/tools/page.tsx b/umtool/app/tools/page.tsx @@ -0,0 +1,41 @@ +import AppShell from "@/components/shell/AppShell"; +import ToolList, { PILE_WHAT, type ToolEntry } from "@/components/dashboard/ToolList"; +import { benchHref, facesHref, findHref, mixHref, pileHref, songToolsHref, sourcesHref, trimHref } from "@/lib/hrefs"; +import { TRIM_SETS } from "@/lib/trim"; + +export const dynamic = "force-dynamic"; + +// TOOLS (plans/umtool-redesign.md, P3): every bench that is not a piece's own +// -- the song tooling that was top-level (find, mix, the four piles) and the +// pages only deep links reached (faces, trims, sources), plus release 28's +// verdict bench. One lit list; the rail opens Tools into the same entries +// while you are in one. + +export default function ToolsPage() { + const song: ToolEntry[] = [ + { href: songToolsHref(), name: "Song piles", what: "The four judging piles, one page", testid: "song" }, + ...(["sort", "salvage", "verify", "keeps"] as const).map((m) => ({ href: pileHref(m), name: m, what: PILE_WHAT[m], testid: m })), + { href: findHref(), name: "find", what: "Every occurrence of a word across the corpus", testid: "find" }, + { href: mixHref(), name: "mix", what: "A body and its clips on lanes, rendered", testid: "mix" }, + { href: facesHref(), name: "faces", what: "Judge the faces a cover is cut around", testid: "faces" }, + { href: sourcesHref(), name: "sources", what: "Where the palette comes from, across every song", testid: "sources" }, + ...Object.values(TRIM_SETS).map((t) => ({ href: trimHref(t.id), name: `trim: ${t.id}`, what: t.label, testid: `trim-${t.id}` })), + ]; + const articles: ToolEntry[] = [ + { href: benchHref(), name: "verdict bench", what: "Could a model propose a fact-check verdict well enough to review", testid: "bench" }, + ]; + const n = song.length + articles.length; + return ( + <div className="flex h-full flex-col"> + <AppShell active="tools" crumbs={[{ label: "Tools" }]} meta={`${n} tools`} /> + <main className="deck-main flex-1 px-4 pb-6 pt-4"> + <ToolList + groups={[ + { title: "Song", tools: song }, + { title: "Articles", tools: articles }, + ]} + /> + </main> + </div> + ); +} diff --git a/umtool/app/tools/song/page.tsx b/umtool/app/tools/song/page.tsx @@ -0,0 +1,20 @@ +import AppShell from "@/components/shell/AppShell"; +import ToolList, { PILE_WHAT } from "@/components/dashboard/ToolList"; +import { pileHref, toolsHref } from "@/lib/hrefs"; +import { MODES } from "@/lib/types"; + +export const dynamic = "force-dynamic"; + +// The song piles' own index (/tools/song): where /tools/song/<pile>'s parent +// walk lands (lib/last-page.ts), and the four piles in judging order. + +export default function SongToolsPage() { + return ( + <div className="flex h-full flex-col"> + <AppShell active="song" crumbs={[{ href: toolsHref(), label: "tools" }, { label: "song piles" }]} /> + <main className="deck-main flex-1 px-4 pb-6 pt-4"> + <ToolList groups={[{ title: "Piles", tools: MODES.map((m) => ({ href: pileHref(m), name: m, what: PILE_WHAT[m], testid: m })) }]} /> + </main> + </div> + ); +} diff --git a/umtool/app/work/page.tsx b/umtool/app/work/page.tsx @@ -0,0 +1,292 @@ +import Link from "next/link"; +import { UndoBar, LifecycleButton } from "@/components/dashboard/Lifecycle"; +import SlashFocus from "@/components/dashboard/SlashFocus"; +import AppShell from "@/components/shell/AppShell"; +import { badgeVariants } from "@/components/ui/badge"; +import { buttonVariants } from "@/components/ui/button"; +import { EmptyState } from "@/components/ui/empty-state"; +import { Input } from "@/components/ui/field"; +import { LitList } from "@/components/ui/lit-list"; +import { LitActions, LitGroup, LitLine } from "@/components/ui/lit-line"; +import { Toolbar, ToolbarGroup } from "@/components/ui/toolbar"; +import { newArticleHref, projectsHref, siteHref, workHref, type WorkQuery } from "@/lib/hrefs"; +import { KINDS } from "@/lib/projects"; +import { readWork, type WorkRow } from "@/lib/work"; +import { LIFECYCLES, STAGES, keepRow, lifeFilter, sortRows } from "@/lib/work/facets.mjs"; +import { cn } from "@/lib/utils"; + +export const dynamic = "force-dynamic"; + +// --------------------------------------------------------------------------- +// WORK (plans/umtool-redesign.md, P3; canvas "Work"): every piece in one lit +// list -- an article with its video projects, or a project no article claims. +// Facets: stage, kind, site, lifecycle (active by default), and a search. It +// replaced three lists, and reads their keys (lib/work/facets.mjs): /browse's +// (kind, template, state, open, sort), /articles' (status, notes, audience) +// and /sites' (site; `by=site` groups by site). A key with no chip of its own +// shows as a chip you can take off. +// +// The facets are links that change searchParams and the search is a GET form, +// so any view is one pasteable URL. The rows' lifecycle buttons are the only +// client JS beyond the lit list. +// --------------------------------------------------------------------------- + +type Search = { [K in keyof WorkQuery]?: string }; + +const STAGE_LABEL: Record<string, string> = { research: "Research", article: "Article", video: "Video", deliver: "Deliver" }; +const LIFE_LABEL: Record<string, string> = { active: "Active", parked: "Parked", done: "Done" }; +/** Keys from the old lists that Work filters on but has no chip group for. */ +const EXTRA: { key: keyof Search; label: string }[] = [ + { key: "template", label: "template" }, + { key: "state", label: "state" }, + { key: "open", label: "decisions" }, + { key: "status", label: "status" }, + { key: "notes", label: "notes" }, + { key: "audience", label: "audience" }, +]; + +export default async function WorkPage({ searchParams }: { searchParams: Promise<Search> }) { + const sp = await searchParams; + const { rows: all, lifecycleError } = await readWork(); + const q = sp as Record<string, string | undefined>; + const shown = sortRows( + all.filter((r) => keepRow(r, q)), + sp.sort, + ) as WorkRow[]; + const life = lifeFilter(sp.life); + // A chip's count: how many pieces that chip would show, the other facets kept. + const n = (over: Partial<Search>) => all.filter((r) => keepRow(r, { ...q, ...over })).length; + const href = (next: Partial<Search>) => workHref({ ...sp, deleted: undefined, freed: undefined, ...next }); + + const sites = [...new Set(all.map((r) => r.site).filter((s): s is string => !!s))].sort(); + const kinds = [{ id: "article", label: "Article" }, ...KINDS.map((k) => ({ id: k.id, label: k.label }))].filter( + (k) => all.some((r) => r.kinds.includes(k.id)), + ); + const bySite = sp.by === "site"; + const groups = bySite ? groupBySite(shown) : [{ key: "", title: null as React.ReactNode, rows: shown }]; + + return ( + <div className="flex h-full flex-col"> + <AppShell + active="work" + crumbs={[{ label: "Work" }]} + meta={ + <span data-work-count={shown.length}> + {shown.length} piece{shown.length === 1 ? "" : "s"} shown · {life ?? "every lifecycle"} + </span> + } + actions={ + <> + <Link href={newArticleHref()} className={buttonVariants({ variant: "quiet", size: "md" })}> + + New article + </Link> + <Link href={projectsHref({ new: true })} className={buttonVariants({ variant: "quiet", size: "md" })}> + + New project + </Link> + </> + } + /> + <SlashFocus target="[data-work-search]" /> + + <Toolbar aria-label="Filters" className="px-4"> + {/* A GET form, so a search is a pasteable URL; the other keys ride along. */} + <form method="get" action={workHref()} className="flex items-center gap-1.5" role="search"> + {(Object.keys(sp) as (keyof Search)[]) + .filter((k) => k !== "q" && k !== "deleted" && k !== "freed" && sp[k]) + .map((k) => ( + <input key={k} type="hidden" name={k} value={sp[k]} /> + ))} + <Input + type="search" + name="q" + defaultValue={sp.q ?? ""} + placeholder="Find a piece" + aria-label="Find a piece" + data-work-search="" + className="w-56 py-[3px] text-[12.5px]" + /> + <kbd aria-hidden="true">/</kbd> + {sp.q && ( + <Link href={href({ q: "" })} className="ink-link text-[12px]"> + clear + </Link> + )} + </form> + <ToolbarGroup label="Stage" data-facet="stage"> + <Chip href={href({ stage: "" })} on={!sp.stage} label="Any" /> + {STAGES.map((s) => ( + <Chip key={s} href={href({ stage: s })} on={sp.stage === s} label={STAGE_LABEL[s]} n={n({ stage: s })} /> + ))} + </ToolbarGroup> + <ToolbarGroup label="Kind" data-facet="kind"> + <Chip href={href({ kind: "" })} on={!sp.kind} label="Any" /> + {kinds.map((k) => ( + <Chip key={k.id} href={href({ kind: k.id })} on={sp.kind === k.id} label={k.label} n={n({ kind: k.id })} /> + ))} + </ToolbarGroup> + <ToolbarGroup label="Lifecycle" data-facet="life"> + {LIFECYCLES.map((l) => ( + <Chip + key={l} + href={href({ life: l === "active" ? "" : l })} + on={life === l} + label={LIFE_LABEL[l]} + n={n({ life: l })} + /> + ))} + <Chip href={href({ life: "all" })} on={life === null} label="All" n={n({ life: "all" })} /> + </ToolbarGroup> + <ToolbarGroup label="Site" data-facet="site"> + <Chip href={href({ site: "" })} on={!sp.site} label="Any" /> + {sites.map((s) => ( + <Chip key={s} href={href({ site: s })} on={sp.site === s} label={s} n={n({ site: s })} /> + ))} + {sp.site && ( + <Link href={siteHref(sp.site)} data-site-page={sp.site} className="ink-link ml-1 text-[12px]"> + site page → + </Link> + )} + </ToolbarGroup> + <ToolbarGroup label="View"> + <Chip href={href({ by: bySite ? "" : "site" })} on={bySite} label="By site" /> + <Chip href={href({ sort: sp.sort === "name" ? "" : "name" })} on={sp.sort === "name"} label="By name" /> + </ToolbarGroup> + {EXTRA.some((e) => sp[e.key]) && ( + <ToolbarGroup label="Also" data-facet="also"> + {EXTRA.filter((e) => sp[e.key]).map((e) => ( + <Link + key={e.key} + href={href({ [e.key]: "" })} + aria-current="true" + data-extra={e.key} + className={badgeVariants({ variant: "on" })} + > + {e.label}: {sp[e.key]} <span className="text-muted">×</span> + </Link> + ))} + </ToolbarGroup> + )} + </Toolbar> + + <main className="deck-main flex-1 px-4 pb-6 pt-2"> + {sp.deleted && ( + <p role="status" data-deleted={sp.deleted} className="mb-2 text-[12.5px] text-text-2"> + Deleted {sp.deleted} + {Number(sp.freed) > 0 ? ` (${(Number(sp.freed) / 1024 / 1024).toFixed(1)} MiB)` : ""}. + </p> + )} + {lifecycleError && ( + <p role="alert" className="mb-2 text-[12.5px] text-reject-text"> + {lifecycleError} — every piece reads as active until it is fixed. + </p> + )} + + {shown.length === 0 ? ( + <EmptyState title={all.length === 0 ? "No pieces: no articles and no projects" : "Nothing matches that filter"} /> + ) : ( + <> + <div className="grid grid-cols-[minmax(0,1fr)_190px_160px_130px_56px] gap-x-3.5 pb-1.5 pl-5 pr-3 pt-2"> + <span className="micro">Piece</span> + <span className="micro">Stage</span> + <span className="micro">Kind</span> + <span className="micro">Lifecycle</span> + <span className="micro text-right">Open</span> + </div> + <LitList label="Pieces" global> + {groups.map((g) => + g.title ? ( + <LitGroup key={g.key} data-site={g.key} className="mt-4" title={g.title} count={g.rows.length}> + {g.rows.map((r) => ( + <Row key={r.id} r={r} /> + ))} + </LitGroup> + ) : ( + g.rows.map((r) => <Row key={r.id} r={r} />) + ), + )} + </LitList> + </> + )} + </main> + <UndoBar /> + </div> + ); +} + +function groupBySite(rows: WorkRow[]): { key: string; title: React.ReactNode; rows: WorkRow[] }[] { + const by = new Map<string, WorkRow[]>(); + for (const r of rows) { + const k = r.site ?? ""; + by.set(k, [...(by.get(k) ?? []), r]); + } + return [...by.entries()] + .sort(([a], [b]) => (a === "" ? 1 : b === "" ? -1 : a.localeCompare(b))) + .map(([key, list]) => ({ + key: key || "projects", + title: key ? ( + <Link href={siteHref(key)} className="normal-case tracking-normal text-text-2 hover:text-text"> + {key} + </Link> + ) : ( + "projects" + ), + rows: list, + })); +} + +function Row({ r }: { r: WorkRow }) { + return ( + <LitLine + id={r.id} + data-piece={r.id} + data-stage={r.bucket} + data-lifecycle={r.lifecycle} + className="grid grid-cols-[minmax(0,1fr)_190px_160px_130px_56px] items-center gap-x-3.5" + > + <div className="flex min-w-0 items-center gap-2"> + <div className="min-w-0 flex-1"> + <Link href={r.href} className="block truncate font-medium text-inherit hover:underline" data-piece-link=""> + {r.title} + </Link> + <small className="block truncate font-mono text-[11px] text-muted-2">{r.id}</small> + </div> + <LitActions className="shrink-0 gap-0"> + {r.lifecycle === "active" ? ( + <> + <LifecycleButton piece={r.id} title={r.title} from="active" to="parked" label="Park" /> + <LifecycleButton piece={r.id} title={r.title} from="active" to="done" label="Mark done" /> + </> + ) : ( + <LifecycleButton piece={r.id} title={r.title} from={r.lifecycle} to="active" label="Reactivate" /> + )} + </LitActions> + </div> + <span className="flex items-center gap-[3px]" title={r.looksDone.join("; ") || undefined}> + {[1, 2, 3, 4].map((i) => ( + <i + key={i} + className={cn("h-1 w-[22px] rounded-[1px]", i < r.step ? "bg-text-2" : i === r.step ? "bg-signal" : "bg-seam-2")} + /> + ))} + <span className="ml-1.5 text-[11.5px]">{r.stageLabel}</span> + </span> + <span className="truncate text-[12px]">{r.kindLabel}</span> + <span className="truncate text-[12px]" data-life={r.lifecycle}> + {r.lifecycle} + {r.lifecycle === "active" && r.looksDone.length > 0 && <span className="text-muted"> · looks done</span>} + </span> + <span className="text-right font-mono text-[12px] text-meter" data-open={r.counts.calls}> + {r.counts.calls || "—"} + </span> + </LitLine> + ); +} + +function Chip({ href, on, label, n }: { href: string; on: boolean; label: string; n?: number }) { + return ( + <Link href={href} aria-current={on ? "true" : undefined} className={badgeVariants({ variant: on ? "on" : "neutral" })}> + {label} + {n !== undefined && <span className="font-mono text-[11px] text-meter">{n}</span>} + </Link> + ); +} diff --git a/umtool/components/dashboard/DecisionsPanel.tsx b/umtool/components/dashboard/DecisionsPanel.tsx @@ -1,51 +0,0 @@ -import Link from "next/link"; -import { badgeVariants, type BadgeVariants } from "@/components/ui/badge"; -import { countBySeverity, type Decision, type Severity } from "@/lib/decisions"; -import Panel from "./Panel"; - -const TONE: Record<Severity, BadgeVariants["variant"]> = { - blocking: "blocking", - open: "open", - info: "info", -}; - -/** Worst first, eight of them, and the count of the rest. */ -export default function DecisionsPanel({ decisions }: { decisions: Decision[] }) { - const counts = countBySeverity(decisions); - const worst = decisions.slice(0, 8); - return ( - <Panel - title="needs a decision" - testid="decisions" - more={{ href: "/browse/decisions", label: `all ${decisions.length} →` }} - > - <div className="mb-1.5 flex gap-1.5" data-decision-totals={`${counts.blocking}/${counts.open}/${counts.info}`}> - <span className={badgeVariants({ variant: "blocking", size: "sm" })}>{counts.blocking} blocking</span> - <span className={badgeVariants({ variant: "open", size: "sm" })}>{counts.open} open</span> - <span className={badgeVariants({ variant: "info", size: "sm" })}>{counts.info} info</span> - </div> - {worst.length === 0 ? ( - <p className="text-[12px] text-[var(--color-dim)]">nothing undecided</p> - ) : ( - <ul className="space-y-0.5"> - {worst.map((d, i) => ( - <li - key={`${d.project}-${d.kind}-${d.target}-${i}`} - data-decision={d.kind} - data-severity={d.severity} - className="flex flex-wrap items-baseline gap-1.5 text-[11px]" - > - <span className={badgeVariants({ variant: TONE[d.severity], size: "sm" })}>{d.severity}</span> - <Link href={d.href} className="font-mono ink-link"> - {d.project} - </Link> - <span className="truncate text-[var(--color-dim)]"> - {d.target} — {d.why} - </span> - </li> - ))} - </ul> - )} - </Panel> - ); -} diff --git a/umtool/components/dashboard/DeliverablesPanel.tsx b/umtool/components/dashboard/DeliverablesPanel.tsx @@ -11,7 +11,7 @@ export default function DeliverablesPanel({ projects }: { projects: ProjectSumma const newest = [...built].sort((a, b) => b.newestMtimeMs - a.newestMtimeMs)[0] ?? null; const stale = projects.filter((p) => p.state === "stale"); return ( - <Panel title="deliverables" testid="deliverables" more={{ href: "/browse?state=built", label: "built →" }}> + <Panel title="deliverables" testid="deliverables" more={{ href: "/projects?state=built", label: "built →" }}> <div className="flex flex-wrap gap-3 text-[11px] text-[var(--color-dim)]" data-deliverables={`${built.length}/${bytes}`}> <span> <b className="num text-[var(--color-text)]">{built.length}</b> built @@ -22,14 +22,14 @@ export default function DeliverablesPanel({ projects }: { projects: ProjectSumma {newest && ( <span> newest{" "} - <Link href={`/browse/${newest.id}`} className="font-mono ink-link"> + <Link href={`/projects/${newest.id}`} className="font-mono ink-link"> {newest.id} </Link>{" "} <span className="num">{fmtAgo(newest.newestMtimeMs)}</span> </span> )} {stale.length > 0 && ( - <Link href="/browse?state=stale" className="text-[var(--color-dirty)] hover:underline" data-stale={stale.length}> + <Link href="/projects?state=stale" className="text-[var(--color-dirty)] hover:underline" data-stale={stale.length}> {stale.length} stale </Link> )} diff --git a/umtool/components/dashboard/InboxList.tsx b/umtool/components/dashboard/InboxList.tsx @@ -169,7 +169,7 @@ function Card({ card: c, muted, onMute }: { card: InboxCard; muted: boolean; onM data-card={c.kind} data-piece={c.piece ?? undefined} data-severity={c.severity} - className="grid grid-cols-[minmax(0,1fr)_64px_auto_auto] items-center gap-x-3.5" + className="grid grid-cols-[minmax(0,1fr)_56px_190px_112px] items-center gap-x-3.5" > <div className="min-w-0"> <b className="block truncate font-medium text-inherit" data-card-title=""> @@ -180,7 +180,7 @@ function Card({ card: c, muted, onMute }: { card: InboxCard; muted: boolean; onM <span className="text-right font-mono text-[12.5px] font-medium text-meter" data-count={c.count}> {c.count} </span> - <span> + <span className="justify-self-end"> {hidden && c.piece ? ( <LifecycleButton piece={c.piece} title={c.title} from={c.lifecycle} to="active" label="Reactivate" variant="outline" size="md" className="lit-go" /> ) : c.finish && c.piece ? ( diff --git a/umtool/components/dashboard/SlashFocus.tsx b/umtool/components/dashboard/SlashFocus.tsx @@ -0,0 +1,23 @@ +"use client"; + +import { useEffect } from "react"; + +// `/` focuses the page's search box (canvas Work: "Find a piece /"), unless +// something is being typed in already. Renders nothing. +export default function SlashFocus({ target }: { target: string }) { + useEffect(() => { + const onKey = (e: KeyboardEvent) => { + if (e.key !== "/" || e.metaKey || e.ctrlKey || e.altKey) return; + const t = e.target as HTMLElement | null; + if (t?.closest?.("input, textarea, select, [contenteditable=''], [contenteditable='true']")) return; + const el = document.querySelector<HTMLInputElement>(target); + if (!el) return; + e.preventDefault(); + el.focus(); + el.select(); + }; + document.addEventListener("keydown", onKey); + return () => document.removeEventListener("keydown", onKey); + }, [target]); + return null; +} diff --git a/umtool/components/dashboard/SourcesPanel.tsx b/umtool/components/dashboard/SourcesPanel.tsx @@ -20,7 +20,7 @@ export default function SourcesPanel({ <ul className="space-y-0.5" data-sources-list={attr}> {items.map((p) => ( <li key={p.id} data-source-project={p.id} className="flex flex-wrap gap-2 text-[11px]"> - <Link href={`/browse/${p.id}`} className="font-mono ink-link"> + <Link href={`/projects/${p.id}`} className="font-mono ink-link"> {p.id} </Link> <span className="text-[var(--color-dim)]"> diff --git a/umtool/components/dashboard/StateStrip.tsx b/umtool/components/dashboard/StateStrip.tsx @@ -19,14 +19,14 @@ const FILL: Record<string, string> = { export default function StateStrip({ rows, note }: { rows: StateRow[]; note: string }) { return ( - <Panel title="projects" testid="projects" more={{ href: "/browse", label: "browse →" }}> + <Panel title="projects" testid="projects" more={{ href: "/projects", label: "every project →" }}> <p className="micro mb-1.5" data-projects-note=""> {note} </p> <div className="space-y-1.5"> {rows.map((r) => ( <div key={r.kind} data-state-row={r.kind} className="flex items-center gap-2 text-[11px]"> - <Link href={`/browse?kind=${encodeURIComponent(r.kind)}`} className="w-24 truncate text-[var(--color-dim)] hover:text-[var(--color-text)]"> + <Link href={`/projects?kind=${encodeURIComponent(r.kind)}`} className="w-24 truncate text-[var(--color-dim)] hover:text-[var(--color-text)]"> {r.label} </Link> <span className="num w-6 text-right text-[var(--color-text)]">{r.total}</span> diff --git a/umtool/components/dashboard/ToolList.tsx b/umtool/components/dashboard/ToolList.tsx @@ -0,0 +1,36 @@ +import Link from "next/link"; +import { LitList } from "@/components/ui/lit-list"; +import { LitGroup, LitLine } from "@/components/ui/lit-line"; + +// A list of places to go, as one lit list: name, one line of what it is, and +// its address. /tools and /tools/song are this. Server-safe. + +/** What each song pile is for, in one line. */ +export const PILE_WHAT: Record<string, string> = { + sort: "Candidate clips never judged", + salvage: "Clips parked as unclean, offered again", + verify: "Accepted clips the risk check flagged, riskiest first", + keeps: "Clips kept on purpose for a stray word, to side", +}; + +export type ToolEntry = { href: string; name: string; what: string; testid: string }; + +export default function ToolList({ groups }: { groups: { title: string; tools: ToolEntry[] }[] }) { + return ( + <LitList label="Tools" global> + {groups.map((g) => ( + <LitGroup key={g.title} title={g.title} count={g.tools.length} className="mt-[18px] first:mt-0"> + {g.tools.map((t) => ( + <LitLine key={t.href} id={t.testid} data-tool-entry={t.testid} className="grid grid-cols-[180px_minmax(0,1fr)_auto] items-baseline gap-x-3.5"> + <Link href={t.href} className="font-medium text-inherit hover:underline"> + {t.name} + </Link> + <span className="truncate text-[12.5px]">{t.what}</span> + <span className="font-mono text-[11px] text-muted-2">{t.href}</span> + </LitLine> + ))} + </LitGroup> + ))} + </LitList> + ); +} diff --git a/umtool/lib/dashboard.ts b/umtool/lib/dashboard.ts @@ -1,10 +1,10 @@ -// Pure helpers the dashboard and /browse share. NO `node:` import: the state +// Pure helpers /settings/system and /projects share. NO `node:` import: the state // strip is rendered on the server but its labels are also what the e2e suite -// compares against /browse's header, and one helper is how the two pages are +// compares against /projects' header, and one helper is how the two pages are // kept from disagreeing by a plural. import { PROJECT_STATES, type ProjectState } from "./project-types"; -/** The header /browse prints and the dashboard's Projects panel repeats. */ +/** The header /projects prints and /settings/system's Projects panel repeats. */ export const projectsNote = (total: number, blocking: number, open: number) => `${total} projects · ${blocking} blocking · ${open} open`; @@ -30,7 +30,7 @@ export function stateRows( segments: PROJECT_STATES.map((state) => ({ state, n: mine.filter((p) => p.state === state).length, - href: `/work?kind=${encodeURIComponent(k.id)}&state=${state}`, + href: `/projects?kind=${encodeURIComponent(k.id)}&state=${state}`, })), }; });