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

A new forge's empty feed says what will appear here and offers the one tell box #14728

opened this

Check · Review · Land · Live — Its check is queued. Next: reviewer, no review yet.

Ready to land

scout/forge:scout/14725-a-new-forge-s-empty-feed-says-what-will → main 4 commits fork

This pull asks to reach lab--forge-trevato-apps.open-platform.sh. Its preview and check reach what main reaches; the new host opens when the pull lands.

Review

Sign in to review this change.
6 files changed +23 −11
docs/design/areas/feed.md +4
@@ -7,3 +7,7 @@
77 - `.like` — the Like form under a post, drawn by `likeBar` in `src/web/studio/feed.ts`: an inline form around one §5 ghost `.btn` (`aria-pressed` is the only state signal; the label is always "Like"). Its count `[data-likes]` is `inline-block` at `min-width: 3ch`, right-aligned with tabular numerals, so going from 9 to 10 or pressing moves nothing. Styled in `src/web/studio/feed_style.ts`.
88 - `.new-posts` — the "N new posts" button's slot above the home timeline, drawn by `feedNote` in `src/web/studio/feed.ts`: a `role="status"` `aria-live="polite"` paragraph, sticky under the topbar, zero-high while its button is `hidden`, so nothing shifts when it appears. The button is a §5 primary small `.btn` at 44 px; its text is its accessible name and carries the count. Pressing it swaps the held feed, scrolls to the top instantly and moves focus to `#live-feed`. Styled in `src/web/studio/feed_style.ts`.
99 - `.feed-newer` — the "N newer posts" line in the feed head, drawn by `newerLine` in `src/web/studio/feed.ts`: a `role="status"` paragraph at a fixed 24 px that always exists, holding a plain `#live-feed` link that is `hidden` when nothing is newer, so showing it shifts nothing. Styled in `src/web/studio/feed_style.ts`.
10
11 ## Empty feed
12
13 `.feed-empty` wraps the one empty block of a feed with no posts. It holds the height of a first post so the post arriving moves nothing below it.
src/web/studio/feed.ts +4 −4
@@ -277,7 +277,7 @@ export function replyUnder(placement: Placement): Html {
277277 * /api/v1/feed/tells`, so it survives a dropped connection. Nothing to say
278278 * it to, and it is the way to make an app instead.
279279 */
280 export function composer(ctx: Ctx, user: User): Html {
280 export function composer(ctx: Ctx, user: User, focus = false): Html {
281281 const { repos } = writableAppsOf(ctx, user);
282282 const slug = (r: { ownerName: string; name: string }) => `${r.ownerName}/${r.name}`;
283283 const noApps = html`${empty({
@@ -294,7 +294,7 @@ export function composer(ctx: Ctx, user: User): Html {
294294 const form = html`<form id="composer" class="stack" method="post" action="/tell">
295295 <input type="hidden" name="${COMPOSER_FIELDS.back}" value="/feed" />
296296 ${shared === "" ? "" : html`<input type="hidden" name="${COMPOSER_FIELDS.once}" value="${shareToken(user.id, shared)}" />`}
297 <textarea class="input" name="${COMPOSER_FIELDS.text}" rows="2" maxlength="${String(TELL_MAX)}" required placeholder="Tell the crew what should change" aria-label="Tell the crew" aria-keyshortcuts="Control+Enter Meta+Enter" data-draft="${user.id}">${shared}</textarea>
297 <textarea class="input" name="${COMPOSER_FIELDS.text}" rows="2" maxlength="${String(TELL_MAX)}" required${focus ? " autofocus" : ""} placeholder="Tell the crew what should change" aria-label="Tell the crew" aria-keyshortcuts="Control+Enter Meta+Enter" data-draft="${user.id}">${shared}</textarea>
298298 <span class="muted small">${TELL_LIMIT_WORDS}</span>
299299 <div class="bar">
300300 ${repos.length === 0
@@ -485,7 +485,7 @@ function readRegion(user: User, ctx: Ctx) {
485485 }
486486
487487 /** The one line an empty timeline says; the tell box above it is the action. */
488 export const EMPTY_FEED = "Tell the crew; its work will show here.";
488 export const EMPTY_FEED = "Tell the crew what you want in the box above. What they make and finish will appear here, one post at a time.";
489489
490490 /** The region: cards, or one line saying there is nothing to do. */
491491 export function feedRegion(user: User, ctx: Ctx): Html {
@@ -559,7 +559,7 @@ function drawRegion(user: User, ctx: Ctx, read: ReturnType<typeof readRegion>):
559559 ${chipsBar(user, ctx, items)}
560560 ${thoughts.map((t) => thoughtCard(t, user.username, placed.get(t.id)))}
561561 ${items.length === 0 && thoughts.length === 0
562 ? empty({ title: EMPTY_FEED })
562 ? html`<div class="feed-empty" data-feed-empty>${empty({ title: EMPTY_FEED })}</div>`
563563 : posts}
564564 ${quiet === 0
565565 ? ""
src/web/studio/home.ts +1 −1
@@ -398,7 +398,7 @@ export async function feedPage(ctx: Ctx): Promise<Response> {
398398 ${await regionOf("asked")}
399399 <div class="split" data-rail="wide">
400400 <div class="stack">
401 ${composer(ctx, user)}
401 ${composer(ctx, user, feedRegion.text.includes("data-feed-empty"))}
402402 ${stalled}
403403 ${feedNote(newer)}
404404 ${feedRegion}
src/web/style/components.ts +3
@@ -1085,6 +1085,9 @@ html[data-overlay] { overflow: hidden; }
10851085 }
10861086 .empty p { font-size: 13px; max-width: 320px; text-wrap: pretty; margin: 0; }
10871087 .empty .btn { margin-top: 8px; }
1088 /* The empty feed holds the height of the first post, so it arriving moves nothing below. */
1089 .feed-empty { min-height: 140px; display: flex; flex-direction: column; justify-content: center; }
1090 .feed-empty .empty { padding: 24px; }
10881091
10891092 /* ---- board panel grid: a board's panels, on /boards and pinned in the studio ---- */
10901093 /* ---- the boards (pages/boards-view.ts, flow-panel.ts): the home's column, figures and tiles, and under them
test/feed-empty.test.ts +10 −5
@@ -11,6 +11,7 @@ import { createSession } from "../src/core/sessions.ts";
1111 import { openIssue } from "../src/actions/issues.ts";
1212 import { commitToBranch, createRepo } from "../src/actions/repos.ts";
1313 import { createUser, getUserByName } from "../src/core/users.ts";
14 import { EMPTY_FEED } from "../src/web/studio/feed.ts";
1415 import { serve, type Servers } from "../src/http/server.ts";
1516
1617 let dataDir: string;
@@ -39,17 +40,20 @@ test("an empty home says one sentence below the tell box, and the old line is go
3940 const page = await res.text();
4041 emptyPage = page;
4142 expect(res.status).toBe(200);
42 const sentence = page.indexOf("Tell the crew; its work will show here.");
43 const sentence = page.indexOf(EMPTY_FEED);
4344 expect(sentence).toBeGreaterThan(-1);
4445 const form = page.match(/<form id="composer"[\s\S]*?<\/form>/)!;
4546 expect(form[0]).toContain('action="/tell"');
4647 expect(form[0]).not.toContain("Nothing yet");
4748 expect(sentence).toBeGreaterThan(page.indexOf(form[0]) + form[0].length);
4849 expect(page).not.toContain("Nothing new");
49 expect(page).not.toContain("autofocus");
50 expect(page).toMatch(/<textarea[^>]*autofocus/);
51 expect(page).toContain("feed-empty");
52 expect(EMPTY_FEED).not.toMatch(/\b(run|pull|gate)s?\b/i);
53 expect(EMPTY_FEED.split(". ")).toHaveLength(2);
5054 });
5155
52 test("a feed with something in it keeps its cards: no sentence, no autofocus", async () => {
56 test("a feed with something in it keeps its cards: no sentence, no autofocus, no empty block", async () => {
5357 const user = getUserByName(app.db, "newbie")!;
5458 const made = await createRepo(app, user, { name: "game" });
5559 if (!made.ok) throw new Error(String(made.error));
@@ -58,8 +62,9 @@ test("a feed with something in it keeps its cards: no sentence, no autofocus", a
5862 if (!opened.ok) throw new Error(String(opened.error));
5963 const page = await (await fetch(`${servers.url}/feed`, { headers: { cookie } })).text();
6064 expect(page).toContain("make the jump higher");
61 expect(page).not.toContain("Tell the crew; its work will show here.");
65 expect(page).not.toContain(EMPTY_FEED);
6266 expect(page).not.toContain("autofocus");
67 expect(page).not.toContain("feed-empty");
6368 });
6469
6570 test("the first post arrives in the region below the tell box: nothing above the box changes", async () => {
@@ -70,7 +75,7 @@ test("the first post arrives in the region below the tell box: nothing above the
7075 expect(form).toBeGreaterThan(-1);
7176 expect(form).toBeLessThan(region);
7277 const end = page.indexOf("</section>", region);
73 return { above: page.slice(form, region).replace(/data-rendered="\d+"/g, "").replace(/(<p id="feed-newer"[^>]*>)<a [^>]*>[^<]*<\/a>/, "$1").replace(/<script[\s\S]*?<\/script>/g, ""), inside: page.slice(region, end) };
78 return { above: page.slice(form, region).replace(/data-rendered="\d+"/g, "").replace(" autofocus", "").replace(/(<p id="feed-newer"[^>]*>)<a [^>]*>[^<]*<\/a>/, "$1").replace(/<script[\s\S]*?<\/script>/g, ""), inside: page.slice(region, end) };
7479 };
7580 const before = split(emptyPage);
7681 expect(before.inside).toContain('class="empty"');
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("Tell the crew; its work will show here.");
47 expect(text).toContain("Tell the crew what you want in");
4848 expect(text).not.toContain("Nothing in the feed yet");
4949 app.stop();
5050 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs