Archilyzer · Source

archilyzer

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

commit d87ea613d3ce012e57f4602df7c62aad41496ee7
parent 762161e6ae08824133b3e8f205f722c828b63cf3
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 14 Oct 2026 00:45:11 -0400

umtool: decisions as a lit list; benches collapse the rail; a source's words on the reader; canvases paint the roles

/browse/decisions is the first real LitList: one line per decision,
grouped by project, j/k from anywhere, severity said the verdict way.
The clip, claim and takes benches render AppShell with the rail collapsed
and a compact head. The clip bench's transcript pane and the claim
bench's context and as-recorded quote move onto the reader surface.
The waveform, the mix lanes and the pitch rail read the role tokens
(components/ui/use-palette.ts) and repaint on a theme switch; the face
deck's overlays use the dark roles over the photo.

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

Diffstat:
Mumtool/app/browse/decisions/page.tsx | 147+++++++++++++++++++++++++++++++++++++++++--------------------------------------
Mumtool/components/FaceDeck.tsx | 13++++++++-----
Mumtool/components/MixLanes.tsx | 41++++++++++++++++++++++-------------------
Mumtool/components/PitchRail.tsx | 23+++++++++++++----------
Mumtool/components/Waveform.tsx | 29++++++++++++++++-------------
Mumtool/components/projects/ClaimBench.tsx | 19++++++++++---------
Mumtool/components/projects/ClaimBenchPage.tsx | 12++++++++----
Mumtool/components/projects/ClipBench.tsx | 35+++++++++++++++--------------------
Mumtool/components/projects/ClipBenchPage.tsx | 12++++++++----
Mumtool/components/projects/TakesPage.tsx | 12++++++++----
Aumtool/components/ui/use-palette.ts | 91+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
11 files changed, 275 insertions(+), 159 deletions(-)

diff --git a/umtool/app/browse/decisions/page.tsx b/umtool/app/browse/decisions/page.tsx @@ -11,6 +11,11 @@ import { } from "@/lib/decisions"; import { openDecisions } from "@/lib/projects"; import { fmtAgo } from "@/lib/format"; +import { decisionsHref } from "@/lib/hrefs"; +import { LitList } from "@/components/ui/lit-list"; +import { LitGroup, LitLine } from "@/components/ui/lit-line"; +import { Toolbar, ToolbarGroup } from "@/components/ui/toolbar"; +import { EmptyState } from "@/components/ui/empty-state"; export const dynamic = "force-dynamic"; @@ -20,12 +25,15 @@ export const dynamic = "force-dynamic"; // because when this regresses the page still renders perfectly in isolation and // only the URL stops working. // -// Zero client JS. The filters are links that change searchParams; nothing here -// changes without a navigation, and the list is short by construction. +// The filters are links that change searchParams; nothing here changes +// without a navigation. The list is the page's one LIT LIST (components/ui/ +// lit-list.tsx): one line per decision, grouped by project, `j`/`k` from +// anywhere on the page -- the shape the Inbox takes in P3. -// The three severities ARE three badge variants, one for one. That is not a -// coincidence to be tidied away: the palette reserves its hues for verdicts, -// and a severity is the closest thing this list has to one. +// The three severities ARE three badge variants, one for one, on the filter +// chips. That is not a coincidence to be tidied away: the palette reserves its +// hues for verdicts, and a severity is the closest thing this list has to one. +// On a line it is said the verdict way, glyph and word (Severity below). const TONE: Record<Severity, BadgeVariants["variant"]> = { blocking: "blocking", open: "open", @@ -57,13 +65,8 @@ export default async function DecisionsPage({ else byProject.set(d.project, [d]); } - const q = (next: Partial<{ severity: string; kind: string; project: string }>) => { - const p = new URLSearchParams(); - const merged = { severity, kind, project, ...next }; - for (const [k, v] of Object.entries(merged)) if (v) p.set(k, v); - const s = p.toString(); - return `/browse/decisions${s ? `?${s}` : ""}`; - }; + const q = (next: Partial<{ severity: string; kind: string; project: string }>) => + decisionsHref({ severity, kind, project, ...next }); return ( <div className="flex h-full flex-col"> @@ -73,9 +76,8 @@ export default async function DecisionsPage({ note={`${openCount(all)} waiting · ${all.length - openCount(all)} for information`} /> - <main className="deck-main flex-1 p-4"> - <div className="mb-3 flex flex-wrap items-center gap-1.5"> - <span className="micro">severity</span> + <Toolbar aria-label="Filters"> + <ToolbarGroup label="Severity"> <Chip href={q({ severity: "" })} on={!severity} label={`all ${all.length}`} /> {SEVERITIES.map((s) => ( <Chip @@ -86,88 +88,91 @@ export default async function DecisionsPage({ tone={TONE[s]} /> ))} - - <span className="micro ml-3">project</span> - <Chip href={q({ project: "" })} on={!project} label="all" /> - {projects.map((p) => ( - <Chip key={p} href={q({ project: p })} on={project === p} label={p} /> - ))} - - <div className="ml-auto"> - <CopyButton - label="copy the whole picture" - title="every project as markdown — including this list" - url="/api/browse/context" - /> - </div> + </ToolbarGroup> + <div className="ml-auto"> + <CopyButton + label="copy the whole picture" + title="every project as markdown — including this list" + url="/api/browse/context" + /> </div> - - <div className="mb-3 flex flex-wrap items-center gap-1.5"> - <span className="micro">kind</span> + <ToolbarGroup label="Kind" className="basis-full"> <Chip href={q({ kind: "" })} on={!kind} label="all" /> {kinds.map((k) => ( <Chip key={k} href={q({ kind: k })} on={kind === k} label={k} /> ))} - </div> + </ToolbarGroup> + <ToolbarGroup label="Project" className="basis-full"> + <Chip href={q({ project: "" })} on={!project} label="all" /> + {projects.map((p) => ( + <Chip key={p} href={q({ project: p })} on={project === p} label={p} /> + ))} + </ToolbarGroup> + </Toolbar> + <main className="deck-main flex-1 p-4"> {items.length === 0 ? ( - <p className="text-[12px] text-[var(--color-dim)]"> + <EmptyState + title={all.length === 0 ? "Nothing undecided" : "Nothing matches that filter"} + > {all.length === 0 - ? "Nothing undecided. Every cut ships, every live variant is judged, every recipe still describes its file." - : "Nothing matches that filter."} - </p> + ? "Every cut ships, every live variant is judged, every recipe still describes its file." + : null} + </EmptyState> ) : ( - <div className="space-y-4"> + <LitList label="Decisions" global> {[...byProject.entries()].map(([id, list]) => ( - <section key={id} data-project={id}> - <h2 className="mb-1.5 flex items-baseline gap-2"> + <LitGroup + key={id} + data-project={id} + title={ <Link // An article's notes are listed under its page's path // (lib/decisions.ts noteDecisions), not a project's. href={id.startsWith("sites/") ? `/${id}` : `/browse/${id}`} - className="font-mono text-[13px] text-[var(--color-text)] hover:text-[var(--color-sel)]" + className="font-mono text-[13px] normal-case tracking-normal text-text hover:underline" > {id} </Link> - <span className="micro"> - {list.filter((d) => d.severity !== "info").length} waiting of {list.length} - </span> - </h2> - <ul className="space-y-1"> - {list.map((d, i) => ( - <li - key={`${d.kind}-${d.target}-${i}`} - data-decision={d.kind} - data-severity={d.severity} - data-target={d.target} - className="flex flex-wrap items-baseline gap-2 rounded border border-[var(--color-line)] bg-[var(--color-panel)] px-3 py-1.5" - > - <span className={badgeVariants({ variant: TONE[d.severity], size: "sm" })}> - {d.severity} - </span> - <Link - href={d.href} - className="font-mono text-[12px] text-[var(--color-sel)] hover:underline" - > + } + count={list.filter((d) => d.severity !== "info").length} + note={`waiting of ${list.length}`} + > + {list.map((d, i) => ( + <LitLine + key={`${d.kind}-${d.target}-${i}`} + id={`${d.project}:${d.kind}:${d.target}`} + data-decision={d.kind} + data-severity={d.severity} + data-target={d.target} + className="grid grid-cols-[86px_minmax(0,1fr)_auto_auto] items-baseline gap-x-3.5" + > + <Severity s={d.severity} /> + <span className="min-w-0 truncate"> + <Link href={d.href} className="font-mono text-[12px] text-inherit underline-offset-2 hover:underline"> {d.target} </Link> - <span className="text-[12px] text-[var(--color-dim)]">{d.why}</span> - <span className="micro ml-auto">{d.kind}</span> - <span className="num text-[11px] text-[var(--color-dim)]"> - {fmtAgo(d.at)} - </span> - </li> - ))} - </ul> - </section> + <span className="ml-2 text-[12.5px]">{d.why}</span> + </span> + <span className="font-mono text-[11px] text-muted-2">{d.kind}</span> + <span className="num text-[11px] text-muted-2">{fmtAgo(d.at)}</span> + </LitLine> + ))} + </LitGroup> ))} - </div> + </LitList> )} </main> </div> ); } +/** A severity the verdict way: glyph and word, the glyph in the colour. */ +function Severity({ s }: { s: Severity }) { + if (s === "info") return <span className="verdict text-muted">· info</span>; + return <span className="verdict" data-verdict={s === "blocking" ? "reject" : "doubt"}>{s}</span>; +} + function Chip({ href, on, diff --git a/umtool/components/FaceDeck.tsx b/umtool/components/FaceDeck.tsx @@ -242,15 +242,18 @@ export default function FaceDeck({ ctx.restore(); }; - if (det?.face) stroke(det.face, "rgba(132,150,168,0.75)", [4, 4], 2); + // Drawn over a photo, not the desk, so these are the dark roles as + // constants whatever the theme: muted (the detector), doubt (the CLI's + // automatic crop), meter (the guess), Signal (the chosen crop). + if (det?.face) stroke(det.face, "rgba(154,143,126,0.75)", [4, 4], 2); // WHAT THE CLI WOULD DO, always drawn, so the diff between the automatic // crop and the chosen one is visible rather than remembered. - if (det?.auto) stroke(det.auto, "rgba(210,153,34,0.85)", [10, 6], 3); - if (guess) stroke(guess, "rgba(86,212,196,0.9)", [2, 6], 3); + if (det?.auto) stroke(det.auto, "rgba(239,154,42,0.85)", [10, 6], 3); + if (guess) stroke(guess, "rgba(185,162,236,0.9)", [2, 6], 3); if (crop) { - stroke(crop, "#58a6ff", [], 4); + stroke(crop, "#3fc1b0", [], 4); ctx.save(); - ctx.fillStyle = "#58a6ff"; + ctx.fillStyle = "#3fc1b0"; for (const [hx, hy] of [ [crop.x, crop.y], [crop.x + crop.w, crop.y], diff --git a/umtool/components/MixLanes.tsx b/umtool/components/MixLanes.tsx @@ -1,6 +1,7 @@ "use client"; import { useCallback, useEffect, useRef, useState } from "react"; +import { alpha, usePalette } from "@/components/ui/use-palette"; export type Analysis = { label: string; @@ -57,6 +58,8 @@ export default function MixLanes({ height = 210, }: Props) { const ref = useRef<HTMLCanvasElement | null>(null); + // The roles as colours, repainting on a theme switch (components/ui/use-palette.ts). + const pal = usePalette(); const [width, setWidth] = useState(900); const drag = useRef<Marker | null>(null); @@ -90,7 +93,7 @@ export default function MixLanes({ { a: body, top: laneH, title: body ? `song · ${body.label}` : "song — none loaded", isBg: false }, ]; - g.fillStyle = "#1e2732"; // panel-2: this is a well + g.fillStyle = pal["panel-2"]; // panel-2: this is a well g.fillRect(0, 0, width, height); for (const { a, top, title, isBg } of lanes) { @@ -100,7 +103,7 @@ export default function MixLanes({ g.rect(0, top, width, laneH); g.clip(); - g.fillStyle = "#161c24"; + g.fillStyle = pal.panel; g.fillRect(0, top, width, laneH); if (a && a.peak.length) { @@ -113,14 +116,14 @@ export default function MixLanes({ const p = a.peak[i]; const h = Math.min(laneH / 2 - 2, p * (laneH / 2 - 2) * 1.6); const audible = !isBg || t < handover + fade; - g.fillStyle = audible ? "#4a5d72" : "#28323e"; + g.fillStyle = audible ? pal["muted-2"] : pal["seam-2"]; g.fillRect(x, mid - h, 1, Math.max(1, h * 2)); } } - // The measurement curve, and the only teal in the drawing. + // The measurement curve, and the only Meter in the drawing. if (a && isBg && a.ratio.length) { - g.strokeStyle = "#56d4c4"; + g.strokeStyle = pal.meter; g.lineWidth = 1.5; g.beginPath(); let started = false; @@ -141,7 +144,7 @@ export default function MixLanes({ for (const s of a.steps) { const x = toX(s.at); if (x < -6 || x > width + 6) continue; - g.fillStyle = "rgba(86,212,196,0.85)"; + g.fillStyle = alpha(pal.meter, 0.85); g.beginPath(); g.moveTo(x, top + 2); g.lineTo(x - 4, top + 9); @@ -156,7 +159,7 @@ export default function MixLanes({ const x = toX(a.firstSound); if (x > -2 && x < width + 2) { g.setLineDash([2, 3]); - g.strokeStyle = "rgba(86,212,196,0.7)"; + g.strokeStyle = alpha(pal.meter, 0.7); g.lineWidth = 1; g.beginPath(); g.moveTo(x, top); @@ -168,10 +171,10 @@ export default function MixLanes({ g.restore(); - g.fillStyle = "#8496a8"; + g.fillStyle = pal.muted; g.font = "10px ui-monospace, monospace"; g.fillText(title.toUpperCase(), 6, top + 12); - g.strokeStyle = "#2c3743"; + g.strokeStyle = pal.seam; g.lineWidth = 1; g.beginPath(); g.moveTo(0, top + laneH + 0.5); @@ -180,21 +183,21 @@ export default function MixLanes({ } // Outside [start, end] is not in the output at all. - g.fillStyle = "rgba(11,14,18,0.62)"; + g.fillStyle = alpha(pal.ground, 0.62); const sx = toX(start); const ex = toX(end); if (sx > 0) g.fillRect(0, 0, sx, height - AXIS); if (ex < width) g.fillRect(ex, 0, width - ex, height - AXIS); // -- the axis ------------------------------------------------------------- - g.fillStyle = "#161c24"; + g.fillStyle = pal.panel; g.fillRect(0, height - AXIS, width, AXIS); - g.fillStyle = "#8496a8"; + g.fillStyle = pal.muted; g.font = "10px ui-monospace, monospace"; const step = span > 120 ? 30 : span > 60 ? 10 : span > 20 ? 5 : span > 6 ? 1 : 0.5; for (let t = Math.ceil(view.from / step) * step; t <= view.to; t += step) { const x = toX(t); - g.strokeStyle = "#2c3743"; + g.strokeStyle = pal.seam; g.beginPath(); g.moveTo(x, height - AXIS); g.lineTo(x, height - AXIS + 4); @@ -219,22 +222,22 @@ export default function MixLanes({ const w = g.measureText(label).width; g.fillText(label, Math.min(width - w - 3, Math.max(3, x + 7)), 20); }; - line(start, "#58a6ff", "start", false); - line(end, "#58a6ff", "end", false); + line(start, pal.signal, "start", false); + line(end, pal.signal, "end", false); // The ramp itself, so a fade is a shape rather than a number in a box. if (fade > 0.0005) { const a = toX(handover); const b = toX(handover + fade); - g.fillStyle = "rgba(86,212,196,0.16)"; + g.fillStyle = alpha(pal.meter, 0.16); g.fillRect(a, 0, Math.max(1, b - a), height - AXIS); } - line(handover, "#56d4c4", `handover ${handover.toFixed(3)}s`, true); + line(handover, pal.meter, `handover ${handover.toFixed(3)}s`, true); if (playhead != null && playhead >= view.from && playhead <= view.to) { - g.fillStyle = "#e7edf4"; + g.fillStyle = pal.text; g.fillRect(toX(playhead), 0, 1, height - AXIS); } - }, [width, height, bg, body, view, handover, fade, start, end, playhead, toX, toT]); + }, [width, height, bg, body, view, handover, fade, start, end, playhead, toX, toT, pal]); const pick = (x: number): Marker | null => { const near: [Marker, number][] = [ diff --git a/umtool/components/PitchRail.tsx b/umtool/components/PitchRail.tsx @@ -1,6 +1,7 @@ "use client"; import { useEffect, useRef, useState } from "react"; +import { alpha, usePalette } from "@/components/ui/use-palette"; export type CorpusPitch = { lo: number; @@ -37,6 +38,8 @@ type Props = { // a verdict, which is why none of the three verdict hues appear here. export default function PitchRail({ corpus, f0, sourceF0s, flat = false }: Props) { const ref = useRef<HTMLCanvasElement | null>(null); + // The roles as colours, repainting on a theme switch (components/ui/use-palette.ts). + const pal = usePalette(); const [size, setSize] = useState({ w: 64, h: 320 }); useEffect(() => { @@ -71,11 +74,11 @@ export default function PitchRail({ corpus, f0, sourceF0s, flat = false }: Props const ribbonFrom = LABEL; const ribbonTo = flat ? h : w; - g.fillStyle = "#161c24"; + g.fillStyle = pal.panel; g.fillRect(0, 0, w, h); // -- the region above the gate, shaded ------------------------------------ - g.fillStyle = "rgba(210,153,34,0.07)"; + g.fillStyle = alpha(pal.doubt, 0.08); if (flat) { const x = pos(corpus.gate); g.fillRect(x, 0, w - x, h); @@ -85,7 +88,7 @@ export default function PitchRail({ corpus, f0, sourceF0s, flat = false }: Props // -- the corpus, as a density ribbon -------------------------------------- const peak = Math.max(1, corpus.peak); - g.fillStyle = "rgba(86,212,196,0.30)"; + g.fillStyle = alpha(pal.meter, 0.32); for (let i = 0; i < corpus.bins.length; i += 1) { const c = corpus.bins[i]; if (!c) continue; @@ -105,7 +108,7 @@ export default function PitchRail({ corpus, f0, sourceF0s, flat = false }: Props } // -- this source's own clips, faint marks behind the needle --------------- - g.fillStyle = "rgba(231,237,244,0.42)"; + g.fillStyle = alpha(pal.text, 0.42); for (const s of sourceF0s) { if (s < corpus.lo || s > corpus.hi) continue; const p = pos(s); @@ -134,15 +137,15 @@ export default function PitchRail({ corpus, f0, sourceF0s, flat = false }: Props if (flat) g.fillText(label, Math.min(w - 22, p + 2), 9); else g.fillText(label, 2, Math.max(8, Math.min(h - 2, p + 3))); }; - tick(corpus.median, "#8496a8", String(Math.round(corpus.median)), false); - tick(corpus.p95, "#8496a8", String(Math.round(corpus.p95)), false); - tick(corpus.gate, "#d29922", String(corpus.gate), true); + tick(corpus.median, pal.muted, String(Math.round(corpus.median)), false); + tick(corpus.p95, pal.muted, String(Math.round(corpus.p95)), false); + tick(corpus.gate, pal.doubt, String(corpus.gate), true); // -- this clip, as a bright needle ---------------------------------------- if (f0 > 0) { const clamped = Math.max(corpus.lo, Math.min(corpus.hi, f0)); const p = pos(clamped); - g.fillStyle = "#56d4c4"; + g.fillStyle = pal.meter; if (flat) { g.fillRect(p - 1, 0, 2, h); g.beginPath(); @@ -162,12 +165,12 @@ export default function PitchRail({ corpus, f0, sourceF0s, flat = false }: Props } // Off the end of the scale is itself the finding, so say so. if (f0 > corpus.hi || f0 < corpus.lo) { - g.fillStyle = "#f85149"; + g.fillStyle = pal.reject; g.font = "9px ui-monospace, monospace"; g.fillText("off scale", flat ? Math.max(2, p - 20) : 2, flat ? h - 12 : Math.max(9, p - 5)); } } - }, [corpus, f0, sourceF0s, size, flat]); + }, [corpus, f0, sourceF0s, size, flat, pal]); return ( <div className={flat ? "h-12 w-full" : "h-full w-16"}> diff --git a/umtool/components/Waveform.tsx b/umtool/components/Waveform.tsx @@ -1,6 +1,7 @@ "use client"; import { useCallback, useEffect, useRef, useState } from "react"; +import { alpha, usePalette } from "@/components/ui/use-palette"; import type { AsrWord } from "@/lib/types"; export type Peaks = { from: number; to: number; min: number[]; max: number[] }; @@ -49,6 +50,8 @@ export default function Waveform({ height = 168, }: Props) { const ref = useRef<HTMLCanvasElement | null>(null); + // The roles as colours, repainting on a theme switch (components/ui/use-palette.ts). + const pal = usePalette(); const [width, setWidth] = useState(900); const drag = useRef<"start" | "end" | null>(null); const edgeFired = useRef(false); @@ -78,7 +81,7 @@ export default function Waveform({ g.clearRect(0, 0, width, height); // ground - g.fillStyle = "#0f141a"; + g.fillStyle = pal.ground; g.fillRect(0, 0, width, height); const mid = height / 2; @@ -86,7 +89,7 @@ export default function Waveform({ // outside the selection is dimmed, so the selection reads without a border const sx = toX(sel.from); const ex = toX(sel.to); - g.fillStyle = "#131b24"; + g.fillStyle = pal.panel; g.fillRect(Math.max(0, sx), 0, Math.max(0, ex - sx), height); // waveform @@ -100,7 +103,7 @@ export default function Waveform({ const x = toX(t0); if (x < -2 || x > width + 2) continue; const inSel = t0 >= sel.from && t0 <= sel.to; - g.fillStyle = inSel ? "#e7edf4" : "#3d4b5a"; + g.fillStyle = inSel ? pal.text : pal["seam-2"]; const hi = peaks.max[i]; const lo = peaks.min[i]; const y0 = mid - hi * (mid - 6); @@ -108,7 +111,7 @@ export default function Waveform({ g.fillRect(x, Math.min(y0, y1), Math.max(1, width / n), Math.max(1, Math.abs(y1 - y0))); } } else { - g.fillStyle = "#26313d"; + g.fillStyle = pal.seam; g.fillRect(0, mid - 1, width, 2); } @@ -118,16 +121,16 @@ export default function Waveform({ if (w.end < view.from || w.start > view.to) continue; const a = toX(w.start); const b = toX(w.end); - g.fillStyle = "rgba(88,166,255,0.10)"; + g.fillStyle = alpha(pal.signal, 0.1); g.fillRect(a, height - 22, Math.max(1, b - a), 22); - g.fillStyle = "#6f8296"; + g.fillStyle = pal.muted; g.fillText(w.w, a + 3, height - 7); } // Whisper's own detection, as a dashed reference -- the window may be well // outside it, and that is the point. g.setLineDash([3, 3]); - g.strokeStyle = "#4a5a6b"; + g.strokeStyle = pal["muted-2"]; g.lineWidth = 1; g.beginPath(); g.moveTo(toX(cand.from), 0); @@ -144,8 +147,8 @@ export default function Waveform({ const a = toX(c.from); const b = toX(c.to); if (b < -2 || a > width + 2) continue; - const colour = c.verdict === 1 ? "#3fb950" : c.verdict === 0 ? "#f85149" : "#d29922"; - g.fillStyle = `${colour}22`; + const colour = c.verdict === 1 ? pal.kept : c.verdict === 0 ? pal.reject : pal.doubt; + g.fillStyle = alpha(colour, 0.13); g.fillRect(a, 0, Math.max(1, b - a), height); g.fillStyle = colour; g.fillRect(a, 0, Math.max(1, b - a), 3); @@ -157,8 +160,8 @@ export default function Waveform({ // handles for (const [x, colour] of [ - [sx, "#58a6ff"], - [ex, "#58a6ff"], + [sx, pal.signal], + [ex, pal.signal], ] as const) { g.fillStyle = colour; g.fillRect(x - 1, 0, 2, height); @@ -167,10 +170,10 @@ export default function Waveform({ } if (playhead != null && playhead >= view.from && playhead <= view.to) { - g.fillStyle = "#f0f6fc"; + g.fillStyle = pal.text; g.fillRect(toX(playhead), 0, 1, height); } - }, [width, height, peaks, sel, cand, words, view, toX, playhead, captured]); + }, [width, height, peaks, sel, cand, words, view, toX, playhead, captured, pal]); const pick = (x: number): "start" | "end" => { const ds = Math.abs(x - toX(sel.from)); diff --git a/umtool/components/projects/ClaimBench.tsx b/umtool/components/projects/ClaimBench.tsx @@ -280,8 +280,8 @@ export default function ClaimBench({ data }: { data: ClaimBenchData }) { className={ "cursor-pointer " + (c.cited - ? "bg-[var(--color-sel)]/25 text-[var(--color-fg)]" - : "text-[var(--color-dim)] hover:text-[var(--color-fg)]") + ? "bg-[color-mix(in_srgb,var(--reader-signal)_14%,transparent)] text-reader-ink" + : "text-reader-2 hover:text-reader-ink") } > {c.text}{" "} @@ -337,30 +337,31 @@ export default function ClaimBench({ data }: { data: ClaimBenchData }) { </div> )} - <div className="rounded border border-[var(--color-line)] p-3"> + {/* The source's words, on the READER (app/globals.css). */} + <div className="reader rounded-[2px] px-4 py-3"> <div className="micro mb-2"> ±{data.pad}s of context · {hms(view.from)}–{hms(view.to)} {at != null ? ` · cited at ${hms(at)}` : ""} </div> {data.noCues ? ( - <div className="text-[12px] text-[var(--color-dim)]"> + <div className="text-[12px] text-reader-dim"> no transcript.cues.json for {claim.channel}/{claim.video} — on Rumble, check the directory is the URL slug and not the site id </div> ) : ( <p data-testid="claim-context" - className="max-h-[320px] overflow-y-auto text-[12px] leading-relaxed" + className="max-h-[320px] overflow-y-auto font-serif text-[15px] leading-relaxed" > {paragraph} </p> )} </div> - <div className="rounded border border-[var(--color-line)] p-3 text-[12px]"> + <div className="reader rounded-[2px] px-4 py-3 text-[12px]"> <div className="micro mb-1">as recorded</div> - <div className="text-[var(--color-fg)]">“{claim.quote}”</div> - <div className="mt-1 text-[11px] text-[var(--color-dim)]"> + <div className="font-serif text-[16px] leading-snug text-reader-ink">“{claim.quote}”</div> + <div className="mt-1 font-mono text-[11px] text-reader-dim"> {claim.label} · {claim.src} </div> </div> @@ -368,7 +369,7 @@ export default function ClaimBench({ data }: { data: ClaimBenchData }) { <div className="space-y-3 text-[12px]"> {data.gaps.length ? ( - <div className="rounded border border-[var(--color-warn,#E8A33F)] p-2 text-[11px] text-[var(--color-dim)]"> + <div className="rounded border border-doubt-text p-2 text-[11px] text-doubt-text"> unadjudicated — missing {data.gaps.join(", ")} </div> ) : ( diff --git a/umtool/components/projects/ClaimBenchPage.tsx b/umtool/components/projects/ClaimBenchPage.tsx @@ -1,5 +1,6 @@ import { notFound } from "next/navigation"; -import BrowseHeader from "@/components/BrowseHeader"; +import AppShell from "@/components/shell/AppShell"; +import { browseHref, projectHref } from "@/lib/hrefs"; import ClaimBench, { type ClaimBenchData } from "./ClaimBench"; import { manifestToken } from "@/lib/report/manifest.mjs"; import { readClaimDetail, readManifest } from "@/lib/projects/report.mjs"; @@ -85,10 +86,13 @@ export default async function ClaimBenchPage({ return ( <div className="flex h-full flex-col"> - <BrowseHeader + {/* A bench: the rail collapses and the work takes the width. */} + <AppShell + active="browse" + rail="collapsed" crumbs={[ - { href: "/browse", label: "projects" }, - { href: `/browse/${project.id}`, label: project.name }, + { href: browseHref(), label: "projects" }, + { href: projectHref(project.id), label: project.name }, { label: claimId }, ]} note={`claim ${i + 1} of ${ledger.length} · ${outstanding} unadjudicated`} diff --git a/umtool/components/projects/ClipBench.tsx b/umtool/components/projects/ClipBench.tsx @@ -2437,7 +2437,8 @@ export default function ClipBench({ data }: { data: ClipBenchData }) { <div data-transcript="" ref={transcriptBox} - className="relative flex h-48 min-h-0 flex-col overflow-y-auto rounded border border-[var(--color-line)] bg-[var(--color-panel-2)] lg:h-auto lg:flex-[2_1_0%]" + // On the READER: these are the source's words (app/globals.css). + className="reader relative flex h-48 min-h-0 flex-col overflow-y-auto rounded-[2px] lg:h-auto lg:flex-[2_1_0%]" > <ul> {railCues.map((c, i) => { @@ -2457,7 +2458,7 @@ export default function ClipBench({ data }: { data: ClipBenchData }) { {rule && ( <div data-cache-rule={outside ? "end" : "start"} - className="flex items-center gap-2 border-t border-dashed border-[var(--color-meter)] px-2 py-0.5 text-[10px] uppercase tracking-wider text-[var(--color-meter)]" + className="flex items-center gap-2 border-t border-dashed border-reader-2 px-2 py-0.5 text-[10px] uppercase tracking-wider text-reader-dim" > {outside ? "not fetched — reading only" : "cached from here"} </div> @@ -2479,36 +2480,32 @@ export default function ClipBench({ data }: { data: ClipBenchData }) { } void play(c.start, Math.min(c.end + 4, view.to)); }} - className={`flex w-full gap-2 px-2 py-1 text-left hover:bg-[color-mix(in_srgb,var(--color-sel)_10%,transparent)] ${ - inSel ? "bg-[color-mix(in_srgb,var(--color-sel)_14%,transparent)]" : "" - } ${playing ? "border-l-2 border-[var(--color-meter)]" : "border-l-2 border-transparent"}`} + className={`flex w-full items-baseline gap-3 px-2.5 py-[3px] text-left hover:bg-[color-mix(in_srgb,var(--reader-signal)_6%,transparent)] ${ + inSel ? "bg-[color-mix(in_srgb,var(--reader-signal)_11%,transparent)]" : "" + } ${playing ? "border-l-[3px] border-reader-signal" : "border-l-[3px] border-transparent"}`} > <span - className={`num w-10 shrink-0 font-mono text-[10px] ${ - playing ? "text-[var(--color-meter)]" : "text-[var(--color-dim)]" + className={`num w-10 shrink-0 font-mono text-[10.5px] ${ + playing ? "font-semibold text-reader-signal" : "text-reader-dim" }`} > {clock(c.start)} </span> <span - className={`min-w-0 text-[12px] leading-snug ${ - outside - ? "text-[var(--color-dim)] opacity-70" - : playing - ? "text-[var(--color-text)]" - : "text-[var(--color-text)]" + className={`min-w-0 font-serif text-[15px] leading-snug ${ + outside ? "text-reader-dim opacity-70" : inSel || playing ? "text-reader-ink" : "text-reader-2" }`} > {owner && ( <span - className="mr-1.5 rounded border border-[var(--color-sel)] px-1 text-[10px] text-[var(--color-sel)]" + className="mr-1.5 rounded-[2px] border border-reader-2 px-1 font-mono text-[10px] text-reader-ink" title={`already in the cut as ${owner.id} (${owner.where})`} > {owner.id} </span> )} {c.endsSentence && ( - <span className="mr-1 text-[var(--color-meter)]" aria-hidden> + <span className="mr-1 font-mono text-[11px] text-reader-dim" aria-hidden> ¶ </span> )} @@ -2525,17 +2522,15 @@ export default function ClipBench({ data }: { data: ClipBenchData }) { bottom of its scrollport: they cost the pane a line and the left column nothing, and "peek further" ends up beside the dimmed lines it widens. Opaque, because it sits over text. */} - <div className="micro sticky bottom-0 z-10 flex flex-wrap items-center gap-2 border-t border-[var(--color-line)] bg-[var(--color-panel-2)] px-2 py-0.5"> + <div className="micro sticky bottom-0 z-10 flex flex-wrap items-center gap-2 border-t border-reader-seam bg-reader px-2.5 py-1"> <span>click a line to play it</span> {peek.length > 0 && ( <> - <span className="text-[var(--color-dim)]"> - · dimmed lines are not fetched — click to fetch - </span> + <span>· dimmed lines are not fetched — click to fetch</span> <button type="button" data-peek-further="" - className="ml-auto text-[var(--color-sel)] hover:underline" + className="ml-auto text-reader-signal hover:underline" onClick={() => setPeekPad((n) => n + PEEK_STEP)} > peek further (±{peekPad + PEEK_STEP} s) diff --git a/umtool/components/projects/ClipBenchPage.tsx b/umtool/components/projects/ClipBenchPage.tsx @@ -1,5 +1,6 @@ import { notFound } from "next/navigation"; -import BrowseHeader from "@/components/BrowseHeader"; +import AppShell from "@/components/shell/AppShell"; +import { browseHref, projectHref } from "@/lib/hrefs"; import ClipBench, { type ClipBenchData } from "./ClipBench"; import { manifestToken } from "@/lib/report/manifest.mjs"; import { @@ -165,10 +166,13 @@ export default async function ClipBenchPage({ return ( <div className="flex h-full flex-col"> - <BrowseHeader + {/* A bench: the rail collapses and the work takes the width. */} + <AppShell + active="browse" + rail="collapsed" crumbs={[ - { href: "/browse", label: "projects" }, - { href: `/browse/${project.id}`, label: project.name }, + { href: browseHref(), label: "projects" }, + { href: projectHref(project.id), label: project.name }, { label: clipId }, ]} // The progress reading moved INTO the bench, where pressing `y` can diff --git a/umtool/components/projects/TakesPage.tsx b/umtool/components/projects/TakesPage.tsx @@ -1,5 +1,6 @@ import Link from "next/link"; -import BrowseHeader from "@/components/BrowseHeader"; +import AppShell from "@/components/shell/AppShell"; +import { browseHref, projectHref } from "@/lib/hrefs"; import { listTakes, readVerdicts } from "@/lib/report/takes.mjs"; import type { ProjectRef } from "@/lib/project-types"; import TakesBench, { type Take, type TakeVerdict } from "./TakesBench"; @@ -17,10 +18,13 @@ export default async function TakesPage({ project }: { project: ProjectRef }) { return ( <div className="flex h-full flex-col"> - <BrowseHeader + {/* A bench: the rail collapses and the work takes the width. */} + <AppShell + active="browse" + rail="collapsed" crumbs={[ - { href: "/browse", label: "projects" }, - { href: `/browse/${project.id}`, label: project.id }, + { href: browseHref(), label: "projects" }, + { href: projectHref(project.id), label: project.id }, { label: "takes" }, ]} note={takes.length ? `${takes.length} takes · ${judged} judged` : undefined} diff --git a/umtool/components/ui/use-palette.ts b/umtool/components/ui/use-palette.ts @@ -0,0 +1,91 @@ +"use client"; + +import { useSyncExternalStore } from "react"; + +// The role tokens (app/globals.css) as hex strings, for what CSS cannot reach: +// a <canvas> (the waveform, the mix lanes, the pitch rail) paints with +// fillStyle, which takes a colour, not var(--panel). +// +// It follows the theme: an explicit choice (data-theme on <html>, set by the +// rail's control) and the system's preference both re-read it, so a canvas that +// lists the palette in its draw effect's deps repaints on the switch. Values +// are read from the computed style -- the stylesheet stays the one source -- +// and the server, and hydration, see the dark base (a canvas paints only in an +// effect, after it). +export const ROLES = [ + "ground", + "panel", + "panel-2", + "seam", + "seam-2", + "text", + "text-2", + "muted", + "muted-2", + "signal", + "meter", + "kept", + "doubt", + "reject", +] as const; +export type Role = (typeof ROLES)[number]; +export type Palette = Record<Role, string>; + +// The dark base, as app/globals.css declares it. +const DARK: Palette = { + ground: "#0c0a08", + panel: "#17140f", + "panel-2": "#201b15", + seam: "#2b251d", + "seam-2": "#3d3429", + text: "#ece4d6", + "text-2": "#c9bfae", + muted: "#9a8f7e", + "muted-2": "#8a8070", + signal: "#3fc1b0", + meter: "#b9a2ec", + kept: "#c6e283", + doubt: "#ef9a2a", + reject: "#de4c3c", +}; + +let cacheKey = ""; +let cache: Palette = DARK; + +function read(): Palette { + const root = document.documentElement; + const key = `${root.dataset.theme ?? ""}|${matchMedia("(prefers-color-scheme: light)").matches}`; + if (key === cacheKey) return cache; + const cs = getComputedStyle(root); + const next = { ...DARK }; + for (const r of ROLES) { + const v = cs.getPropertyValue(`--${r}`).trim(); + if (v) next[r] = v; + } + cacheKey = key; + cache = next; + return cache; +} + +function subscribe(onChange: () => void) { + const mo = new MutationObserver(onChange); + mo.observe(document.documentElement, { attributes: true, attributeFilter: ["data-theme"] }); + const mq = matchMedia("(prefers-color-scheme: light)"); + mq.addEventListener("change", onChange); + return () => { + mo.disconnect(); + mq.removeEventListener("change", onChange); + }; +} + +export function usePalette(): Palette { + return useSyncExternalStore(subscribe, read, () => DARK); +} + +/** `#rrggbb` at an alpha, for a canvas: alpha("#3fc1b0", 0.1). */ +export function alpha(hex: string, a: number): string { + const h = hex.replace("#", ""); + const full = h.length === 3 ? h.split("").map((c) => c + c).join("") : h.slice(0, 6); + const n = parseInt(full, 16); + return `rgba(${(n >> 16) & 255},${(n >> 8) & 255},${n & 255},${a})`; +}