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

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/14464-small-the-empty-board-inbox-and-waves-pa → main 8 commits fork 3 threads · 3 unresolved

  • Merged. scout/14464-small-the-empty-board-inbox-and-waves-pa was merged into main as d20f20b.

Review

Sign in to review this change.
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
99 - The web page `/<owner>/<name>/waves` shows the sentence and a Tell the crew button that opens the tell with that text.
1010 - The terminal's waves screen shows the same sentence and the same tell.
1111
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.
1313
1414 The empty page does not offer "Cut a wave". Where a person cuts the first wave:
1515
src/core/empty_words.ts +2 −1
@@ -5,7 +5,7 @@
55 * every kind and holds each to its sentence and its single link.
66 */
77
8 export type EmptyKind = "board" | "inbox" | "runs" | "apps" | "people";
8 export type EmptyKind = "board" | "inbox" | "runs" | "apps" | "people" | "waves";
99
1010 export interface EmptyWords {
1111 /** One sentence, plain words, ending in a full stop. */
@@ -20,5 +20,6 @@ export const EMPTY_WORDS: Readonly<Record<EmptyKind, EmptyWords>> = {
2020 inbox: { sentence: "Nothing is waiting on you.", label: "Tell the crew something", href: "/tell" },
2121 runs: { sentence: "No run is open.", label: "Start with an issue", href: "/issues" },
2222 apps: { sentence: "Nothing runs here yet.", label: "New app", href: "/apps/new" },
23 waves: { sentence: "No waves yet.", label: "Tell the crew", href: "/tell" },
2324 people: { sentence: "Nobody has joined yet.", label: "Invite someone", href: "/admin/limits" },
2425 };
src/story/words.ts +1 −5
@@ -7,12 +7,8 @@
77
88 import type { DeciderPile } from "../core/decisions.ts";
99
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. */
1411 export const FIRST_WAVE_TELL = "write the first wave";
15 export const FIRST_WAVE_BUTTON = "Tell the crew";
1612
1713 /**
1814 * "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";
1717 import { waitingKeys } from "../../release/landings.ts";
1818 import { carriedPulls, inLandingOrder, pullPath, type CarriedPull } from "../../story/wave_pulls.ts";
1919 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";
2122 import type { RepoSource } from "../../view/source.ts";
2223 import type { Ctx, Screen } from "../app/app.ts";
2324 import { binding } from "../app/keys.ts";
@@ -331,13 +332,13 @@ export function wavesScreen(f: Session, ctx: Ctx, src: RepoSource): Screen {
331332 );
332333 if (entries.length === 0) {
333334 emptyState(s, body!, c, {
334 title: loaded ? "No waves yet" : "Reading…",
335 title: loaded ? EMPTY_WORDS.waves.sentence : "Reading…",
335336 body: !loaded
336337 ? ""
337338 : repo === undefined
338339 ? "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)` } : {}),

Non-blocking, principle 1: this literal repeats what the title already says. Drop it, or move it into the table.

341342 });
342343 return;
343344 }
src/web/empty_words.ts +1
@@ -17,6 +17,7 @@ const ICONS: Readonly<Record<EmptyKind, IconName>> = {
1717 runs: "bot",
1818 apps: "repo",
1919 people: "users",
20 waves: "activity",
2021 };
2122
2223 export interface EmptyOptions {
src/web/pages/waves.ts +4 −4
@@ -20,11 +20,12 @@ import { movedWithPulls, type MovedMilestone, shippedOf, shippedWords, waveProgr
2020 import { waveDuration } from "../../story/wave_duration.ts";
2121 import { carriedPulls, inLandingOrder, pullPath } from "../../story/wave_pulls.ts";
2222 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";
2424 import { wordClip } from "../../text/word_clip.ts";
2525 import { loadRepo, notFoundPage, repoBase, scopeHeader } from "../chrome.ts";
2626 import { escapeHtml, html, type Html } from "../html.ts";
2727 import { page } from "../layout.ts";
28 import { EMPTY_WORDS } from "../empty_words.ts";
2829 import { btn, empty, listCard, row, seg } from "../ui.ts";
2930 import { localScope } from "../scope.ts";
3031 import { milestoneHref, planFor, progress } from "./milestones.ts";
@@ -107,14 +108,13 @@ export async function wavesPage(ctx: Ctx): Promise<Response> {
107108 ? empty({ title: "No waves for that app" })
108109 : entries.length === 0
109110 ? empty({
110 title: "No waves yet",
111 note: NO_WAVES,
111 title: EMPTY_WORDS.waves.sentence,
112112 ...(mayDirectCrew(ctx.app.db, repo, ctx.auth.user)
113113 ? {
114114 action: html`<form method="post" action="${repoBase(repo)}/tell">
115115 <input type="hidden" name="text" value="${FIRST_WAVE_TELL}" />
116116 <input type="hidden" name="from" value="${repoBase(repo)}/waves" />
117 ${btn(FIRST_WAVE_BUTTON, { variant: "primary" })}
117 ${btn(EMPTY_WORDS.waves.label, { variant: "primary" })}
118118 </form>`,
119119 }
120120 : {}),
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 () =>
102102 expect((b!.match(/<p\b/g) ?? []).length).toBe(1);
103103 });
104104
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 () => {
106106 // 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" };
108108 for (const [kind, path] of Object.entries(pages)) {
109109 const w = EMPTY_WORDS[kind as keyof typeof EMPTY_WORDS];
110110 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
112112 expect(mine.length).toBe(1);
113113 // apps and board: the page already offers the door, so the empty state does not say it twice.
114114 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 }
115121 expect(links(mine[0]!).length).toBe(once ? 0 : 1);
116122 if (!once) expect(links(mine[0]!)[0]!.endsWith(`|${w.label}`)).toBe(true);
117123 expect(mine[0]).not.toContain('data-variant="primary"');
test/story-words.test.ts +1 −2
@@ -7,7 +7,7 @@
77 import { expect, test } from "bun:test";
88 import { readFileSync } from "node:fs";
99 import { join } from "node:path";
10 import { NO_WAVES, deciderSentence } from "../src/story/words.ts";
10 import { deciderSentence } from "../src/story/words.ts";
1111
1212 const read = (file: string) => readFileSync(join(import.meta.dir, "..", file), "utf8");
1313
@@ -19,7 +19,6 @@ const SAYERS = [
1919 ];
2020
2121 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.");
2322 const n = { closed: 4, deferred: 2, asked: 1 };
2423 expect(deciderSentence((p) => n[p]).join("")).toBe(
2524 "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";
1212 import { createSession } from "../src/core/sessions.ts";
1313 import { createUser, type User } from "../src/core/users.ts";
1414 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";
1617 import { createForgeApp } from "../src/tui/forge.ts";
1718 import { wavesScreen } from "../src/tui/screens/waves.ts";
1819 import { local } from "../src/tui/screens/where.ts";
@@ -50,7 +51,7 @@ afterAll(async () => {
5051
5152 test("web: no waves says one sentence and one tell prefilled 'write the first wave'", async () => {
5253 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);
5455 expect(body).toContain('action="/alice/bare/tell"');
5556 expect(body).toContain(`name="text" value="${FIRST_WAVE_TELL}"`);
5657 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
5859
5960 test("web: a reader who cannot direct the crew sees the sentence and no button", async () => {
6061 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);
6263 expect(body).not.toContain('action="/alice/bare/tell"');
6364 });
6465

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs