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
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/13401-a-signed-in-feed-with-nothing-in-it-says → main 2 commits fork 1 thread · 1 unresolved
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), | ||
| 46 | 46 | |
| 47 | 47 | ## An empty timeline |
| 48 | 48 | |
| 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) { | ||
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | /** 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."; | |
| 425 | 425 | |
| 426 | 426 | /** The region: cards, or one line saying there is nothing to do. */ |
| 427 | 427 | 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 | */ | |
| 2 | 5 | import { afterAll, beforeAll, expect, test } from "bun:test"; |
| 3 | 6 | import { mkdtemp, rm } from "node:fs/promises"; |
| 4 | 7 | import { tmpdir } from "node:os"; |
| @@ -14,6 +17,7 @@ let dataDir: string; | ||
| 14 | 17 | let app: App; |
| 15 | 18 | let servers: Servers; |
| 16 | 19 | let cookie: string; |
| 20 | let emptyPage = ""; | |
| 17 | 21 | |
| 18 | 22 | beforeAll(async () => { |
| 19 | 23 | dataDir = await mkdtemp(join(tmpdir(), "forge-feed-empty-")); |
| @@ -33,8 +37,9 @@ afterAll(async () => { | ||
| 33 | 37 | test("an empty home says one sentence below the tell box, and the old line is gone", async () => { |
| 34 | 38 | const res = await fetch(`${servers.url}/feed`, { headers: { cookie } }); |
| 35 | 39 | const page = await res.text(); |
| 40 | emptyPage = page; | |
| 36 | 41 | 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."); | |
| 38 | 43 | expect(sentence).toBeGreaterThan(-1); |
| 39 | 44 | const form = page.match(/<form id="composer"[\s\S]*?<\/form>/)!; |
| 40 | 45 | 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 | ||
| 53 | 58 | if (!opened.ok) throw new Error(String(opened.error)); |
| 54 | 59 | const page = await (await fetch(`${servers.url}/feed`, { headers: { cookie } })).text(); |
| 55 | 60 | 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."); | |
| 57 | 62 | expect(page).not.toContain("autofocus"); |
| 58 | 63 | }); |
| 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 () => { | ||
| 44 | 44 | await key("k", true); |
| 45 | 45 | for (const k of [..."Feed", "enter"]) await key(k); |
| 46 | 46 | 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."); | |
| 48 | 48 | expect(text).not.toContain("Nothing in the feed yet"); |
| 49 | 49 | app.stop(); |
| 50 | 50 | }); |
new above
offline
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).