commit 429b4a3d23bcf2354b9e6868e7d491b4167f68e5
parent 78ba3ee25717346cf327884a18c30337e6f95e77
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 14 Oct 2026 02:49:02 -0400
umtool: research reader centres the cited cue; the cite thread's ends give way to its label; sites listed by their title; copy only the lit hit's citation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
4 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/umtool/components/research/Reader.tsx b/umtool/components/research/Reader.tsx
@@ -56,6 +56,18 @@ export default function Reader({
const [playing, setPlaying] = useState<LocalMedia | null>(null);
const video = useRef<HTMLVideoElement>(null);
useEffect(() => setPlaying(null), [win?.videoId, win?.at]);
+ // The cited cue in the middle of the window, wherever the window starts.
+ useEffect(() => {
+ const id = requestAnimationFrame(() => {
+ const lit = document.querySelector<HTMLElement>("[data-reader] .reader-cue[data-lit]");
+ const box = lit?.closest<HTMLElement>(".overflow-auto");
+ if (!lit || !box) return;
+ const l = lit.getBoundingClientRect();
+ const b = box.getBoundingClientRect();
+ box.scrollTop += l.top - b.top - b.height / 2 + l.height / 2;
+ });
+ return () => cancelAnimationFrame(id);
+ }, [win?.videoId, win?.at, win?.span]);
if (!win) {
return (
diff --git a/umtool/components/research/ResearchView.tsx b/umtool/components/research/ResearchView.tsx
@@ -283,7 +283,8 @@ export default function ResearchView({
);
const copy = useCallback(async () => {
- if (!win) return;
+ // Only the lit hit's own window: never a citation left from the line before.
+ if (!win || !litHit || win.videoId !== litHit.videoId) return;
try {
await navigator.clipboard.writeText(win.citation.text);
setCopied(true);
@@ -291,7 +292,7 @@ export default function ResearchView({
} catch {
window.prompt("Copy the citation", win.citation.text);
}
- }, [win]);
+ }, [win, litHit]);
// ── fetch clip, through the editor, polled by job ──
const fetchClip = useCallback(async () => {
diff --git a/umtool/components/ui/cite-thread.tsx b/umtool/components/ui/cite-thread.tsx
@@ -38,9 +38,10 @@ export function ReaderThread({ at, duration, className }: { at: number; duration
return (
<div className={cn("cite-thread mt-2.5", className)} role="img" aria-label={`Cited at ${clock(at)} of ${clock(duration)}`} data-cite-at={at}>
<i style={{ left: `${pct}%` }} />
- <span style={{ left: 0 }}>0:00</span>
- <span style={{ left: `calc(${pct}% - 22px)` }}>{clock(at)}</span>
- <span style={{ left: "auto", right: 0 }}>{clock(duration)}</span>
+ {/* The ends give way when the cite's own label would sit on them. */}
+ {pct >= 12 && <span style={{ left: 0 }}>0:00</span>}
+ <span style={{ left: `clamp(0px, calc(${pct}% - 22px), calc(100% - 56px))` }}>{clock(at)}</span>
+ {pct <= 80 && <span style={{ left: "auto", right: 0 }}>{clock(duration)}</span>}
</div>
);
}
diff --git a/umtool/lib/research/sources.ts b/umtool/lib/research/sources.ts
@@ -65,13 +65,13 @@ export async function listSources(): Promise<SourceOption[]> {
const sites: SourceOption[] = [];
for (const id of ids.sort()) {
if (id.startsWith("_") || id.startsWith(".")) continue;
- const site = await readJson<{ siteUrl?: unknown; title?: unknown }>(path.join(/* turbopackIgnore: true */ SITES_DIR, id, "site.json"));
+ const site = await readJson<{ siteUrl?: unknown; siteTitle?: unknown }>(path.join(/* turbopackIgnore: true */ SITES_DIR, id, "site.json"));
const url = typeof site?.siteUrl === "string" ? site.siteUrl.trim().replace(/\/+$/, "") : "";
if (!/^https?:\/\//.test(url)) continue;
sites.push({
handle: `remote:${url}`,
kind: "remote",
- label: typeof site?.title === "string" && site.title ? site.title : id,
+ label: typeof site?.siteTitle === "string" && site.siteTitle ? site.siteTitle : id,
detail: `published · ${url.replace(/^https?:\/\//, "")}`,
});
}