Public: anyone can read this; the crew can change it.
small: the empty board, inbox and waves pages each say the one next step #14476
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/14464-small-the-empty-board-inbox-and-waves-pa → main 8 commits fork 3 threads · 3 unresolved
9 files
changed +27
−22
docs/features/wave-empty.md +1 −1
| @@ -9,7 +9,7 @@ A repository with no waves says one sentence and offers one tell, "write the fir | ||
| 9 | 9 | - The web page `/<owner>/<name>/waves` shows the sentence and a Tell the crew button that opens the tell with that text. |
| 10 | 10 | - The terminal's waves screen shows the same sentence and the same tell. |
| 11 | 11 | |
| 12 | Both doors take the words from `src/story/words.ts`, so they say the same thing. | |
| 12 | Both doors take the sentence and the button from the empty-words table (`src/core/empty_words.ts`, `waves`), so they say the same thing. | |
| 13 | 13 | |
| 14 | 14 | The empty page does not offer "Cut a wave". Where a person cuts the first wave: |
| 15 | 15 |
src/core/empty_words.ts +2 −1
| @@ -5,7 +5,7 @@ | ||
| 5 | 5 | * every kind and holds each to its sentence and its single link. |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | export type EmptyKind = "board" | "inbox" | "runs" | "apps" | "people"; | |
| 8 | export type EmptyKind = "board" | "inbox" | "runs" | "apps" | "people" | "waves"; | |
| 9 | 9 | |
| 10 | 10 | export interface EmptyWords { |
| 11 | 11 | /** One sentence, plain words, ending in a full stop. */ |
| @@ -20,5 +20,6 @@ export const EMPTY_WORDS: Readonly<Record<EmptyKind, EmptyWords>> = { | ||
| 20 | 20 | inbox: { sentence: "Nothing is waiting on you.", label: "Tell the crew something", href: "/tell" }, |
| 21 | 21 | runs: { sentence: "No run is open.", label: "Start with an issue", href: "/issues" }, |
| 22 | 22 | apps: { sentence: "Nothing runs here yet.", label: "New app", href: "/apps/new" }, |
| 23 | waves: { sentence: "No waves yet.", label: "Tell the crew", href: "/tell" }, | |
| 23 | 24 | people: { sentence: "Nobody has joined yet.", label: "Invite someone", href: "/admin/limits" }, |
| 24 | 25 | }; |
src/story/words.ts +1 −5
| @@ -7,12 +7,8 @@ | ||
| 7 | 7 | |
| 8 | 8 | import type { DeciderPile } from "../core/decisions.ts"; |
| 9 | 9 | |
| 10 | /** A repository with no waves: one sentence, said the same on the page and in the terminal. */ | |
| 11 | export const NO_WAVES = "Nothing has been written up yet. Ask the crew to write the first wave."; | |
| 12 | ||
| 13 | /** What the one button tells the crew, and what it is called. */ | |
| 10 | /** What the one button tells the crew. */ | |
| 14 | 11 | export const FIRST_WAVE_TELL = "write the first wave"; |
| 15 | export const FIRST_WAVE_BUTTON = "Tell the crew"; | |
| 16 | 12 | |
| 17 | 13 | /** |
| 18 | 14 | * "The decider closed 4, deferred 2, asked you about 1." as its parts, each |
src/tui/screens/waves.ts +5 −4
| @@ -17,7 +17,8 @@ import { repoBase } from "../../web/chrome.ts"; | ||
| 17 | 17 | import { waitingKeys } from "../../release/landings.ts"; |
| 18 | 18 | import { carriedPulls, inLandingOrder, pullPath, type CarriedPull } from "../../story/wave_pulls.ts"; |
| 19 | 19 | import { pullRefs, readWave, readWaves, sizeWords, waveLine, waveSize, appsOf, wavesInApp, type WaveEntry } from "../../story/waves.ts"; |
| 20 | import { FIRST_WAVE_BUTTON, FIRST_WAVE_TELL, NO_WAVES, landedSentence, waveSentence } from "../../story/words.ts"; | |
| 20 | import { EMPTY_WORDS } from "../../core/empty_words.ts"; | |
| 21 | import { FIRST_WAVE_TELL, landedSentence, waveSentence } from "../../story/words.ts"; | |
| 21 | 22 | import type { RepoSource } from "../../view/source.ts"; |
| 22 | 23 | import type { Ctx, Screen } from "../app/app.ts"; |
| 23 | 24 | import { binding } from "../app/keys.ts"; |
| @@ -331,13 +332,13 @@ export function wavesScreen(f: Session, ctx: Ctx, src: RepoSource): Screen { | ||
| 331 | 332 | ); |
| 332 | 333 | if (entries.length === 0) { |
| 333 | 334 | emptyState(s, body!, c, { |
| 334 | title: loaded ? "No waves yet" : "Reading…", | |
| 335 | title: loaded ? EMPTY_WORDS.waves.sentence : "Reading…", | |
| 335 | 336 | body: !loaded |
| 336 | 337 | ? "" |
| 337 | 338 | : repo === undefined |
| 338 | 339 | ? "Waves are only read on this forge." |
| 339 | : NO_WAVES, | |
| 340 | ...(askable() ? { action: `${FIRST_WAVE_BUTTON} (t)` } : {}), | |
| 340 | : "Nothing has been written up yet. Ask the crew to write the first wave.", | |
| 341 | ...(askable() ? { action: `${EMPTY_WORDS.waves.label} (t)` } : {}), | |
| 341 | 342 | }); |
| 342 | 343 | return; |
| 343 | 344 | } |
src/web/empty_words.ts +1
| @@ -17,6 +17,7 @@ const ICONS: Readonly<Record<EmptyKind, IconName>> = { | ||
| 17 | 17 | runs: "bot", |
| 18 | 18 | apps: "repo", |
| 19 | 19 | people: "users", |
| 20 | waves: "activity", | |
| 20 | 21 | }; |
| 21 | 22 | |
| 22 | 23 | export interface EmptyOptions { |
src/web/pages/waves.ts +4 −4
| @@ -20,11 +20,12 @@ import { movedWithPulls, type MovedMilestone, shippedOf, shippedWords, waveProgr | ||
| 20 | 20 | import { waveDuration } from "../../story/wave_duration.ts"; |
| 21 | 21 | import { carriedPulls, inLandingOrder, pullPath } from "../../story/wave_pulls.ts"; |
| 22 | 22 | import { appsOf, fromWave, inApp, parseAppFilter, pullRefs, readWave, readWaves, sizeWords, waveSize } from "../../story/waves.ts"; |
| 23 | import { FIRST_WAVE_BUTTON, FIRST_WAVE_TELL, NO_WAVES, landedSentence, waveSentence } from "../../story/words.ts"; | |
| 23 | import { FIRST_WAVE_TELL, landedSentence, waveSentence } from "../../story/words.ts"; | |
| 24 | 24 | import { wordClip } from "../../text/word_clip.ts"; |
| 25 | 25 | import { loadRepo, notFoundPage, repoBase, scopeHeader } from "../chrome.ts"; |
| 26 | 26 | import { escapeHtml, html, type Html } from "../html.ts"; |
| 27 | 27 | import { page } from "../layout.ts"; |
| 28 | import { EMPTY_WORDS } from "../empty_words.ts"; | |
| 28 | 29 | import { btn, empty, listCard, row, seg } from "../ui.ts"; |
| 29 | 30 | import { localScope } from "../scope.ts"; |
| 30 | 31 | import { milestoneHref, planFor, progress } from "./milestones.ts"; |
| @@ -107,14 +108,13 @@ export async function wavesPage(ctx: Ctx): Promise<Response> { | ||
| 107 | 108 | ? empty({ title: "No waves for that app" }) |
| 108 | 109 | : entries.length === 0 |
| 109 | 110 | ? empty({ |
| 110 | title: "No waves yet", | |
| 111 | note: NO_WAVES, | |
| 111 | title: EMPTY_WORDS.waves.sentence, | |
| 112 | 112 | ...(mayDirectCrew(ctx.app.db, repo, ctx.auth.user) |
| 113 | 113 | ? { |
| 114 | 114 | action: html`<form method="post" action="${repoBase(repo)}/tell"> |
| 115 | 115 | <input type="hidden" name="text" value="${FIRST_WAVE_TELL}" /> |
| 116 | 116 | <input type="hidden" name="from" value="${repoBase(repo)}/waves" /> |
| 117 | ${btn(FIRST_WAVE_BUTTON, { variant: "primary" })} | |
| 117 | ${btn(EMPTY_WORDS.waves.label, { variant: "primary" })} | |
| 118 | 118 | </form>`, |
| 119 | 119 | } |
| 120 | 120 | : {}), |
test/empty-states.test.ts +8 −2
| @@ -102,9 +102,9 @@ test("each list's one link says its own next step, in one sentence", async () => | ||
| 102 | 102 | expect((b!.match(/<p\b/g) ?? []).length).toBe(1); |
| 103 | 103 | }); |
| 104 | 104 | |
| 105 | test("the five lists take their empty sentence from one table, each with a single link", async () => { | |
| 105 | test("the six lists take their empty sentence from one table, each with a single link", async () => { | |
| 106 | 106 | // people: the signed-in admin is always one, so test/keys-people-list.test.ts holds its sentence |
| 107 | const pages: Record<string, string> = { board: "/boards", inbox: "/live/on-you", runs: "/root/fresh/runs", apps: "/apps" }; | |
| 107 | const pages: Record<string, string> = { board: "/boards", inbox: "/live/on-you", runs: "/root/fresh/runs", apps: "/apps", waves: "/root/fresh/waves" }; | |
| 108 | 108 | for (const [kind, path] of Object.entries(pages)) { |
| 109 | 109 | const w = EMPTY_WORDS[kind as keyof typeof EMPTY_WORDS]; |
| 110 | 110 | const blocks = emptyBlocks(await (await fetch(servers.url + path, { headers: { cookie } })).text()); |
| @@ -112,6 +112,12 @@ test("the five lists take their empty sentence from one table, each with a singl | ||
| 112 | 112 | expect(mine.length).toBe(1); |
| 113 | 113 | // apps and board: the page already offers the door, so the empty state does not say it twice. |
| 114 | 114 | const once = kind === "apps" || kind === "board"; |
| 115 | // waves: the one step is a tell button (a form), not a link. | |
| 116 | if (kind === "waves") { | |
| 117 | expect(mine[0]).toContain(w.label); | |
| 118 | expect(mine[0]).toContain('action="/root/fresh/tell"'); | |
| 119 | continue; | |
| 120 | } | |
| 115 | 121 | expect(links(mine[0]!).length).toBe(once ? 0 : 1); |
| 116 | 122 | if (!once) expect(links(mine[0]!)[0]!.endsWith(`|${w.label}`)).toBe(true); |
| 117 | 123 | expect(mine[0]).not.toContain('data-variant="primary"'); |
test/story-words.test.ts +1 −2
| @@ -7,7 +7,7 @@ | ||
| 7 | 7 | import { expect, test } from "bun:test"; |
| 8 | 8 | import { readFileSync } from "node:fs"; |
| 9 | 9 | import { join } from "node:path"; |
| 10 | import { NO_WAVES, deciderSentence } from "../src/story/words.ts"; | |
| 10 | import { deciderSentence } from "../src/story/words.ts"; | |
| 11 | 11 | |
| 12 | 12 | const read = (file: string) => readFileSync(join(import.meta.dir, "..", file), "utf8"); |
| 13 | 13 | |
| @@ -19,7 +19,6 @@ const SAYERS = [ | ||
| 19 | 19 | ]; |
| 20 | 20 | |
| 21 | 21 | test("the sentences read as they always have", () => { |
| 22 | expect(NO_WAVES).toBe("Nothing has been written up yet. Ask the crew to write the first wave."); | |
| 23 | 22 | const n = { closed: 4, deferred: 2, asked: 1 }; |
| 24 | 23 | expect(deciderSentence((p) => n[p]).join("")).toBe( |
| 25 | 24 | "The decider closed 4, deferred 2, asked you about 1.", |
test/wave-empty.test.ts +4 −3
| @@ -12,7 +12,8 @@ import type { Repo } from "../src/core/repos.ts"; | ||
| 12 | 12 | import { createSession } from "../src/core/sessions.ts"; |
| 13 | 13 | import { createUser, type User } from "../src/core/users.ts"; |
| 14 | 14 | import { serve, type Servers } from "../src/http/server.ts"; |
| 15 | import { FIRST_WAVE_TELL, NO_WAVES } from "../src/story/words.ts"; | |
| 15 | import { EMPTY_WORDS } from "../src/web/empty_words.ts"; | |
| 16 | import { FIRST_WAVE_TELL } from "../src/story/words.ts"; | |
| 16 | 17 | import { createForgeApp } from "../src/tui/forge.ts"; |
| 17 | 18 | import { wavesScreen } from "../src/tui/screens/waves.ts"; |
| 18 | 19 | import { local } from "../src/tui/screens/where.ts"; |
| @@ -50,7 +51,7 @@ afterAll(async () => { | ||
| 50 | 51 | |
| 51 | 52 | test("web: no waves says one sentence and one tell prefilled 'write the first wave'", async () => { |
| 52 | 53 | const body = await (await fetch(`${servers.url}/alice/bare/waves`, { headers: { cookie } })).text(); |
| 53 | expect(body).toContain(NO_WAVES); | |
| 54 | expect(body).toContain(EMPTY_WORDS.waves.sentence); | |
| 54 | 55 | expect(body).toContain('action="/alice/bare/tell"'); |
| 55 | 56 | expect(body).toContain(`name="text" value="${FIRST_WAVE_TELL}"`); |
| 56 | 57 | expect(body.match(/action="\/alice\/bare\/tell"/g)?.length).toBe(1); |
| @@ -58,7 +59,7 @@ test("web: no waves says one sentence and one tell prefilled 'write the first wa | ||
| 58 | 59 | |
| 59 | 60 | test("web: a reader who cannot direct the crew sees the sentence and no button", async () => { |
| 60 | 61 | const body = await (await fetch(`${servers.url}/alice/bare/waves`)).text(); |
| 61 | expect(body).toContain(NO_WAVES); | |
| 62 | expect(body).toContain(EMPTY_WORDS.waves.sentence); | |
| 62 | 63 | expect(body).not.toContain('action="/alice/bare/tell"'); |
| 63 | 64 | }); |
| 64 | 65 |
new above
offline
Non-blocking, principle 1: this literal repeats what the title already says. Drop it, or move it into the table.