commit 3e74942b1d9020a214b93f059793f8c26f72ab13
parent 6e178040801fb0b5771a591960b2eff5667e2f61
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sat, 24 Oct 2026 01:59:03 -0400
Merge lane/umtool-mobile: Undo for Mark done / Park; /work row actions behind ⋯
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
5 files changed, 156 insertions(+), 28 deletions(-)
diff --git a/umtool/app/series/[id]/page.tsx b/umtool/app/series/[id]/page.tsx
@@ -1,5 +1,6 @@
import Link from "next/link";
import { redirect } from "next/navigation";
+import { UndoBar } from "@/components/piece/Lifecycle";
import LifecycleChip from "@/components/piece/LifecycleChip";
import LearnedSpellings from "@/components/series/LearnedSpellings";
import ScheduleControls from "@/components/series/ScheduleControls";
@@ -222,6 +223,8 @@ export default async function SeriesPage({ params }: { params: Promise<{ id: str
</Panel>
<Scope v={v} />
</main>
+ {/* The lifecycle chip's way back (Park, Mark done), as on a piece page. */}
+ <UndoBar />
</div>
);
}
diff --git a/umtool/app/work/page.tsx b/umtool/app/work/page.tsx
@@ -1,5 +1,6 @@
import Link from "next/link";
import { UndoBar, LifecycleButton } from "@/components/piece/Lifecycle";
+import Menu from "@/components/piece/Menu";
import SlashFocus from "@/components/shell/SlashFocus";
import AppShell from "@/components/shell/AppShell";
import { badgeVariants } from "@/components/ui/badge";
@@ -29,8 +30,14 @@ export const dynamic = "force-dynamic";
// shows as a chip you can take off.
//
// The facets are links that change searchParams and the search is a GET form,
-// so any view is one pasteable URL. The rows' lifecycle buttons are the only
+// so any view is one pasteable URL. The rows' lifecycle menus are the only
// client JS beyond the lit list.
+//
+// A row's Park / Mark done sit behind its own ⋯ menu, never on the line: a
+// lit line's actions are clickable before they are drawn, and on a phone the
+// buttons landed on the stage pips, so a tap on the row marked a piece done.
+// Below md the row is the piece and its stage only (Kind, Lifecycle and Open
+// are facets above), so the title keeps its column.
// ---------------------------------------------------------------------------
type Search = { [K in keyof WorkQuery]?: string };
@@ -187,12 +194,12 @@ export default async function WorkPage({ searchParams }: { searchParams: Promise
<EmptyState title={all.length === 0 ? "No pieces: no articles and no projects" : "Nothing matches that filter"} />
) : (
<>
- <div className="grid grid-cols-[minmax(0,1fr)_190px_160px_130px_56px] gap-x-3.5 pb-1.5 pl-5 pr-3 pt-2">
+ <div className={cn(COLS, "gap-x-3.5 pb-1.5 pl-5 pr-3 pt-2")}>
<span className="micro">Piece</span>
<span className="micro">Stage</span>
- <span className="micro">Kind</span>
- <span className="micro">Lifecycle</span>
- <span className="micro text-right">Open</span>
+ <span className="micro max-md:hidden">Kind</span>
+ <span className="micro max-md:hidden">Lifecycle</span>
+ <span className="micro text-right max-md:hidden">Open</span>
</div>
<LitList label="Pieces" global>
{groups.map((g) =>
@@ -237,6 +244,9 @@ function groupBySite(rows: WorkRow[]): { key: string; title: React.ReactNode; ro
}));
}
+/** The list's columns; below md, the piece and its stage only. */
+const COLS = "grid grid-cols-[minmax(0,1fr)_190px_160px_130px_56px] max-md:grid-cols-[minmax(0,1fr)_auto]";
+
function Row({ r }: { r: WorkRow }) {
return (
<LitLine
@@ -248,7 +258,7 @@ function Row({ r }: { r: WorkRow }) {
data-audience={r.audience ?? undefined}
data-open-notes={r.counts.notes}
data-recurring={r.recurring ? "" : undefined}
- className="grid grid-cols-[minmax(0,1fr)_190px_160px_130px_56px] items-center gap-x-3.5"
+ className={cn(COLS, "items-center gap-x-3.5")}
>
<div className="flex min-w-0 items-center gap-2">
<div className="min-w-0 flex-1">
@@ -265,17 +275,24 @@ function Row({ r }: { r: WorkRow }) {
</small>
</div>
<LitActions className="shrink-0 gap-0">
- {r.lifecycle === "active" ? (
- <>
- <LifecycleButton piece={r.id} title={r.title} from="active" to="parked" label="Park" />
- <LifecycleButton piece={r.id} title={r.title} from="active" to="done" label="Mark done" />
- </>
- ) : (
- <LifecycleButton piece={r.id} title={r.title} from={r.lifecycle} to="active" label="Reactivate" />
- )}
+ <Menu
+ data-work-lifecycle={r.id}
+ label={`Lifecycle: ${LIFE_LABEL[r.lifecycle]}`}
+ trigger={<span aria-hidden="true">⋯</span>}
+ triggerClassName={buttonVariants({ variant: "quiet", size: "sm" })}
+ >
+ {r.lifecycle === "active" ? (
+ <>
+ <LifecycleButton piece={r.id} title={r.title} from="active" to="parked" label="Park" variant="quiet" size="md" className="justify-start" />
+ <LifecycleButton piece={r.id} title={r.title} from="active" to="done" label="Mark done" variant="quiet" size="md" className="justify-start" />
+ </>
+ ) : (
+ <LifecycleButton piece={r.id} title={r.title} from={r.lifecycle} to="active" label="Reactivate" variant="quiet" size="md" className="justify-start" />
+ )}
+ </Menu>
</LitActions>
</div>
- <span className="flex items-center gap-[3px]" title={r.looksDone.join("; ") || undefined}>
+ <span className="flex items-center gap-[3px]" data-work-stage="" title={r.looksDone.join("; ") || undefined}>
{Array.from({ length: r.steps }, (_, k) => k + 1).map((i) => (
<i
key={i}
@@ -284,12 +301,12 @@ function Row({ r }: { r: WorkRow }) {
))}
<span className="ml-1.5 text-[11.5px]">{r.stageLabel}</span>
</span>
- <span className="truncate text-[12px]">{r.kindLabel}</span>
- <span className="truncate text-[12px]" data-life={r.lifecycle}>
+ <span className="truncate text-[12px] max-md:hidden">{r.kindLabel}</span>
+ <span className="truncate text-[12px] max-md:hidden" data-life={r.lifecycle}>
{r.lifecycle}
{r.lifecycle === "active" && r.looksDone.length > 0 && <span className="text-muted"> · looks done</span>}
</span>
- <span className="text-right font-mono text-[12px] text-meter" data-open={r.counts.calls}>
+ <span className="text-right font-mono text-[12px] text-meter max-md:hidden" data-open={r.counts.calls}>
{r.counts.calls || "—"}
</span>
</LitLine>
diff --git a/umtool/components/piece/Lifecycle.tsx b/umtool/components/piece/Lifecycle.tsx
@@ -10,7 +10,9 @@ import { cn } from "@/lib/utils";
// A piece's lifecycle and its mutes, from a list: Park, Mark done, Reactivate
// (POST /api/pieces/lifecycle), Mute / Unmute one kind of call on it
// (POST /api/pieces/mute). Reversible, so no plan-then-confirm: the page's
-// <UndoBar> offers the way back for a few seconds instead.
+// <UndoBar> offers the way back for ten seconds instead, and says plainly what
+// the change did ("Marked done — hidden from Active"), because a piece that
+// leaves Active leaves every list that shows Active too.
//
// A button says what it did by an event the bar hears (`umtool:lifecycle`),
// because the line it sat on is gone after the refresh -- a parked piece's
@@ -19,10 +21,14 @@ import { cn } from "@/lib/utils";
export type LifecycleState = "active" | "parked" | "done";
/** What was done, and the POST that takes it back. */
-type Change = { piece: string; title: string; word: string; undo: { url: string; body: Record<string, unknown> } };
+type Change = { piece: string; title: string; word: string; note?: string; undo: { url: string; body: Record<string, unknown> } };
const EVENT = "umtool:lifecycle";
const DONE_WORD: Record<LifecycleState, string> = { active: "Reactivated", parked: "Parked", done: "Marked done" };
+/** What the change means for the lists, after the word. */
+const DONE_NOTE: Record<LifecycleState, string> = { active: "back in Active", parked: "hidden from Active", done: "hidden from Active" };
+/** How long the bar offers Undo. */
+const UNDO_MS = 10_000;
const LIFECYCLE = "/api/pieces/lifecycle";
const MUTE = "/api/pieces/mute";
@@ -83,7 +89,7 @@ export function LifecycleButton({
setError(err);
return;
}
- const detail: Change = { piece, title, word: DONE_WORD[to], undo: { url: LIFECYCLE, body: { piece, state: from } } };
+ const detail: Change = { piece, title, word: DONE_WORD[to], note: DONE_NOTE[to], undo: { url: LIFECYCLE, body: { piece, state: from } } };
window.dispatchEvent(new CustomEvent<Change>(EVENT, { detail }));
router.refresh();
}}
@@ -158,7 +164,7 @@ export function MuteButton({
);
}
-/** "Parked Quartering diet · Undo", for eight seconds after a change. */
+/** "Marked done — hidden from Active. Quartering diet · Undo", for ten seconds after a change. */
export function UndoBar() {
const router = useRouter();
const [last, setLast] = useState<Change | null>(null);
@@ -174,7 +180,7 @@ export function UndoBar() {
}, []);
useEffect(() => {
if (!last || busy) return;
- const t = setTimeout(() => setLast(null), 8000);
+ const t = setTimeout(() => setLast(null), UNDO_MS);
return () => clearTimeout(t);
}, [last, busy]);
if (!last) return null;
@@ -182,10 +188,14 @@ export function UndoBar() {
<div
role="status"
data-undo={last.piece}
- className="fixed bottom-4 left-1/2 z-30 flex -translate-x-1/2 items-center gap-3 rounded-[3px] border border-seam-2 bg-panel-2 px-3.5 py-2 text-[12.5px] text-text shadow-lg"
+ className="fixed bottom-4 left-1/2 z-30 flex w-max max-w-[calc(100vw-2rem)] -translate-x-1/2 flex-wrap items-center gap-x-3 gap-y-1.5 rounded-[3px] border border-seam-2 bg-panel-2 px-3.5 py-2 text-[12.5px] text-text shadow-lg"
>
- <span>
- {last.word} <b className="font-medium">{last.title}</b>
+ <span className="min-w-0">
+ <span data-undo-word="">
+ {last.word}
+ {last.note ? ` — ${last.note}.` : ""}
+ </span>{" "}
+ <b className="font-medium">{last.title}</b>
</span>
<button
type="button"
diff --git a/umtool/e2e/piece.spec.ts b/umtool/e2e/piece.spec.ts
@@ -142,6 +142,28 @@ test("the lifecycle chip: Park, then Reactivate, each a round trip through the s
}
});
+test("the lifecycle chip: Mark done says it hid the piece from Active, and Undo puts it back", async ({ page, request }) => {
+ const life = async () =>
+ ((await (await request.get("/api/pieces")).json()) as { pieces: { id: string; lifecycle: string }[] }).pieces.find((p) => p.id === PIECE)
+ ?.lifecycle;
+ try {
+ await page.goto(urls.projectHref(PROJECT));
+ const chip = page.locator("[data-lifecycle-chip]");
+ await chip.getByRole("button", { name: "Lifecycle: Active" }).click();
+ await chip.getByRole("button", { name: "Mark done" }).click();
+ await expect(page.locator("[data-lifecycle-chip]")).toHaveAttribute("data-lifecycle-chip", "done");
+ const bar = page.locator(`[data-undo="${PIECE}"]`);
+ await expect(bar).toContainText("Marked done — hidden from Active.");
+ expect(await life()).toBe("done");
+ await bar.getByRole("button", { name: "Undo" }).click();
+ await expect(bar).toHaveCount(0);
+ await expect(page.locator("[data-lifecycle-chip]")).toHaveAttribute("data-lifecycle-chip", "active");
+ expect(await life()).toBe("active");
+ } finally {
+ await request.post("/api/pieces/lifecycle", { data: { piece: PIECE, state: "active" } });
+ }
+});
+
test("keys: 1–7 open the tabs, n runs the Next card's action; typing in a field is left alone", async ({ page }) => {
await page.goto(urls.projectHref(PROJECT));
await keysReady(page);
diff --git a/umtool/e2e/work.spec.ts b/umtool/e2e/work.spec.ts
@@ -8,7 +8,12 @@ import { warm, WARM_TIMEOUT } from "./warm";
// the old /browse, /articles and /sites keys still filtering.
//
// WRITES the fixture's REPORTS_ROOT/.umtool/lifecycle.json (a project parked,
-// then active again).
+// marked done, then active again).
+//
+// A row's Park / Mark done are behind its own ⋯ menu (data-work-lifecycle),
+// never on the line: on a phone the line's buttons were drawn over the stage
+// pips and a tap on the row marked a piece done. The phone block below holds
+// that, at 390×844 with touch.
// ---------------------------------------------------------------------------
type Piece = { id: string; kind: string; lifecycle: string; title: string };
@@ -91,8 +96,9 @@ test("Park takes a piece out of the active list, Parked lists it, Reactivate bri
const line = page.locator(`${rows}[data-piece='${REPORT}']`);
await expect(page.locator("[data-lit-list]").first()).toHaveAttribute("data-hydrated", "");
await line.click();
+ await line.getByRole("button", { name: "Lifecycle: Active" }).click();
await line.locator("[data-lifecycle-to=parked]").click();
- await expect(page.locator(`[data-undo='${REPORT}']`)).toContainText("Parked");
+ await expect(page.locator(`[data-undo='${REPORT}']`)).toContainText("Parked — hidden from Active.");
await expect(line).toHaveCount(0);
await page.locator("[data-facet=life]").getByRole("link", { name: /^Parked \d+$/ }).click();
@@ -100,6 +106,7 @@ test("Park takes a piece out of the active list, Parked lists it, Reactivate bri
const parked = page.locator(`${rows}[data-piece='${REPORT}']`);
await expect(parked).toHaveAttribute("data-lifecycle", "parked");
await parked.click();
+ await parked.getByRole("button", { name: "Lifecycle: Parked" }).click();
await parked.locator("[data-lifecycle-to=active]").click();
await expect(parked).toHaveCount(0);
expect((await pieces(request)).find((p) => p.id === REPORT)?.lifecycle).toBe("active");
@@ -107,3 +114,72 @@ test("Park takes a piece out of the active list, Parked lists it, Reactivate bri
await request.post("/api/pieces/lifecycle", { data: { piece: REPORT, state: "active" } });
}
});
+
+test.describe("on a phone (390×844)", () => {
+ test.use({ viewport: { width: 390, height: 844 }, isMobile: true, hasTouch: true });
+
+ const life = async (request: APIRequestContext) => (await pieces(request)).find((p) => p.id === REPORT)?.lifecycle;
+ const box = async (l: import("@playwright/test").Locator) => {
+ const b = await l.boundingBox();
+ expect(b).not.toBeNull();
+ return b!;
+ };
+ const apart = (a: { x: number; y: number; width: number; height: number }, b: typeof a) =>
+ a.x + a.width <= b.x || b.x + b.width <= a.x || a.y + a.height <= b.y || b.y + b.height <= a.y;
+
+ test("a row shows its title, its ⋯ is drawn over nothing, and a tap on the row changes no lifecycle", async ({ page, request }) => {
+ try {
+ await page.goto(urls.workHref());
+ await expect(page.locator("[data-lit-list]").first()).toHaveAttribute("data-hydrated", "");
+ const line = page.locator(`${rows}[data-piece='${REPORT}']`);
+ const title = line.locator("[data-piece-link]");
+ const more = line.locator("[data-work-lifecycle] > button");
+ const stage = line.locator("[data-work-stage]");
+ // Lit, so its ⋯ is drawn.
+ await line.tap({ position: { x: 4, y: 4 } });
+ await expect(line).toHaveAttribute("data-lit", "");
+ await expect(more).toBeVisible();
+ const [t, m, s] = [await box(title), await box(more), await box(stage)];
+ expect(t.width).toBeGreaterThan(80);
+ expect(apart(t, m)).toBe(true);
+ expect(apart(m, s)).toBe(true);
+ // No lifecycle button on the line until its menu is opened.
+ await expect(line.locator("[data-lifecycle-to]")).toHaveCount(0);
+ // Taps across the row -- the edge, the stage pips -- light it and nothing else.
+ const row = await box(line);
+ for (const x of [8, s.x - row.x + 4, s.x - row.x + s.width / 2, row.width - 6]) {
+ await line.tap({ position: { x, y: row.height / 2 } });
+ }
+ await expect(page.locator("[data-undo]")).toHaveCount(0);
+ expect(await life(request)).toBe("active");
+ await expect(line).toBeVisible();
+ } finally {
+ await request.post("/api/pieces/lifecycle", { data: { piece: REPORT, state: "active" } });
+ }
+ });
+
+ test("Mark done says what it did and offers Undo, which brings the piece back to Active", async ({ page, request }) => {
+ try {
+ await page.goto(urls.workHref());
+ await expect(page.locator("[data-lit-list]").first()).toHaveAttribute("data-hydrated", "");
+ const line = page.locator(`${rows}[data-piece='${REPORT}']`);
+ await line.locator("[data-work-lifecycle] > button").tap();
+ await line.locator("[data-lifecycle-to=done]").tap();
+ const bar = page.locator(`[data-undo='${REPORT}']`);
+ await expect(bar).toContainText("Marked done — hidden from Active.");
+ await expect(line).toHaveCount(0);
+ expect(await life(request)).toBe("done");
+ // The bar fits the phone.
+ const b = await box(bar);
+ expect(b.x).toBeGreaterThanOrEqual(0);
+ expect(b.x + b.width).toBeLessThanOrEqual(390);
+
+ await bar.getByRole("button", { name: "Undo" }).tap();
+ await expect(bar).toHaveCount(0);
+ await expect(line).toBeVisible();
+ expect(await life(request)).toBe("active");
+ } finally {
+ await request.post("/api/pieces/lifecycle", { data: { piece: REPORT, state: "active" } });
+ }
+ });
+});