Public: anyone can read this; the crew can change it.

Every empty list says what it is waiting for in one sentence, from one table #13312

Merged opened this

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

Merged

scout/forge:scout/13293-every-empty-list-says-what-it-is-waiting → main 4 commits fork 7 threads · 7 unresolved

  • Merged. scout/13293-every-empty-list-says-what-it-is-waiting was merged into main as 5d854a6.

Review

Sign in to review this change.
15 files changed +225 −42
docs/features/README.md +1
@@ -17,6 +17,7 @@ A new note gets a row here (`test/feature-orphans.test.ts`).
1717 Read with the guide page [What a forge is](../guide-what-a-forge-is.md).
1818
1919 - [A look in the feed](feed-look.md)
20 - [Empty lists](empty-words.md)
2021 - [An app with no description says its README](readme-description.md)
2122 - [Arcade carts](arcade-carts.md)
2223 - [Changelog](changelog.md)
docs/features/empty-words.md added +17
@@ -0,0 +1,17 @@
1 # Empty lists
2
3 The board, inbox, runs, apps and people lists word their empty state from one table,

Both doors: say whether the terminal uses this table; if it has empty lists, it should.

4 `EMPTY_WORDS` in `src/core/empty_words.ts`: one plain sentence and one link each.
5
6 - **Web:** a page draws it with `emptyList(kind)` (`src/web/empty_words.ts`). The link is a plain
7 link, never a primary button, so an empty state adds no second accent. A page may name where the
8 link goes (a repository's own issues), or pass `noAction` when the viewer cannot take it or the
9 page already offers it (apps: the header has "New app"; boards: "Make a board" sits just below).
10 - **Terminal:** the boards, runs, apps and inbox screens take their empty title from the same
11 `sentence`; they keep their own key hints as the body, because a terminal has keys, not links.
12 The people screen is never empty (the signed-in admin is always one).
13 - "Invite someone" goes to `/admin/limits`, where invite links are minted; the people page is
14 admin-only, so only an admin ever sees it.
15
16 A new list that can be empty gets a row in the table, not its own words.
17 `test/empty-states.test.ts` walks the lists and holds each to its sentence and its link.
src/core/empty_words.ts added +24
@@ -0,0 +1,24 @@
1 /**
2 * What an empty list is waiting for (#13293): one plain sentence and one link per list, from this
3 * table alone, for both doors. The web draws it with `emptyList(kind)` (`src/web/empty_words.ts`);
4 * the terminal's empty screens take their title from `sentence`. `test/empty-states.test.ts` walks
5 * every kind and holds each to its sentence and its single link.
6 */
7
8 export type EmptyKind = "board" | "inbox" | "runs" | "apps" | "people";
9
10 export interface EmptyWords {
11 /** One sentence, plain words, ending in a full stop. */
12 readonly sentence: string;
13 /** The one action, and where it goes when the page does not say otherwise. */
14 readonly label: string;
15 readonly href: string;
16 }
17
18 export const EMPTY_WORDS: Readonly<Record<EmptyKind, EmptyWords>> = {
19 board: { sentence: "No board yet.", label: "Start from a question", href: "/boards/data" },
20 inbox: { sentence: "Nothing is waiting on you.", label: "Tell the crew something", href: "/tell" },
21 runs: { sentence: "No run is open.", label: "Start with an issue", href: "/issues" },
22 apps: { sentence: "Nothing runs here yet.", label: "New app", href: "/apps/new" },
23 people: { sentence: "Nobody has joined yet.", label: "Invite someone", href: "/admin/limits" },
24 };
src/tui/screens/apps_crew.ts +2 −1
@@ -15,6 +15,7 @@ import { fill, len, split } from "../ui/layout.ts";
1515 import { style } from "../term/style.ts";
1616 import { truncate } from "../term/width.ts";
1717 import { emptyState } from "../ui/widgets.ts";
18 import { EMPTY_WORDS } from "../../core/empty_words.ts";
1819 import { aboutScreen } from "./about.ts";
1920 import { ListState, drawList, type ListRow } from "./common.ts";
2021 import type { PaletteEntry } from "./entries.ts";
@@ -63,7 +64,7 @@ export function appsCrewScreen(f: Session, ctx: Ctx): Screen {
6364 const [head, body] = split(area, "v", [len(1), fill(1)]);
6465 if (rows === undefined) return;
6566 if (rows.length === 0) {
66 emptyState(s, body!, c, { title: "No apps yet." });
67 emptyState(s, body!, c, { title: EMPTY_WORDS.apps.sentence });
6768 return;
6869 }
6970 s.text(head!.x, head!.y, truncate("enter opens the app", head!.w), style(c.mutedFg, c.bg), head!.x + head!.w);
src/tui/screens/asked.ts +11 −4
@@ -29,13 +29,16 @@ import { binding } from "../app/keys.ts";
2929 import type { Session } from "../session.ts";
3030 import { split, fill, len } from "../ui/layout.ts";
3131 import { emptyState, type Tone } from "../ui/widgets.ts";
32 import { EMPTY_WORDS } from "../../core/empty_words.ts";
3233 import { style } from "../term/style.ts";
3334 import { truncate } from "../term/width.ts";
3435 import { ListState, drawList, hitList, metaOf, openOnWeb, relTime, type ListRow } from "./common.ts";
3536 import { issueScreen } from "./issue.ts";
3637 import { local } from "./where.ts";
3738
38 /** One line of plain text: a typed thought may carry newlines or escapes the terminal must not obey. */
39 /**
40 * One line of plain text: a typed thought may carry newlines or escapes the terminal must not obey.
41 */
3942 const plain = (text: string): string =>
4043 // eslint-disable-next-line no-control-regex
4144 text.replace(/[\u0000-\u001f\u007f-\u009f]+/g, " ").trim();
@@ -64,7 +67,10 @@ function toneOf(flagged: boolean, state: string): { tone?: Tone } {
6467 return state === "building" ? { tone: "attn" } : {};
6568 }
6669
67 /** Where it went and what it repeats or takes back, in /asked's words (`whereItWent`, `thoughtNotes`). */
70 /**
71 * Where it went and what it repeats or takes back, in /asked's words (`whereItWent`,
72 * `thoughtNotes`).
73 */
6874 function thoughtLine(t: StreamThought): AskedLine {
6975 const where = whereItWent(t).map((x) => `${x.lead}${x.text}`);
7076 const notes = thoughtNotes(t).map((n) => `${n.text} ${relTime(n.at)}`);
@@ -204,7 +210,8 @@ export function askedLines(
204210 const repos = askedRepos(db, viewer, null);
205211 return {
206212 thoughts: thoughtStream(db, viewer, { limit: 50 }).map(thoughtLine),
207 // MCP's order, not /asked's needs-the-owner grouping: the title names the order, so the rows keep it.
213 // MCP's order, not /asked's needs-the-owner grouping: the title names the order, so the rows
214 // keep it.
208215 asks: askedIn(db, repos, view).map(askLine),
209216 };
210217 }
@@ -251,7 +258,7 @@ export function askedScreen(f: Session, ctx: Ctx): Screen {
251258 s.text(head!.x, head!.y, truncate(sentence, head!.w), style(c.mutedFg, c.bg), head!.x + head!.w);
252259 if (lines.length === 0) {
253260 emptyState(s, body!, c, {
254 title: "Nothing asked yet",
261 title: EMPTY_WORDS.inbox.sentence,

Non-blocking: this screen is what you told the crew and what became of it, not what waits on you. 'Nothing is waiting on you.' over 'What you tell the crew shows up here' reads as two different lists. Use a sentence that matches the screen (principle 8: plain words).

255262 body: "What you tell the crew shows up here, with what became of it.",
256263 });
257264 return;
src/tui/screens/boards.ts +24 −13
@@ -3,12 +3,13 @@
33 * keeps, then one board's panels as text. It reads through the same
44 * `listAllBoards` and `showBoard` the page and the API do, so the gate is the
55 * action's (an agent or anyone else is told nothing); the palette offers the
6 * door only to that person. `n` makes a board, `c` copies the marked one, `e` renames it and `g` sets
7 * its range (`changeBoard`; `home` still jumps to the top), and `D` deletes it after `y/n`
8 * (`actions/boards.ts`, as the page does). Otherwise reading, but for pins: a chart is not drawn, a panel is said
9 * as its title, chart, size and the query that feeds it, then what `panelData` reads for it
10 * (the page's and the API's door): a time panel's last bucket and its step, else its row count. `[`/`]` mark a panel,
11 * `p` pins or unpins it to home and `<`/`>` move a pinned one (`actions/board-pins.ts`).
6 * door only to that person. `n` makes a board, `c` copies the marked one, `e` renames it and `g`
7 * sets its range (`changeBoard`; `home` still jumps to the top), and `D` deletes it after `y/n`
8 * (`actions/boards.ts`, as the page does). Otherwise reading, but for pins: a chart is not drawn, a
9 * panel is said as its title, chart, size and the query that feeds it, then what `panelData` reads
10 * for it (the page's and the API's door): a time panel's last bucket and its step, else its row
11 * count. `[`/`]` mark a panel, `p` pins or unpins it to home and `<`/`>` move a pinned one
12 * (`actions/board-pins.ts`).
1213 */
1314
1415 import { formatValue } from "../../boards/chart.ts";
@@ -21,12 +22,15 @@ import { binding } from "../app/keys.ts";
2122 import type { Session } from "../session.ts";
2223 import { split, fill, len } from "../ui/layout.ts";
2324 import { emptyState } from "../ui/widgets.ts";
25 import { EMPTY_WORDS } from "../../core/empty_words.ts";
2426 import { style } from "../term/style.ts";
2527 import { truncate } from "../term/width.ts";
2628 import { ListState, Scroll, drawList, promptScreen, drawLines, hitList, hitScroll, metaOf, plural, runAsync, type ListRow } from "./common.ts";
2729 import type { PaletteEntry } from "./entries.ts";
2830
29 /** One line of plain text: a title or a query value may carry escapes the terminal must not obey. */
31 /**
32 * One line of plain text: a title or a query value may carry escapes the terminal must not obey.
33 */
3034 export const plain = (text: string): string =>
3135 // eslint-disable-next-line no-control-regex
3236 text.replace(/[\u0000-\u001f\u007f-\u009f]+/g, " ").trim();
@@ -56,7 +60,10 @@ export async function boardRows(session: Session): Promise<BoardRow[]> {
5660 export const stepWords = (s: number): string =>
5761 s % 86_400 === 0 ? `${s / 86_400}d` : s % 3600 === 0 ? `${s / 3600}h` : s % 60 === 0 ? `${s / 60}m` : `${s}s`;
5862
59 /** What a panel's data says in one line: its last bucket and step, its row count, or why it was refused. */
63 /**
64 * What a panel's data says in one line: its last bucket and step, its row count, or why it was
65 * refused.
66 */
6067 export function dataLine(d: PanelData): string {
6168 if (!d.ok) return `refused: ${plain(d.error)}`;
6269 if (d.step === null) return plural(d.rows.length, "row");
@@ -127,9 +134,10 @@ export function boardScreen(ctx: Ctx, f: Session, slug: string, first: Board): S
127134 await read();
128135 };
129136 /**
130 * Remove the panel asked about as the web's Remove does; pins are left as `changeBoard` leaves them.
131 * `changeBoard` removes by index, so the board is read again first: when another door moved or removed
132 * panels and `index` no longer holds `title`, nothing is removed and the screen shows the board as it is.
137 * Remove the panel asked about as the web's Remove does; pins are left as `changeBoard` leaves
138 * them. `changeBoard` removes by index, so the board is read again first: when another door moved
139 * or removed panels and `index` no longer holds `title`, nothing is removed and the screen shows
140 * the board as it is.
133141 */
134142 const drop = (index: number, title: string): void =>
135143 runAsync(ctx, async () => {
@@ -252,7 +260,10 @@ export function boardsScreen(f: Session, ctx: Ctx): Screen {
252260 });
253261 // The gate is `changeBoard`'s, read once as the board screen's is.
254262 const mayEdit = f.user?.isAdmin === true && f.user.kind !== "agent";
255 /** Prompt for a new value of the row's board and apply it as the board page's Rename and Settings do. */
263 /**
264 * Prompt for a new value of the row's board and apply it as the board page's Rename and Settings
265 * do.
266 */
256267 const edit = (row: BoardRow, what: "title" | "range"): void => {
257268 ctx.push(
258269 promptScreen(ctx, screen, {
@@ -290,7 +301,7 @@ export function boardsScreen(f: Session, ctx: Ctx): Screen {
290301 s.text(head!.x, head!.y, truncate(headline, head!.w), style(asking ? c.fg : c.mutedFg, c.bg), head!.x + head!.w);
291302 if (rows.length === 0) {
292303 emptyState(s, body!, c, {
293 title: "No boards yet",
304 title: EMPTY_WORDS.board.sentence,
294305 body: "Press n to make one.",
295306 });
296307 return;
src/tui/screens/runs.ts +2 −1
@@ -21,6 +21,7 @@ import { style } from "../term/style.ts";
2121 import { truncate } from "../term/width.ts";
2222 import { fill, len, split } from "../ui/layout.ts";
2323 import { emptyState } from "../ui/widgets.ts";
24 import { EMPTY_WORDS } from "../../core/empty_words.ts";
2425 import { confirmScreen } from "./common.ts";
2526 import { RunList, maySteer, openRunLog, runTitle, steerPrompt } from "./runlist.ts";
2627
@@ -151,7 +152,7 @@ export function runsScreen(f: Session, ctx: Ctx, repo: Repo): Screen {
151152 );
152153 if (list.runs.length === 0) {
153154 emptyState(s, body!, c, {
154 title: loaded ? "No runs" : "Reading…",
155 title: loaded ? EMPTY_WORDS.runs.sentence : "Reading…",
155156 body: loaded
156157 ? at === 0
157158 ? "Nothing has run here yet."
src/web/empty_words.ts added +38
@@ -0,0 +1,38 @@
1 /**
2 * The web's door onto the empty-list table (#13293, `src/core/empty_words.ts`): a page that draws a
3 * list of none calls `emptyList(kind)`; it never words its own. The link is a plain link, so an
outdated

Cites test/empty-words.test.ts which does not exist; point it at test/empty-states.test.ts.

4 * empty state never adds a second accent to a page that already has one.
5 * `test/empty-states.test.ts` walks every kind and holds each to its sentence and its single link.
6 */
7
8 import type { Html } from "./html.ts";
9 import { EMPTY_WORDS, type EmptyKind } from "../core/empty_words.ts";
10 import { btn, empty, type IconName } from "./ui.ts";
11
12 export { EMPTY_WORDS, type EmptyKind };
13
14 const ICONS: Readonly<Record<EmptyKind, IconName>> = {
15 board: "activity",
16 inbox: "check",
17 runs: "bot",
18 apps: "repo",
19 people: "users",
20 };
21
22 export interface EmptyOptions {
23 /** Where the action goes, when it is not the table's (a repository's own issues, say). */
24 href?: string;
25 /** Leave the link out: the viewer cannot take the action, or the page already offers it. */
26 noAction?: boolean;
27 bind?: string | undefined;
28 }
29
30 export function emptyList(kind: EmptyKind, o: EmptyOptions = {}): Html {
31 const w = EMPTY_WORDS[kind];
32 return empty({
33 icon: ICONS[kind],
34 title: w.sentence,
35 ...(o.noAction ? {} : { action: btn(w.label, { href: o.href ?? w.href, variant: "link" }) }),
36 bind: o.bind,
37 });
38 }
src/web/pages/apps.ts +4 −1
@@ -94,6 +94,7 @@ import {
9494 terminalLine,
9595 field as formField,
9696 } from "../ui.ts";
97 import { emptyList } from "../empty_words.ts";
9798
9899 // ---- what the viewer can see ----
99100
@@ -262,7 +263,9 @@ export async function appsList(ctx: Ctx): Promise<Response> {
262263 <a href="/apps?archived=1">${archivedCount} archived</a>
263264 </p>`
264265 : null}
265 ${shown.length === 0
266 ${shown.length === 0 && !archivedView && !live
267 ? emptyList("apps", { noAction: true })
outdated

Principle 1/5: header already has primary 'New app'; pass noAction here or the page says it twice with two accents.

268 : shown.length === 0
266269 ? html`<section class="stack">
267270 <p><strong>${archivedView
268271 ? "Nothing is archived"
src/web/pages/boards-view.ts +12 −4
@@ -19,6 +19,7 @@ import { notFoundPage, signInFirst } from "../chrome.ts";
1919 import { html, when, type Html } from "../html.ts";
2020 import { fragment, page } from "../layout.ts";
2121 import { btn, chartFrame, confirmAction, field, selectField } from "../ui.ts";
22 import { emptyList } from "../empty_words.ts";
2223 import { fold, reading, readingFailed, readingJs } from "../figure.ts";
2324 import { formatValue } from "../../boards/chart.ts";
2425 import { flowPanel, outAsked } from "./flow-panel.ts";
@@ -30,7 +31,10 @@ import { drawnPanel, panelData, runFor, type PanelDrawn } from "../../boards/pan
3031 import { readParams } from "../../boards/params.ts";
3132 import { paramsOf, queryFields } from "./boards.ts";
3233
33 /** The events the panels' queries read (runs, pulls, checks, issues, usage): any of them may change a chart. */
34 /**
35 * The events the panels' queries read (runs, pulls, checks, issues, usage): any of them may change
36 * a chart.
37 */
3438 const READS = "run.queued,run.started,run.finished,pull.*,check.*,issue.*,usage.*";
3539
3640 const sizes = (max: number, word: string, now: number) =>
@@ -46,7 +50,10 @@ export function drawPanel(
4650 at: PanelAt,
4751 aside: Html | null = null,
4852 run: typeof runFor = runFor,
49 /** The panel as a worker read and drew it (`flow/pages.ts`); without it the rows are read and drawn here, for a direct caller. */
53 /**
54 * The panel as a worker read and drew it (`flow/pages.ts`); without it the rows are read and
55 * drawn here, for a direct caller.
56 */
5057 drawn: PanelDrawn = drawnPanel(panel, panelData(app.db, board, panel, {}, Date.now(), run)),
5158 ): Html {
5259 const q = paramsOf(panel.query, panel.chart);
@@ -132,7 +139,7 @@ export async function boardsList(ctx: Ctx): Promise<Response> {
132139 const boards = html`<section class="bd-block" id="boards-all" aria-labelledby="boards-all-h">
133140 <header class="bd-head"><h2 id="boards-all-h">Your boards</h2><p class="bd-sub">A board is a page of charts over the forge's own numbers, saved as a file in forge/boards.</p></header>
134141 ${listed.value.length === 0
135 ? html`<p class="muted">No board yet. Make one below, or start from a question on <a href="/boards/data">Explore the data</a>.</p>`
142 ? emptyList("board", { noAction: true })
136143 : html`<ul class="bd-boards">
137144 ${listed.value.map(
138145 ({ slug, board }) => html`<li class="tile"><a href="/boards/${slug}" class="tile-link" data-nav tabindex="-1">
@@ -246,7 +253,8 @@ export async function boardShow(ctx: Ctx): Promise<Response> {
246253 if (ctx.url.searchParams.has("wait")) {
247254 return waitAnswer(await boardPicture(ctx.app, slug, LONG_WAIT_MS));
248255 }
249 // The board's file and every panel's rows are read by a worker and kept: no query and no git on this thread.
256 // The board's file and every panel's rows are read by a worker and kept: no query and no git on
257 // this thread.
250258 const picture = await timePhaseAsync(ctx.request, "picture", () => boardPicture(ctx.app, slug));
251259 if (picture === undefined || isFailed(picture)) {
252260 return page({
src/web/pages/people.ts +4 −1
@@ -23,6 +23,7 @@ import { isLocalPath } from "../flash.ts";
2323 import { html } from "../html.ts";
2424 import { flashTo, page } from "../layout.ts";
2525 import { btn, empty, time, userLink } from "../ui.ts";
26 import { emptyList } from "../empty_words.ts";
2627 import { accountSections } from "./origins.ts";
2728
2829 /**
@@ -102,7 +103,9 @@ export function peoplePage(ctx: Ctx): Response {
102103 ${filters}
103104 ${
104105 rows.length === 0
105 ? empty({ icon: "users", title: only === null ? "Nobody has joined yet." : "Nobody here." })
106 ? only === null
107 ? emptyList("people")
108 : empty({ icon: "users", title: "Nobody here." })
106109 : html`<div class="table-scroll" data-people>
107110 <table class="table" id="people">
108111 <thead><tr><th>Person</th><th></th></tr></thead>
src/web/studio/asks_page.ts +44 −12
@@ -51,6 +51,7 @@ import {
5151 import { html, type Html } from "../html.ts";
5252 import { noteLine } from "./note.ts";
5353 import { page, redirect } from "../layout.ts";
54 import { emptyList } from "../empty_words.ts";
5455 import { btn, card, disclosure, icon, row } from "../ui.ts";
5556 import {
5657 askAnchor,
@@ -193,7 +194,10 @@ function acts(ctx: Ctx, d: Decision): Html {
193194 return html`<div class="bar mt">${primary}${others}</div>`;
194195 }
195196
196 /** What the crew advised on a pull waiting for a person, in one plain line; nothing when it wrote none. */
197 /**
198 * What the crew advised on a pull waiting for a person, in one plain line; nothing when it wrote
199 * none.
200 */
197201 const adviceLine = (d: Decision): Html | null =>
198202 d.recommendation === undefined
199203 ? null
@@ -250,7 +254,10 @@ const rowHead = (kind: Decision["kind"], n: number): string => {
250254 return `${line.charAt(0).toUpperCase()}${line.slice(1)}`;
251255 };
252256
253 /** The flash's own query keys: dropped from the page a decision returns to, so Undo does not carry them. */
257 /**
258 * The flash's own query keys: dropped from the page a decision returns to, so Undo does not carry
259 * them.
260 */
254261 const FLASH_KEYS = ["muted", "listened"] as const;
255262
256263 /** This page as a path and query without the flash, for a form's `back`. */
@@ -276,7 +283,10 @@ function withFlash(back: string, key: (typeof FLASH_KEYS)[number], repoId: strin
276283 return `${path}?${q.toString()}`;
277284 }
278285
279 /** "Muted owner/name" or "Listening to owner/name again", with Undo, when the page was reached from a mute or listen. */
286 /**
287 * "Muted owner/name" or "Listening to owner/name again", with Undo, when the page was reached from
288 * a mute or listen.
289 */
280290 function muteFlash(ctx: Ctx, user: NonNullable<Ctx["auth"]["user"]>): Html | null {
281291 for (const key of FLASH_KEYS) {
282292 const id = ctx.url.searchParams.get(key);
@@ -407,7 +417,10 @@ function rowCard(ctx: Ctx, r: AskRow<Decision>, picked: ReadonlySet<string>): Ht
407417 );
408418 }
409419
410 /** The forge is degraded: an alert line, marked in the danger tone, under its head; Health on its own row so it never wraps into the sentence. */
420 /**
421 * The forge is degraded: an alert line, marked in the danger tone, under its head; Health on its
422 * own row so it never wraps into the sentence.
423 */
411424 export const forgeCard = (d: ForgeNeed): Html =>
412425 html`<section class="stack">
413426 <h2>The forge</h2>
@@ -426,7 +439,10 @@ export const asleepCard = (a: Asleep): Html =>
426439 <div class="bar">${btn("Open it", { href: `/${a.repo.ownerName}/${a.repo.name}`, size: "sm" })}</div>
427440 </section>`;
428441
429 /** What sits above the asks after a bulk step: a preview to confirm, a receipt, or why nothing was done. */
442 /**
443 * What sits above the asks after a bulk step: a preview to confirm, a receipt, or why nothing was
444 * done.
445 */
430446 export interface AsksTop {
431447 readonly banner: Html;
432448 /** The asks the preview is about, kept ticked. */
@@ -502,7 +518,9 @@ function undoSlot(ctx: Ctx, user: User | undefined): Html | null {
502518 return last === undefined ? null : undoBar(receiptOf(last), last.id, "kept for a day");
503519 }
504520
505 /** One bar: what was done, and, when it can be taken back, the Undo (a same-origin POST) and a note. */
521 /**
522 * One bar: what was done, and, when it can be taken back, the Undo (a same-origin POST) and a note.
523 */
506524 function undoBar(say: string, operationId?: string, note?: string): Html {
507525 if (operationId === undefined) return html`<p class="bar small" role="status">${say}</p>`;
508526 return html`<form class="bar" method="post" action="/asks/bulk/${operationId}/undo" role="status">
@@ -562,7 +580,7 @@ export function needsYouSection(
562580 const count = rows.length + needs.length + asleep.length;
563581 if (count === 0 && top === undefined)
564582 return {
565 body: html`<h2 id="asks-sentence" class="sr-only">${askSentence(0)}</h2>${filtered}${silencedNote}${asideNote}${undo}`,
583 body: html`<h2 id="asks-sentence" class="sr-only">${askSentence(0)}</h2>${emptyList("inbox")}${filtered}${silencedNote}${asideNote}${undo}`,
566584 scriptJs: "",
567585 };
568586 // The forge's own health first, then the few asks that matter most;
@@ -726,7 +744,9 @@ function receiptTop(ctx: Ctx, opId: string): AsksTop | undefined {
726744 };
727745 }
728746
729 /** POST /asks/bulk — the preview on this screen, or with `apply` the deed, then its receipt here. */
747 /**
748 * POST /asks/bulk — the preview on this screen, or with `apply` the deed, then its receipt here.
749 */
730750 export async function asksBulkSubmit(ctx: Ctx): Promise<Response> {
731751 if (!ctx.auth.user) return signInFirst(ctx);
732752 const form = await readForm(ctx, "rw");
@@ -804,7 +824,10 @@ export async function asksDecide(ctx: Ctx): Promise<Response> {
804824 return redirect(`/asks?decided=${done.value.id}#asks-bulk-result`);
805825 }
806826
807 /** POST /asks/give-back — hand a handed-over pull back to the builder that opened it; its card leaves. */
827 /**
828 * POST /asks/give-back — hand a handed-over pull back to the builder that opened it; its card
829 * leaves.
830 */
808831 export async function asksGiveBack(ctx: Ctx): Promise<Response> {
809832 if (!ctx.auth.user) return signInFirst(ctx);
810833 const form = await readForm(ctx, "rw");
@@ -817,7 +840,10 @@ export async function asksGiveBack(ctx: Ctx): Promise<Response> {
817840 return redirect(backTo(form, "/asks"));
818841 }
819842
820 /** POST /asks/proposal/:id/(approve|redirect|later|again) — one wave proposal, then back to the page the person came from. */
843 /**
844 * POST /asks/proposal/:id/(approve|redirect|later|again) — one wave proposal, then back to the page
845 * the person came from.
846 */
821847 export function asksProposal(verb: ProposalVerb) {
822848 return async (ctx: Ctx): Promise<Response> => {
823849 if (!ctx.auth.user) return signInFirst(ctx);
@@ -864,7 +890,10 @@ export async function asksListen(ctx: Ctx): Promise<Response> {
864890 return redirect(only === undefined ? back : withFlash(back, "listened", only));
865891 }
866892
867 /** POST /asks/mute — the viewer mutes one repository they can read: its asks leave their home, inbox and phone. */
893 /**
894 * POST /asks/mute — the viewer mutes one repository they can read: its asks leave their home, inbox
895 * and phone.
896 */
868897 export async function asksMute(ctx: Ctx): Promise<Response> {
869898 if (!ctx.auth.user) return signInFirst(ctx);
870899 const form = await readForm(ctx, "rw");
@@ -878,7 +907,10 @@ export async function asksMute(ctx: Ctx): Promise<Response> {
878907 return redirect(withFlash(asksBack(form), "muted", repo.id));
879908 }
880909
881 /** POST /asks/filter — `do` (hide_app_day, hide_app, show_app, hide_kind, show_kind, clear) with `repo` or `kind`: one tap, saved for the viewer. */
910 /**
911 * POST /asks/filter — `do` (hide_app_day, hide_app, show_app, hide_kind, show_kind, clear) with
912 * `repo` or `kind`: one tap, saved for the viewer.
913 */
882914 export async function asksFilter(ctx: Ctx): Promise<Response> {
883915 if (!ctx.auth.user) return signInFirst(ctx);
884916 const form = await readForm(ctx, "rw");
src/web/studio/lists.ts +7 −2
@@ -56,6 +56,7 @@ import {
5656 seg,
5757 time,
5858 } from "../ui.ts";
59 import { emptyList } from "../empty_words.ts";
5960 import type { Run, RunState } from "../../core/runs.ts";
6061 import { actorsFor, issuesFor, runTitleFrom } from "../pages/runs.ts";
6162 import { originGlyph } from "../pages/thread.ts";
@@ -348,7 +349,9 @@ function closedWord(issue: Issue): { word: Word; note: string } {
348349 : { word: "done", note: "closed as done" };
349350 }
350351
351 /** Whether the list is open and narrowed by a label alone: the rows the labels page's number counts. */
352 /**
353 * Whether the list is open and narrowed by a label alone: the rows the labels page's number counts.
354 */
352355 function byLabelOnly(f: ListFacets): boolean {
353356 return f.label !== "" && atRest({ ...f, label: "" });
354357 }
@@ -849,7 +852,9 @@ export async function runsListPage(ctx: Ctx, repo: Repo): Promise<Response> {
849852 const rendering = performance.now();
850853 const list =
851854 rows.length === 0
852 ? empty({
855 ? filter === undefined
856 ? emptyList("runs", { href: `${base}/issues`, bind })
857 : empty({
853858 icon: "bot",
854859 title: emptyNote(
855860 filter,
test/empty-states.test.ts +34 −2
@@ -1,4 +1,7 @@
1 /** A fresh account's blank list pages are never a dead end: every empty state carries a link (#10938). */
1 /**
2 * A fresh account's blank list pages are never a dead end: every empty state carries a link
3 * (#10938).
4 */
25 import { afterAll, beforeAll, expect, test } from "bun:test";
36 import { mkdtemp, rm } from "node:fs/promises";
47 import { tmpdir } from "node:os";
@@ -8,6 +11,7 @@ import { createApp, type App } from "../src/app.ts";
811 import { createSession } from "../src/core/sessions.ts";
912 import { createUser } from "../src/core/users.ts";
1013 import { serve, type Servers } from "../src/http/server.ts";
14 import { EMPTY_WORDS, emptyList } from "../src/web/empty_words.ts";
1115
1216 let dir: string;
1317 let app: App;
@@ -30,7 +34,9 @@ afterAll(async () => {
3034 await rm(dir, { recursive: true, force: true });
3135 });
3236
33 const LISTS = ["/root/fresh/issues", "/root/fresh/pulls", "/root/fresh/runs", "/apps", "/settings/people", "/boards", "/notes"];
37 // /apps and /boards are not here: their page already carries the one door ("New app", "Make a
38 // board").
39 const LISTS = ["/root/fresh/issues", "/root/fresh/pulls", "/root/fresh/runs", "/settings/people", "/notes"];
3440
3541 /** Every `.empty` block in a page, whole: matched by div depth, so a nested
3642 * div in the part never cuts it short. */
@@ -95,3 +101,29 @@ test("each list's one link says its own next step, in one sentence", async () =>
95101 expect(b).not.toContain("Tell the crew");
96102 expect((b!.match(/<p\b/g) ?? []).length).toBe(1);
97103 });
104
outdated

Trailing comment glued to the end of the pages line; put it on its own line above.

105 test("the five lists take their empty sentence from one table, each with a single link", async () => {
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: "/asks", runs: "/root/fresh/runs", apps: "/apps" };
108 for (const [kind, path] of Object.entries(pages)) {
109 const w = EMPTY_WORDS[kind as keyof typeof EMPTY_WORDS];
110 const blocks = emptyBlocks(await (await fetch(servers.url + path, { headers: { cookie } })).text());
111 const mine = blocks.filter((b) => b.includes(w.sentence));
112 expect(mine.length).toBe(1);
113 // apps and board: the page already offers the door, so the empty state does not say it twice.
114 const once = kind === "apps" || kind === "board";
115 expect(links(mine[0]!).length).toBe(once ? 0 : 1);
116 if (!once) expect(links(mine[0]!)[0]!.endsWith(`|${w.label}`)).toBe(true);
117 expect(mine[0]).not.toContain('data-variant="primary"');
118 expect((mine[0]!.match(/<p\b/g) ?? []).length).toBe(1);
119 }
120 });
121
122 test("emptyList takes its link from the table unless the page names one, and can leave it out", () => {
123 expect(String(emptyList("apps"))).toContain('href="/apps/new"');
124 expect(String(emptyList("runs", { href: "/a/b/issues" }))).toContain('href="/a/b/issues"');
125 expect(String(emptyList("people", { noAction: true }))).not.toMatch(/<a\s/);
126 const people = String(emptyList("people"));
127 expect(people).toContain(EMPTY_WORDS.people.sentence);
128 expect(people.match(/<a\s/g)?.length).toBe(1);
129 });
test/tui-asked.test.ts +1 −1
@@ -118,7 +118,7 @@ describe("the asked screen", () => {
118118
119119 test("a guest sees nothing", async () => {
120120 const text = await screenText();
121 expect(text).toContain("Nothing asked yet");
121 expect(text).toContain("Nothing is waiting on you.");
122122 expect(text).not.toContain("make the lobby louder");
123123 expect(text).not.toContain("bob's private idea");
124124 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs