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

The home's "waiting on you" line wraps on a narrow screen and its action stays tappable #6253

Parked opened this
Closed without merging

scout/forge:scout/6068-the-home-s-waiting-on-you-line-wraps-on → main 1 commit fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
3 files changed +22 −7
src/web/studio/home_cache.ts +2 −1
@@ -21,10 +21,11 @@ const panelCaches = new WeakMap<Database, Stamped<Answer>>();
2121 const vitalsCaches = new WeakMap<Database, Stamped<Vitals>>();
2222 const waitingCaches = new WeakMap<Database, Stamped<Waiting>>();
2323
24 /** What the waiting line keeps of the viewer's asks: how many, and the oldest's time. */
24 /** What the waiting line keeps of the viewer's asks: how many, and the oldest's time and title. */
2525 export interface Waiting {
2626 readonly count: number;
2727 readonly oldest: string | null;
28 readonly oldestTitle: string | null;
2829 }
2930
3031 function cacheOf<V>(into: WeakMap<Database, Stamped<V>>, db: Database, maxEntries: number): Stamped<V> {
src/web/studio/kpi_row.ts +8 −3
@@ -173,16 +173,21 @@ export function kpiRow(db: Database, opts: { ceilingUsd?: number; dataDir?: stri
173173 * (the very rows /review lists) and how long the oldest has. Empty at zero.
174174 */
175175 export function waitingLine(db: Database, user: User, now: Date = new Date()): Html {
176 const { count, oldest } = cachedWaiting(db, user.id, () => {
176 const { count, oldest, oldestTitle } = cachedWaiting(db, user.id, () => {
177177 const repos = listReposVisibleTo(db, user, { limit: 200, withoutArchived: true });
178178 const asks = waitingOn(db, user, repos);
179 const first = asks.reduce<(typeof asks)[number] | null>((o, a) => (o === null || Date.parse(a.since) < Date.parse(o.since) ? a : o), null);
179180 return {
180181 count: asks.length,
181 oldest: asks.reduce<string | null>((o, a) => (o === null || Date.parse(a.since) < Date.parse(o) ? a.since : o), null),
182 oldest: first?.since ?? null,
183 oldestTitle: first === null ? null : (first.pull?.title ?? first.issue?.title ?? first.proposal?.title ?? null),
182184 };
183185 });
184186 const words = waitingWords(count, oldest, now);
185 return words === null ? html`` : html`<p class="small muted"><a href="/review">${words}</a></p>`;
187 if (words === null) return html``;
188 // The title is a person's text with no promise of spaces: `.break` lets it wrap; `.stack` puts the link on its own line.
189 const title = oldestTitle === null ? html`` : html`: ${oldestTitle}`;
190 return html`<p class="small muted break stack stack-tight"><span>${words}${title}</span><a href="/review">Review them</a></p>`;
186191 }
187192
188193 /** Home's flow vitals for an admin (#5935): one muted line of counts; the open count links to the boards. */
test/home-kpi-row.test.ts +12 −3
@@ -351,7 +351,7 @@ describe("home waiting line", () => {
351351 expect(waitingWords(1, "2026-10-21T11:40:00.000Z", now)).toBe("1 waiting on you, oldest under 1 h");
352352 });
353353
354 async function homeWith(stale: number[]): Promise<string> {
354 async function homeWith(stale: number[], title?: string): Promise<string> {
355355 const root = mkdtempSync(join(tmpdir(), "forge-home-wait-"));
356356 const app = createApp({ dataDir: root, port: 0 });
357357 const servers = await serve(app);
@@ -365,7 +365,7 @@ describe("home waiting line", () => {
365365 const number = app.db.query<{ issue_seq: number }, [string]>("UPDATE repo SET issue_seq = issue_seq + 1 WHERE id = ?1 RETURNING issue_seq").get(repo.value.id)!.issue_seq;
366366 app.db
367367 .query(`INSERT INTO issue (id, repo_id, number, kind, title, body, author_id, state, created_at) VALUES (?1, ?2, ?3, 'pull', ?4, '', ?5, 'open', ?6)`)
368 .run(issueId, repo.value.id, number, `Stale ${i}`, made.value.id, new Date(Date.now() - h * 3_600_000).toISOString());
368 .run(issueId, repo.value.id, number, title ?? `Stale ${i}`, made.value.id, new Date(Date.now() - h * 3_600_000).toISOString());
369369 app.db
370370 .query(`INSERT INTO pull (issue_id, base_branch, head_branch, base_oid, head_oid, head_repo_id) VALUES (?1, 'main', ?2, ?3, ?3, ?4)`)
371371 .run(issueId, `b/${i}`, "0".repeat(40), repo.value.id);
@@ -389,7 +389,16 @@ describe("home waiting line", () => {
389389
390390 test("three asks show one line linking to /review", async () => {
391391 const body = await homeWith([30, 40, 50]);
392 expect(body).toMatch(/<p class="small muted"><a href="\/review">3 waiting on you, oldest 5\d h<\/a><\/p>/);
392 expect(body).toMatch(/<p class="small muted break stack stack-tight"><span>3 waiting on you, oldest 5\d h: Stale \d<\/span><a href="\/review">Review them<\/a><\/p>/);
393 }, 30_000);
394
395 test("a 120-character title with no spaces sits in a line that breaks, the link below it", async () => {
396 const long = "x".repeat(120);
397 const body = await homeWith([30], long);
398 const line = body.slice(body.indexOf('<p class="small muted break'), body.indexOf("Review them</a></p>"));
399 expect(line).toContain(long);
400 expect(line).toMatch(/^<p class="[^"]*\bbreak\b[^"]*\bstack\b/);
401 expect(line).toContain('</span><a href="/review">');
393402 }, 30_000);
394403
395404 test("with none, the line is absent", async () => {

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs