Archilyzer · Source

archilyzer

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

commit 8529adbcc7b27f48f7c0757420ce1303d88d0a8d
parent 877943cfd384009de059f20845ce5eded4852c20
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Thu, 22 Oct 2026 10:09:04 -0400

fact-check editor: stamp scale, motion, opacity and each verdict's stamp label

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

Diffstat:
Mumtool/app/api/report/timeline/route.ts | 3+++
Mumtool/components/projects/StructureEditors.tsx | 50++++++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/umtool/app/api/report/timeline/route.ts b/umtool/app/api/report/timeline/route.ts @@ -17,6 +17,7 @@ import { import { resolveReport } from "@/lib/report/serve.mjs"; import { deckOn } from "umtool-report-to-video/deck"; import { VERDICTS, resolveFactcheck } from "umtool-report-to-video/factcheck"; +import { STAMP_KNOB_DEFAULTS, STAMP_KNOB_LIMITS, STAMP_MOTIONS } from "@/lib/report/knobs.mjs"; import { refuseCaller } from "@/lib/report/caller"; export const dynamic = "force-dynamic"; @@ -67,6 +68,8 @@ export async function GET(request: Request) { deckOn: deckOn(render), factcheck: (render.chrome as { factcheck?: unknown } | undefined)?.factcheck ?? null, factcheckResolved: resolveFactcheck(render), + // The stamp's knobs (video knobs): their defaults, bounds and motions, the form's placeholders. + stampKnobs: { defaults: STAMP_KNOB_DEFAULTS, limits: STAMP_KNOB_LIMITS, motions: STAMP_MOTIONS }, verdicts: VERDICTS, generatedBy: r.manifest.generatedBy ?? null, token: await manifestToken(r.project.dir), diff --git a/umtool/components/projects/StructureEditors.tsx b/umtool/components/projects/StructureEditors.tsx @@ -15,7 +15,7 @@ import { DraftAlternatives, DraftBadge, useDrafts, type DraftAct, type DraftsVie type Teaser = { at: number; id: string; lines: unknown[]; beat: number | null; dip: { fade: number; black: number } | null; tail: string | null; tailWait: number | null }; type Post = Record<string, unknown> & { id: string }; -type Verdict = { label: string; color: string }; +type Verdict = { label: string; color: string; stampLabel?: string }; type Doc = { teasers: Teaser[]; posts: Post[]; @@ -23,6 +23,8 @@ type Doc = { factcheck: { verdicts?: Record<string, Partial<Verdict>>; stamp?: Record<string, unknown>; tally?: Record<string, unknown> } | null; factcheckResolved: { verdicts: Record<string, Verdict>; stamp: { show: boolean; seconds: number; position: string }; tally: { show: boolean; position: string } }; verdicts: string[]; + /** The stamp's knobs (video knobs): defaults, bounds, the motions. */ + stampKnobs?: { defaults: { scale: number; motion: string; opacity: number }; limits: { scale: number[]; opacity: number[] }; motions: string[] }; token: string | null; }; @@ -258,9 +260,16 @@ function PostRow({ post, fresh = false, busy, save, remove }: { post: Post; fres function FactcheckEditor({ doc, busy, save }: { doc: Doc; busy: boolean; save: (f: Record<string, unknown> | null) => Promise<boolean> }) { const given = doc.factcheck ?? {}; - const [v, setV] = useState<Record<string, { label: string; color: string }>>(() => - Object.fromEntries(doc.verdicts.map((k) => [k, { label: String(given.verdicts?.[k]?.label ?? ""), color: String(given.verdicts?.[k]?.color ?? "") }])), + const [v, setV] = useState<Record<string, { label: string; color: string; stampLabel: string }>>(() => + Object.fromEntries( + doc.verdicts.map((k) => [k, { label: String(given.verdicts?.[k]?.label ?? ""), color: String(given.verdicts?.[k]?.color ?? ""), stampLabel: String(given.verdicts?.[k]?.stampLabel ?? "") }]), + ), ); + // The stamp's knobs (video knobs): its size, how it comes in, how solid it is. Blank = the default. + const sk = doc.stampKnobs; + const [scale, setScale] = useState(given.stamp?.scale == null ? "" : String(given.stamp.scale)); + const [motion, setMotion] = useState(given.stamp?.motion == null ? "" : String(given.stamp.motion)); + const [opacity, setOpacity] = useState(given.stamp?.opacity == null ? "" : String(given.stamp.opacity)); const [seconds, setSeconds] = useState(given.stamp?.seconds == null ? "" : String(given.stamp.seconds)); // `stamp.show`: off draws no stamp over the footage; the tally still counts. const [stampOn, setStampOn] = useState(given.stamp?.show !== false); @@ -270,6 +279,7 @@ function FactcheckEditor({ doc, busy, save }: { doc: Doc; busy: boolean; save: ( const one: Record<string, string> = {}; if (o.label.trim()) one.label = o.label.trim(); if (o.color.trim()) one.color = o.color.trim(); + if (o.stampLabel.trim()) one.stampLabel = o.stampLabel.trim(); if (Object.keys(one).length) verdicts[k] = one; } // Only what differs from the defaults is written, as the deck's settings are. @@ -281,6 +291,12 @@ function FactcheckEditor({ doc, busy, save }: { doc: Doc; busy: boolean; save: ( else delete stamp.seconds; if (stampOn) delete stamp.show; else stamp.show = false; + for (const [k, raw] of [["scale", scale], ["opacity", opacity]] as const) { + if (raw.trim()) stamp[k] = Number.isFinite(Number(raw)) ? Number(raw) : raw; + else delete stamp[k]; + } + if (motion) stamp.motion = motion; + else delete stamp.motion; if (Object.keys(stamp).length) out.stamp = stamp; else delete out.stamp; void save(Object.keys(out).length ? out : null); @@ -288,7 +304,7 @@ function FactcheckEditor({ doc, busy, save }: { doc: Doc; busy: boolean; save: ( return ( <div data-testid="factcheck-editor" className="space-y-1 rounded border border-[var(--color-line)] p-2 text-[11px]"> <div className="micro">fact-check labels</div> - <div className="grid grid-cols-[max-content_1fr_max-content] items-center gap-x-2 gap-y-1"> + <div className="grid grid-cols-[max-content_1fr_max-content_max-content] items-center gap-x-2 gap-y-1"> {doc.verdicts.map((k) => { const def = doc.factcheckResolved.verdicts[k]; return ( @@ -299,6 +315,15 @@ function FactcheckEditor({ doc, busy, save }: { doc: Doc; busy: boolean; save: ( <input data-testid={`fc-color-${k}`} placeholder={def?.color} value={v[k]?.color ?? ""} onChange={(e) => setV((x) => ({ ...x, [k]: { ...x[k], color: e.target.value } }))} className={`${input} w-20 font-mono`} /> <span className="inline-block h-3 w-3 rounded" style={{ background: v[k]?.color || def?.color }} /> </span> + <input + data-testid={`fc-stamp-label-${k}`} + title="the stamp's word for this verdict (singular, e.g. SEIZURE); blank: the label" + placeholder={v[k]?.label || def?.label} + maxLength={24} + value={v[k]?.stampLabel ?? ""} + onChange={(e) => setV((x) => ({ ...x, [k]: { ...x[k], stampLabel: e.target.value } }))} + className={`${input} w-28`} + /> </div> ); })} @@ -308,6 +333,23 @@ function FactcheckEditor({ doc, busy, save }: { doc: Doc; busy: boolean; save: ( <input type="checkbox" data-testid="fc-stamp-show" checked={stampOn} onChange={(e) => setStampOn(e.target.checked)} /> stamp effect </label> <label>stamp seconds <input value={seconds} placeholder={String(doc.factcheckResolved.stamp.seconds)} disabled={!stampOn} onChange={(e) => setSeconds(e.target.value)} className={`${input} w-14`} /></label> + <label title={sk ? `${sk.limits.scale[0]}–${sk.limits.scale[1]}` : undefined}> + scale <input data-testid="fc-stamp-scale" value={scale} placeholder={String(sk?.defaults.scale ?? 1)} disabled={!stampOn} onChange={(e) => setScale(e.target.value)} className={`${input} w-12`} /> + </label> + <label> + motion{" "} + <select data-testid="fc-stamp-motion" value={motion} disabled={!stampOn} onChange={(e) => setMotion(e.target.value)} className={input}> + <option value="">{sk?.defaults.motion ?? "slam"} (default)</option> + {(sk?.motions ?? []).map((m) => ( + <option key={m} value={m}> + {m} + </option> + ))} + </select> + </label> + <label title={sk ? `${sk.limits.opacity[0]}–${sk.limits.opacity[1]}` : undefined}> + opacity <input data-testid="fc-stamp-opacity" value={opacity} placeholder={String(sk?.defaults.opacity ?? 1)} disabled={!stampOn} onChange={(e) => setOpacity(e.target.value)} className={`${input} w-12`} /> + </label> <button type="button" data-testid="fc-save" disabled={busy} onClick={submit} className={buttonVariants({ variant: "outline", size: "sm" })}> Save labels </button>