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

A signed-in feed with nothing in it says what will fill it and offers one tell #13417

Merged opened this

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

Merged

scout/forge:scout/13401-a-signed-in-feed-with-nothing-in-it-says → main 2 commits fork 1 thread · 1 unresolved

  • Merged. scout/13401-a-signed-in-feed-with-nothing-in-it-says was merged into main as afb9488.

Review

Sign in to review this change.
4 files changed +30 −6
docs/features/home-frame.md +1 −1
@@ -46,4 +46,4 @@ time after a write under 50 ms; first response under 100 KB uncompressed),
4646
4747 ## An empty timeline
4848
49 A signed-in person whose timeline has nothing in it sees one line under the tell box, the named `empty` component with a title only: "Nothing yet. Tell the crew what to build." (`EMPTY_FEED`, `src/web/studio/feed.ts`). The tell box is already first on the page, so no field steals focus (a phone keyboard would cover the sentence). The terminal's Feed screen draws the same constant.
49 A signed-in person whose timeline has nothing in it sees one line under the tell box, the named `empty` component with a title only: "Tell the crew; its work will show here." (`EMPTY_FEED`, `src/web/studio/feed.ts`). The tell box is already first on the page, so no field steals focus (a phone keyboard would cover the sentence). The terminal's Feed screen draws the same constant.
src/web/studio/feed.ts +1 −1
@@ -421,7 +421,7 @@ function readRegion(user: User, ctx: Ctx) {
421421 }
422422
423423 /** The one line an empty timeline says; the tell box above it is the action. */
424 export const EMPTY_FEED = "Nothing yet. Tell the crew what to build.";
424 export const EMPTY_FEED = "Tell the crew; its work will show here.";

Principle 1/8: the sentence is fine, but the issue also asked for no layout shift when the first item arrives and this head neither tests nor guarantees it. Add the guarantee and a test (see review body).

425425
426426 /** The region: cards, or one line saying there is nothing to do. */
427427 export function feedRegion(user: User, ctx: Ctx): Html {
test/feed-empty-prompt.test.ts → test/feed-empty.test.ts renamed +27 −3
@@ -1,4 +1,7 @@
1 /** A signed-in person with an empty timeline sees one sentence and a tell box ready to type in, in the first paint. */
1 /**
2 * A signed-in person with an empty timeline sees one sentence and a tell box ready to type in, in
3 * the first paint.
4 */
25 import { afterAll, beforeAll, expect, test } from "bun:test";
36 import { mkdtemp, rm } from "node:fs/promises";
47 import { tmpdir } from "node:os";
@@ -14,6 +17,7 @@ let dataDir: string;
1417 let app: App;
1518 let servers: Servers;
1619 let cookie: string;
20 let emptyPage = "";
1721
1822 beforeAll(async () => {
1923 dataDir = await mkdtemp(join(tmpdir(), "forge-feed-empty-"));
@@ -33,8 +37,9 @@ afterAll(async () => {
3337 test("an empty home says one sentence below the tell box, and the old line is gone", async () => {
3438 const res = await fetch(`${servers.url}/feed`, { headers: { cookie } });
3539 const page = await res.text();
40 emptyPage = page;
3641 expect(res.status).toBe(200);
37 const sentence = page.indexOf("Nothing yet. Tell the crew what to build.");
42 const sentence = page.indexOf("Tell the crew; its work will show here.");
3843 expect(sentence).toBeGreaterThan(-1);
3944 const form = page.match(/<form id="composer"[\s\S]*?<\/form>/)!;
4045 expect(form[0]).toContain('action="/tell"');
@@ -53,6 +58,25 @@ test("a feed with something in it keeps its cards: no sentence, no autofocus", a
5358 if (!opened.ok) throw new Error(String(opened.error));
5459 const page = await (await fetch(`${servers.url}/feed`, { headers: { cookie } })).text();
5560 expect(page).toContain("make the jump higher");
56 expect(page).not.toContain("Nothing yet. Tell the crew what to build.");
61 expect(page).not.toContain("Tell the crew; its work will show here.");
5762 expect(page).not.toContain("autofocus");
5863 });
64
65 test("the first post arrives in the region below the tell box: nothing above the box changes", async () => {
66 const split = (page: string) => {
67 const region = page.search(/<section[^>]*id="live-feed"/);
68 expect(region).toBeGreaterThan(-1);
69 const form = page.indexOf('<form id="composer"');
70 expect(form).toBeGreaterThan(-1);
71 expect(form).toBeLessThan(region);
72 const end = page.indexOf("</section>", region);
73 return { above: page.slice(form, region).replace(/data-rendered="\d+"/g, "").replace(/<script[\s\S]*?<\/script>/g, ""), inside: page.slice(region, end) };
74 };
75 const before = split(emptyPage);
76 expect(before.inside).toContain('class="empty"');
77 const after = split(await (await fetch(`${servers.url}/feed`, { headers: { cookie } })).text());
78 expect(after.inside).toContain("make the jump higher");
79 expect(after.inside).not.toContain('class="empty"');
80 // Same markup above the region in both states: the box and everything before it stay put.
81 expect(after.above).toBe(before.above);
82 });
test/tui-feed-empty.test.ts +1 −1
@@ -44,7 +44,7 @@ test("an empty feed says the page's line", async () => {
4444 await key("k", true);
4545 for (const k of [..."Feed", "enter"]) await key(k);
4646 const text = app.screen.toText();
47 expect(text).toContain("Nothing yet. Tell the crew what to build.");
47 expect(text).toContain("Tell the crew; its work will show here.");
4848 expect(text).not.toContain("Nothing in the feed yet");
4949 app.stop();
5050 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs