Public: anyone can read this; the crew can change it.
The held line on the signed-in home names its next action when nothing is held #12470
Check · Review · Land · Live done — Landed and live in production.
torque/forge:torque/12462-the-held-line-on-the-signed-in-home-name → main 5 commits fork 3 threads · 3 unresolved
4 files
changed +38
−6
src/web/studio/held.ts +13 −3
| @@ -31,10 +31,20 @@ function holds(ctx: Ctx, user: User) { | ||
| 31 | 31 | return out; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | /** One line for each gate that holds work back; nothing where none does. */ | |
| 35 | export function heldLine(ctx: Ctx, user: User): Html | null { | |
| 34 | /** | |
| 35 | * One line for each gate that holds work back; where none does, the one next action, but only | |
| 36 | * if `idle` (the first-tell box already carries its own). | |
| 37 | */ | |
| 38 | export function heldLine(ctx: Ctx, user: User, idle = false): Html | null { | |
| 36 | 39 | const found = holds(ctx, user); |
| 37 | if (found.length === 0) return null; | |
| 40 | if (found.length === 0) { | |
| 41 | if (!idle) return null; | |
| 42 | return html`<section class="stack stack-tight" id="held-line" aria-label="Held back"> | |
| 43 | <p class="small muted"> | |
| 44 | Ready for the next issue: <a href="/new/issue">open one</a>. | |
| 45 | </p> | |
| 46 | </section>`; | |
| 47 | } | |
| 38 | 48 | return html`<section class="stack stack-tight" id="held-line" aria-label="Held back"> |
| 39 | 49 | ${found.map( |
| 40 | 50 | ({ repo, hold }) => |
src/web/studio/home.ts +1 −1
| @@ -300,7 +300,7 @@ export async function studioHome( | ||
| 300 | 300 | // Before the first tell the card is the one box and carries the key line and the composer. |
| 301 | 301 | const firstTell = steps.some((s) => s.key === "tell" && !s.done); |
| 302 | 302 | const lean = html`<h1 class="sr-only">Home</h1> |
| 303 | ${firstSteps} ${address} ${firstTell ? null : crewKeyCard(ctx)} ${heldLine(ctx, user)} ${apps} | |
| 303 | ${firstSteps} ${address} ${firstTell ? null : crewKeyCard(ctx)} ${heldLine(ctx, user, !firstTell)} ${apps} | |
| 304 | 304 | <div class="stack"> |
| 305 | 305 | ${firstTell ? null : composer(ctx, user)} |
| 306 | 306 | <p class="small muted"> |
test/later-gate.test.ts +16 −2
| @@ -3,6 +3,8 @@ | ||
| 3 | 3 | * and when; a held issue says so at its top with Lift; the `Later` label and |
| 4 | 4 | * the gate are one thing; and one pass over the lot proposes what to close. |
| 5 | 5 | */ |
| 6 | import type { Ctx } from "../src/http/context.ts"; | |
| 7 | import { heldLine } from "../src/web/studio/held.ts"; | |
| 6 | 8 | import { afterAll, beforeAll, describe, expect, test } from "bun:test"; |
| 7 | 9 | import { mkdtemp, rm } from "node:fs/promises"; |
| 8 | 10 | import { tmpdir } from "node:os"; |
| @@ -87,9 +89,21 @@ describe("the Later gate in plain sight", () => { | ||
| 87 | 89 | await rm(dataDir, { recursive: true, force: true }); |
| 88 | 90 | }); |
| 89 | 91 | |
| 90 | test("a gate that holds nothing says nothing on home", async () => { | |
| 92 | test("a gate that holds nothing says nothing on the first-tell home, and never a blank panel", async () => { | |
| 91 | 93 | expect(gateHold(app.db, fresh())).toBeUndefined(); |
| 92 | expect(await get("/")).not.toContain("held-line"); | |
| 94 | const home = await get("/"); | |
| 95 | expect(home).not.toContain("held-line"); | |
| 96 | }); | |
outdated
Add a fresh-forge case, a case that heldLine without idle stays null, and an assertion on the href by itself. |
||
| 97 | ||
| 98 | test("heldLine says the next action only when asked (idle), and never when the first-tell box is up", () => { | |
| 99 | expect(gateHold(app.db, fresh())).toBeUndefined(); | |
| 100 | const ctx = { app } as unknown as Ctx; | |
| 101 | expect(heldLine(ctx, alice)).toBeNull(); | |
| 102 | expect(heldLine(ctx, alice, false)).toBeNull(); | |
| 103 | const idle = String(heldLine(ctx, alice, true)); | |
| 104 | expect(idle).toContain('id="held-line"'); | |
| 105 | expect(idle).toContain("Ready for the next issue:"); | |
| 106 | expect(idle).toContain('href="/new/issue"'); | |
| 93 | 107 | }); |
| 94 | 108 | |
| 95 | 109 | test("a new gate shows up on home: how many, who set it", async () => { |
test/next-steps-card.test.ts +8
| @@ -161,6 +161,14 @@ describe("the next-steps card of a spawned forge", () => { | ||
| 161 | 161 | expect(main).not.toContain('action="/settings/everyday"'); |
| 162 | 162 | }); |
| 163 | 163 | |
| 164 | test("a fresh forge after its first tell names the next issue, in one sentence with a link", async () => { | |
| 165 | const home = await page(owner); | |
| 166 | const line = home.slice(home.indexOf('id="held-line"'), home.indexOf("</section>", home.indexOf('id="held-line"'))); | |
| 167 | expect(line).toContain("Ready for the next issue:"); | |
| 168 | expect(line).toContain('href="/new/issue"'); | |
| 169 | expect(line).not.toContain("Next:"); | |
| 170 | }); | |
| 171 | ||
| 164 | 172 | test("the admin's first home carries exactly three steps, in order, none done", async () => { |
| 165 | 173 | const home = await page(owner); |
| 166 | 174 | expect(keys(home)).toEqual(["everyday", "apps", "tell"]); |
new above
offline
Principle 1 and 8: a status sentence plus 'Next:' is a second prompt on a page that already has the composer. One confident sentence with the action as the link. The terminal's heldLines has no matching idle line (both doors).