From c6780c369c606534d1c502d0f519255737e5569f Mon Sep 17 00:00:00 2001
From: Dylan Trotter
-
Blocked on {s.blockedOn} On hold: {s.hold} On hold: {s.hold}
{x.kind} escalation with {x.route === "me" ? "you" : x.route === "parent" ? "the parent steward" : "the project steward"}: {x.question}
@@ -693,7 +693,7 @@ function ProjectView({ board: b, refetch }: { board: Board; refetch: () => void
-
Blocked on {s.blockedOn}
: null} - {s.hold !== null ?On hold: {s.hold}{s.holdBehind.length > 0 ? ` (behind ${s.holdBehind.join(", ")})` : ""}
: null} + {s.hold !== null ?On hold: {s.hold}{s.holdBehind.length > 0 ? ` (behind ${s.holdBehind.join(", ")})` : ""}
: null} {s.stuck ?Stuck{stuck === null ? "" : `: ${stuck.why}`}
: null}{s.kind === "ops" ? `Last wake ${ago(s.wokeAt, now)}` : `Reported ${ago(s.statusAt, now)} ยท adopted ${ago(s.createdAt, now)}`} @@ -983,7 +983,7 @@ function NeedsYouPrompt({ entry, now }: { entry: NeedsYouItem; now: number }) {
{n.what}
{n.kind === "provide-secret" ?The form opens in a thread; the value goes to {n.destination ?? "the destination the item names"}.
: null} {n.how !== null ?Not actionable yet: {n.why ?? "the server cannot verify it now"}.
: null} + {!n.actionable ?Not actionable yet: {n.why ?? "the server cannot verify it now"}.
: null} > ); } @@ -1244,13 +1244,13 @@ function kindLabel(kind: string | null): string { return kind ?? "thread"; } -/** The phrase's colour follows the glyph's (BB-76): yellow, red, blue, muted. */ +/** The phrase's colour follows the glyph's (BB-76), in bb's theme tokens (BB-99): attention, destructive, timeline-accent, muted. */ function phraseClass(state: SidebarEffortState): string { - const transition = " motion-safe:transition-colors duration-300"; - if (state === "you") return `text-amber-600 dark:text-amber-500${transition}`; - if (state === "blocked") return `text-destructive${transition}`; - if (state === "running") return `text-blue-600 dark:text-blue-400${transition}`; - return `text-muted-foreground${transition}`; + const transition = "motion-safe:transition-colors duration-300"; + if (state === "you") return `text-attention ${transition}`; + if (state === "blocked") return `text-destructive ${transition}`; + if (state === "running") return `text-timeline-accent ${transition}`; + return `text-muted-foreground ${transition}`; } /** @@ -1260,10 +1260,10 @@ function phraseClass(state: SidebarEffortState): string { * CSS only and stops under `prefers-reduced-motion`. */ function StewardGlyph({ kind }: { kind: SidebarEffortState }) { - const transition = " motion-safe:transition-colors duration-300"; - if (kind === "you") return ; - const border = kind === "blocked" ? "border-red-500" : kind === "running" ? "border-blue-500" : "border-muted-foreground/50"; - return ; + const transition = "motion-safe:transition-colors duration-300"; + if (kind === "you") return ; + const border = kind === "blocked" ? "border-destructive" : kind === "running" ? "border-timeline-accent" : "border-muted-foreground/50"; + return ; } /** A one-off thread's glyph: yellow when unread, blue animated while its agent runs, grey otherwise. */ diff --git a/plugins/stewards/sidebar-app.test.tsx b/plugins/stewards/sidebar-app.test.tsx index 646041d6..0b1c9db7 100644 --- a/plugins/stewards/sidebar-app.test.tsx +++ b/plugins/stewards/sidebar-app.test.tsx @@ -142,6 +142,11 @@ const lineTwo = (slot: RenderedSlot, title: string): string => slot.getByText(ti const glyphOf = (slot: RenderedSlot, title: string): string | null => slot.getByText(title).closest("li")!.querySelector("[data-steward-glyph]")?.getAttribute("data-steward-glyph") ?? null; +// BB-99: the glyph's and phrase's own class lists, so a test can assert the +// theme tokens they paint with. +const glyphClassOf = (slot: RenderedSlot, title: string): string => slot.getByText(title).closest("li")!.querySelector("[data-steward-glyph]")!.className; +const phraseClassOf = (slot: RenderedSlot, title: string): string => slot.getByText(title).closest("li")!.querySelector("[data-sidebar-line-two] span")!.className; + let app: CapturedPluginApp | null = null; const loadApp = async () => { app ??= await loadPluginApp(() => import("./app.js")); @@ -654,6 +659,52 @@ describe("the stewards sidebar sections, glyphs and phrases (BB-76)", () => { slot.lifecycle.unmount(); }); + // BB-99: the glyph and phrase paint with bb's theme tokens, so Tailwind keeps + // a rule for each class and the colours follow bb's theme, not the OS. + it("paints the four glyphs and phrases with bb theme tokens", async () => { + const slot = await renderSidebar({ + sidebarThreads: { + projects, + threads: [ + thread({ id: "thr_you", displayTitle: "ENG-1: Needs you" }), + thread({ id: "thr_blocked", displayTitle: "ENG-2: Red row" }), + thread({ id: "thr_running", displayTitle: "ENG-3: Working" }), + thread({ id: "thr_quiet", displayTitle: "ENG-4: Waiting" }), + ], + }, + rpc: { + stewardsSidebar: () => + sidebarData({ + bindings: [ + binding({ key: "ENG-1", threadId: "thr_you", needsUser: true }), + binding({ key: "ENG-2", threadId: "thr_blocked", blockedOn: "a review" }), + binding({ key: "ENG-3", threadId: "thr_running", workers: [{ threadId: "thr_w", title: "w", status: "running" }] }), + binding({ key: "ENG-4", threadId: "thr_quiet", status: { actor: "steward", nextAction: "wait for CI", at: 1 } }), + ], + }), + } as never, + }); + await waitFor(() => expect(slot.getByText("Needs you")).toBeTruthy()); + await waitFor(() => expect(slot.getByText("Waiting")).toBeTruthy()); + expect(glyphOf(slot, "Needs you")).toBe("you"); + expect(glyphClassOf(slot, "Needs you")).toContain("bg-attention"); + expect(phraseClassOf(slot, "Needs you")).toContain("text-attention"); + expect(glyphOf(slot, "Red row")).toBe("blocked"); + expect(glyphClassOf(slot, "Red row")).toContain("border-destructive"); + expect(phraseClassOf(slot, "Red row")).toContain("text-destructive"); + expect(glyphOf(slot, "Working")).toBe("running"); + expect(glyphClassOf(slot, "Working")).toContain("border-timeline-accent"); + expect(phraseClassOf(slot, "Working")).toContain("text-timeline-accent"); + expect(glyphOf(slot, "Waiting")).toBe("quiet"); + expect(glyphClassOf(slot, "Waiting")).toContain("border-muted-foreground/50"); + expect(phraseClassOf(slot, "Waiting")).toContain("text-muted-foreground"); + // Criterion 3: no raw palette class remains on any of the four rows. + for (const title of ["Needs you", "Red row", "Working", "Waiting"]) { + expect(`${glyphClassOf(slot, title)} ${phraseClassOf(slot, title)}`).not.toMatch(/\b(?:text|bg|border)-(?:blue|amber|red)-/u); + } + slot.lifecycle.unmount(); + }); + it("shows a quiet worker finish and the next look over a stale summary (BB-83)", async () => { const slot = await renderSidebar({ sidebarThreads: { projects, threads: [thread({ id: "thr_steward", displayTitle: "ENG-1: Fix login" })] }, From 221a836d8a90ecb8fa8b3346e8e61a817288965c Mon Sep 17 00:00:00 2001 From: Dylan Trotter