commit 78e3e37b154959f510213f0ed698b2f0256f7f58
parent dd42bcadb399d0bd8979c7581fb5370728edb95c
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 14 Oct 2026 12:44:15 -0400
umtool: the series page's panels one width, its statuses as tags; Edit cadence opens on its first field and closes back to its button; recurring.spec's keys and screenshots (R5)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
4 files changed, 54 insertions(+), 23 deletions(-)
diff --git a/umtool/app/series/[id]/page.tsx b/umtool/app/series/[id]/page.tsx
@@ -106,7 +106,7 @@ export default async function SeriesPage({ params }: { params: Promise<{ id: str
/>
<main className="deck-main flex flex-1 flex-col gap-4 px-4 pb-6 pt-3">
{v.running && !v.running.jobId.startsWith("pending-") && <TickProgress jobId={v.running.jobId} />}
- <Panel title="Editions" aside={<span className="text-muted">newest first</span>} data-series-editions="">
+ <Panel title="Editions" aside={<span className="text-muted">newest first</span>} className="w-full max-w-[1100px]" data-series-editions="">
{editions.length === 0 ? (
<p className="m-0 text-[12.5px] text-muted" data-series-empty="">
No edition yet. The first tick is {v.nextWords ?? "not planned (paused)"}.
@@ -119,7 +119,7 @@ export default async function SeriesPage({ params }: { params: Promise<{ id: str
</ol>
)}
</Panel>
- <Panel title="Ticks" aside={<span className="text-muted">{ticks.length} recorded</span>} data-series-ticks="">
+ <Panel title="Ticks" aside={<span className="text-muted">{ticks.length} recorded</span>} className="w-full max-w-[1100px]" data-series-ticks="">
{ticks.length === 0 ? (
<p className="m-0 text-[12.5px] text-muted">Nothing has ticked yet.</p>
) : (
@@ -170,7 +170,7 @@ function EditionRow({ e }: { e: Edition }) {
<span className="font-mono text-[11.5px] text-text-2" data-edition-window={`${e.window.from}/${e.window.to}`}>
{e.window.from} … {e.window.to}
</span>
- <span className={badgeVariants({ variant: EDITION_TONE[e.status] ?? "neutral", size: "sm" })}>{e.status}</span>
+ <span className={cn(badgeVariants({ variant: EDITION_TONE[e.status] ?? "neutral", size: "sm" }), "w-fit justify-self-start")}>{e.status}</span>
<span className="text-right font-mono text-[12px] text-meter">{e.usd ? usd(e.usd) : "$0"}</span>
</li>
);
@@ -196,7 +196,7 @@ function TickRow({ t }: { t: Tick }) {
function Scope({ v }: { v: ScheduleView }) {
return (
- <Panel title="What it asks" data-series-scope="">
+ <Panel title="What it asks" className="w-full max-w-[1100px]" data-series-scope="">
<dl className="m-0 grid grid-cols-[120px_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-[12.5px]">
<dt className="text-muted">Question</dt>
<dd className="m-0">{v.question}</dd>
@@ -215,8 +215,8 @@ function Scope({ v }: { v: ScheduleView }) {
{v.cadenceWords} <span className="text-muted">({v.tz})</span>
</dd>
<dt className="text-muted">Model · cap</dt>
- <dd className="m-0 font-mono text-[12px]">
- {v.model ?? "the policy's"} · {v.caps?.maxUsd ? `${usd(v.caps.maxUsd)} a tick` : "the policy's sweep cap"}
+ <dd className="m-0">
+ {v.model ? <span className="font-mono text-[12px]">{v.model}</span> : "the policy's sweep model"} · {v.caps?.maxUsd ? `up to ${usd(v.caps.maxUsd)} a tick` : "up to the policy's sweep cap a tick"}
</dd>
</dl>
</Panel>
diff --git a/umtool/components/series/CadenceFields.tsx b/umtool/components/series/CadenceFields.tsx
@@ -13,13 +13,14 @@ const DAYS = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
export const DEFAULT_CADENCE: Cadence = { kind: "weekly", dow: 1, at: "06:00" };
-export default function CadenceFields({ value, onChange, disabled }: { value: Cadence; onChange: (c: Cadence) => void; disabled?: boolean }) {
+export default function CadenceFields({ value, onChange, disabled, autoFocus }: { value: Cadence; onChange: (c: Cadence) => void; disabled?: boolean; autoFocus?: boolean }) {
const at = value.at;
return (
<div className="flex flex-wrap items-end gap-x-3 gap-y-2" data-cadence-fields={value.kind}>
<Field label="Cadence">
<Select
aria-label="cadence"
+ autoFocus={autoFocus}
value={value.kind}
disabled={disabled}
onChange={(e) => {
diff --git a/umtool/components/series/ScheduleControls.tsx b/umtool/components/series/ScheduleControls.tsx
@@ -14,9 +14,9 @@ import CadenceFields from "./CadenceFields";
// through POST /api/schedules (umtool never writes a schedule itself). The
// page re-reads after each.
//
-// compact the piece head's (a living report's article): Pause/Resume and
-// Tick now beside the chip; Edit cadence and Delete are in the ⋯
-// menu (`part`)
+// part "all" on a series' page; on a living report's article the head
+// has "head" (Pause/Resume, Tick now, beside the chip) and the ⋯
+// menu "menu" (Edit cadence, Delete)
//
// Delete is plan-then-confirm (the DeletePlan pattern): the trigger asks the
// editor for the plan (what goes, what stays, what refuses), the plan takes
@@ -45,6 +45,12 @@ export default function ScheduleControls({ schedule, part = "all" }: { schedule:
const [cadence, setCadence] = useState<Cadence>(schedule.cadence);
const [plan, setPlan] = useState<{ removes: string; keeps: string[]; refused: string | null } | null>(null);
const deleteRef = useRef<HTMLButtonElement>(null);
+ const editRef = useRef<HTMLButtonElement>(null);
+ // Closing the cadence form puts the focus back on its button.
+ const closeEdit = () => {
+ setEditing(false);
+ requestAnimationFrame(() => editRef.current?.focus());
+ };
const confirmRef = useRef<HTMLButtonElement>(null);
const opened = useRef(false);
useEffect(() => {
@@ -102,7 +108,7 @@ export default function ScheduleControls({ schedule, part = "all" }: { schedule:
{menu && (
<>
{!editing ? (
- <Button size="sm" variant={part === "menu" ? "quiet" : "outline"} disabled={!hydrated || busy !== null} data-schedule-edit="" onClick={() => setEditing(true)}>
+ <Button ref={editRef} size="sm" variant={part === "menu" ? "quiet" : "outline"} disabled={!hydrated || busy !== null} data-schedule-edit="" onClick={() => setEditing(true)}>
Edit cadence
</Button>
) : (
@@ -112,19 +118,19 @@ export default function ScheduleControls({ schedule, part = "all" }: { schedule:
onKeyDown={(e) => {
if (e.key === "Escape") {
e.preventDefault();
- setEditing(false);
+ closeEdit();
}
}}
onSubmit={(e) => {
e.preventDefault();
- void act("cadence", { action: "update", cadence }, () => setEditing(false));
+ void act("cadence", { action: "update", cadence }, closeEdit);
}}
>
- <CadenceFields value={cadence} onChange={setCadence} disabled={busy !== null} />
+ <CadenceFields value={cadence} onChange={setCadence} disabled={busy !== null} autoFocus />
<Button type="submit" size="sm" variant="go" disabled={busy !== null}>
Save cadence
</Button>
- <Button type="button" size="sm" variant="quiet" onClick={() => setEditing(false)}>
+ <Button type="button" size="sm" variant="quiet" onClick={closeEdit}>
Cancel
</Button>
</form>
diff --git a/umtool/e2e/recurring.spec.ts b/umtool/e2e/recurring.spec.ts
@@ -41,22 +41,22 @@ function clean() {
async function shoot(page: Page, name: string) {
if (!SHOTS) return;
mkdirSync(SHOTS, { recursive: true });
- const url = page.url();
+ // No reload (a form keeps what was typed): the theme is the attribute the
+ // server stamps from the cookie, set here in place.
+ const was = await page.evaluate(() => document.documentElement.getAttribute("data-theme"));
for (const theme of ["dark", "light"] as const) {
- await page.context().addCookies([{ name: "umtool-theme", value: theme, url }]);
+ await page.evaluate((t) => document.documentElement.setAttribute("data-theme", t), theme);
for (const [w, h] of [
[1366, 768],
[1440, 900],
] as const) {
await page.setViewportSize({ width: w, height: h });
- await page.goto(url);
- await page.waitForLoadState("networkidle").catch(() => {});
+ await page.waitForTimeout(150);
await page.screenshot({ path: path.join(SHOTS, `${name}-${w}x${h}-${theme}.png`) });
}
}
- await page.context().clearCookies({ name: "umtool-theme" });
+ await page.evaluate((t) => (t ? document.documentElement.setAttribute("data-theme", t) : document.documentElement.removeAttribute("data-theme")), was);
await page.setViewportSize({ width: 1280, height: 720 });
- await page.goto(url);
}
async function api(page: Page, body: Record<string, unknown>) {
@@ -125,8 +125,8 @@ test("the series page: Tick now makes an edition, a second the same day is quiet
// Newest first, each with its window; the quiet one's starts where the first ended.
await expect(page.locator("[data-edition]")).toHaveCount(2);
await expect(page.locator("[data-edition]").first()).toHaveAttribute("data-edition", "2");
- const w1 = (await done.getAttribute("data-edition-window"))!.split("/");
- await expect(quiet).toHaveAttribute("data-edition-window", `${w1[1]}/${w1[1]}`);
+ const w1 = (await done.locator("[data-edition-window]").getAttribute("data-edition-window"))!.split("/");
+ await expect(quiet.locator("[data-edition-window]")).toHaveAttribute("data-edition-window", `${w1[1]}/${w1[1]}`);
const ticks = page.getByRole("table", { name: "ticks" });
await expect(ticks.locator("tbody tr")).toHaveCount(2);
await expect(ticks.locator("tbody tr").first()).toHaveAttribute("data-tick-status", "quiet");
@@ -148,6 +148,30 @@ test("the series page: Tick now makes an edition, a second the same day is quiet
expect(stubAsked("report-schedule").map((r) => r.action)).toEqual(expect.arrayContaining(["tick-now", "pause", "resume", "update"]));
});
+test("keys: the head's controls in Tab order; Edit cadence opens on its first field, Escape returns to it; the delete plan opens on its confirm", async ({ page }) => {
+ await page.goto(urls.seriesHref("r5-cohost"));
+ const pause = page.getByRole("button", { name: "Pause schedule" });
+ await expect(pause).toBeEnabled();
+ await pause.focus();
+ for (const name of ["Tick now", "Edit cadence", "Delete schedule"]) {
+ await page.keyboard.press("Tab");
+ await expect(page.getByRole("button", { name })).toBeFocused();
+ }
+ await page.keyboard.press("Shift+Tab");
+ await page.keyboard.press("Enter");
+ const edit = page.getByRole("form", { name: "edit cadence" });
+ await expect(edit.getByRole("combobox", { name: "cadence" })).toBeFocused();
+ await page.keyboard.press("Escape");
+ await expect(edit).toHaveCount(0);
+ await expect(page.getByRole("button", { name: "Edit cadence" })).toBeFocused();
+ await page.keyboard.press("Tab");
+ await page.keyboard.press("Enter");
+ const plan = page.getByRole("region", { name: "delete schedule r5-cohost" });
+ await expect(plan.getByRole("button", { name: "Confirm delete" })).toBeFocused();
+ await page.keyboard.press("Escape");
+ await expect(page.getByRole("button", { name: "Delete schedule" })).toBeFocused();
+});
+
test("Work: one row per series, with its chip, under the recurring facet; its editions are not rows", async ({ page }) => {
await page.goto(urls.workHref({ recurring: "1" }));
const row = page.locator("[data-lit-line][data-piece='s:r5-cohost']");