import Link from "next/link"; import { Mark } from "@/components/shell/Wordmark"; import { cn } from "@/lib/utils"; // --------------------------------------------------------------------------- // THE BENCH SHELL (plans/umtool-redesign.md, P4b; canvas "Clip bench"): one // frame for every human-piloted walk -- the clip bench, the claim bench, the // narration script, the takes and the drafts review. // // top ← the piece · what bench this is · where you are ("c04 · 1 of 3") // · ‹ prev / next › · the keys, in one row (canvas `.benchtop`). // It IS the page's head: the mark links home (the rail is // collapsed), the trail is a Breadcrumb nav, `data-app-header=bench`. // work the bench's own working area (its player, its fields) // verdict ONE question, the actions named by what they do, and the // consequence stated before you choose (canvas `.verdictbar`) // reader the source on the reader surface, the cited cue lit, the cite // thread (components/ui/reader-pane.tsx) // // Fits 1366×768: the frame is the viewport, only its columns scroll. Below lg // it is one scrolling column. Below md (a phone) the PAGE is that column: the // frame stops being a scroller and the document scrolls, so a bench can pin // what it is judging (position: sticky needs the viewport as its scroller) and // nothing scrolls inside anything (the phone design brief, rule 1). // // No hooks and no server imports: a client bench (ClipBench) composes // BenchBody itself, so its verdict bar and reader can read its own state; a // server page renders BenchFrame + BenchTop around it. // --------------------------------------------------------------------------- export type BenchLink = { href: string; label: string; attrs?: Record<`data-${string}`, string> }; export type BenchKey = { keys: string[]; label: string }; /** The page: the top bar over the body, the viewport's height. */ export function BenchFrame({ kind, top, children, className, }: { /** `data-bench-shell`: clip, claim, narration, takes, review. */ kind: string; top: React.ReactNode; children: React.ReactNode; className?: string; }) { return (
{top} {children}
); } /** The bench's head (canvas `.benchtop`). */ export function BenchTop({ back, trail = [], kind, here, pos, prev, next, keys = [], note, phone = "shown", slot = false, life = null, }: { /** The piece this bench belongs to: "← ". */ back: BenchLink; /** Crumbs before the piece ("projects"), small. */ trail?: BenchLink[]; /** What bench this is, in words ("Clip bench", "Drafts review"). */ kind: string; /** What is on it: the clip id, "narration". */ here: string; /** Where you are in the walk. */ pos?: { index: number; total: number; of?: string } | null; prev?: BenchLink | null; next?: BenchLink | null; keys?: BenchKey[]; /** The bench's one-line status, the head's last `.micro`. */ note?: React.ReactNode; /** `hidden`: below md the bench draws its own place bar (the clip bench's walk). */ phone?: "shown" | "hidden"; /** * An empty `[data-bench-top-slot]` before the keys, for a client bench to * portal a control into (the clip bench's "Back to the cut"). Hidden while empty. */ slot?: boolean; /** The source's life cycle (lane L5, /ingredients//): a small link beside the bench's kind. */ life?: BenchLink | null; }) { return (
{kind} {life && ( {life.label} )} {pos && ( {pos.index} of {pos.total} {pos.of ? ` ${pos.of}` : ""} )} {(prev !== undefined || next !== undefined) && ( {prev ? ( ‹ {prev.label} ) : ( ‹ first )} {next ? ( {next.label} › ) : ( last › )} )} {slot && } {(keys.length > 0 || note) && ( {keys.length > 0 && ( {keys.map((k) => ( {k.keys.map((key) => ( {key} ))} {k.label} ))} )} {note && {note}} )}
); } /** The body: the work column (its verdict bar at the foot) and the reader on the right. */ export function BenchBody({ verdict, reader, children, workClassName, phoneFlat = false, }: { verdict?: React.ReactNode; reader?: React.ReactNode; children: React.ReactNode; workClassName?: string; /** * Below md, ONE flex column of the bench's leaves: the wrappers between them * and this body are `display: contents`, so the bench orders its pieces for a * phone with `order` and pins one with `sticky` against the whole page (the * clip bench's walk). The desk's boxes are untouched from md up. */ phoneFlat?: boolean; }) { return (
{children}
{verdict}
{reader && (
{reader}
)}
); } /** * The verdict bar (canvas `.verdictbar`): the one question, its consequence in * bold, then the actions -- each named by what it does, the first the screen's * one filled action. */ export function VerdictBar({ question, consequence, children, className, ...props }: Omit, "children"> & { question: React.ReactNode; consequence?: React.ReactNode; children?: React.ReactNode; }) { return (

{question} {consequence && ( <> {" "} {consequence} )}

{children}
); }