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

The owner's home fits a 375 px phone: KPI row, waiting line and timeline with no sideways scroll, shown by a look #5852

Closed opened this
Closed without merging

scout/forge:scout/5838-the-owner-s-home-fits-a-375-px-phone-kpi → main 3 commits fork 2 threads · 2 unresolved

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
4 files changed +80 −5
src/web/studio/feed.ts +2 −2
@@ -73,9 +73,9 @@ export function feedCard(
7373 const steer = item.kind === "run" || item.kind === "cost";
7474 const target = steer && RUN_LINK.test(item.link) ? `${item.link}/steer` : null;
7575 const head = html`${avatar(item.actor ?? item.app)}
76 <strong>${item.actor ?? item.app}</strong
76 <strong class="break">${item.actor ?? item.app}</strong
7777 >${nameMark(item.actor === null ? undefined : marks.get(item.actor))}
78 <span class="muted small">${item.app} · ${timeAgo(item.at)}</span>
78 <span class="muted small break">${item.app} · ${timeAgo(item.at)}</span>

The fix itself is fine: it reuses .break, the html template still escapes, and it adds no new class. Before this lands, show it in a 375 px look of the preview, before and after.

7979 ${settledBadge(item.settled)}
8080 <span class="spacer"></span>
8181 <span class="badge">${KIND_LABEL[item.kind]}</span>`;
test/helpers/chrome.ts +2 −2
@@ -202,7 +202,7 @@ export async function measurePageWidth(
202202 binary: string,
203203 url: string,
204204 viewport: { width: number; height: number },
205 cookie: { name: string; value: string },
205 cookie: { name: string; value: string } | { name: string; value: string }[],
206206 ): Promise<PageWidth> {
207207 const expression = `(() => {
208208 // documentElement.clientWidth, not window.innerWidth: after an
@@ -226,7 +226,7 @@ export async function measurePageWidth(
226226 });
227227 })()`;
228228 return JSON.parse(
229 await evaluateLoaded(binary, url, viewport, [cookie], expression),
229 await evaluateLoaded(binary, url, viewport, Array.isArray(cookie) ? cookie : [cookie], expression),
230230 ) as PageWidth;
231231 }
232232
test/home-phone.test.ts added +75
@@ -0,0 +1,75 @@
1 /**
2 * The owner's home fits a 375px phone (#5838): the KPI row, the waiting line
3 * and the timeline, with long repository names and a 120-character post, never
4 * scroll the page sideways and no element reaches past the viewport.
5 */
6
7 import { afterAll, beforeAll, describe, expect, test } from "bun:test";
8 import { mkdtemp, rm } from "node:fs/promises";
9 import { tmpdir } from "node:os";
10 import { join } from "node:path";
11 import { openIssue } from "../src/actions/issues.ts";
12 import { createRepo } from "../src/actions/repos.ts";
13 import { createApp, type App } from "../src/app.ts";
14 import { createSession } from "../src/core/sessions.ts";
15 import { createUser } from "../src/core/users.ts";
16 import { serve, type Servers } from "../src/http/server.ts";
17 import { findChromium } from "../src/looks/capture.ts";
18 import { chromiumRuns, measurePageWidth } from "./helpers/chrome.ts";
19 import { quietLogs } from "./helpers/globals.ts";
20 import { promote } from "./helpers/members.ts";
21
22 quietLogs();
23
24 const found = findChromium();
25 const chromium = found !== undefined && chromiumRuns(found) ? found : undefined;
26 if (chromium === undefined) console.log("SKIPPING: no chromium that starts on this machine, so the home phone-width test cannot run");
27
28 describe.skipIf(chromium === undefined)("the owner's home on a 375px phone", () => {
29 let dataDir: string;
30 let app: App;
31 let servers: Servers;
32 let cookies: { name: string; value: string }[] = [];
33
34 beforeAll(async () => {
35 dataDir = await mkdtemp(join(tmpdir(), "forge-home-phone-"));
36 app = createApp({ dataDir, port: 0 });
37 servers = await serve(app);
38 const made = await createUser(app.db, {
39 origin: "seed",
40 trusted: true,
41 username: "keeper",
42 email: "[email protected]",
43 password: "a-good-passphrase",
44 adminIfFirst: true,
45 });
46 if (!made.ok) throw new Error(made.error);
47 promote(app.db, made.value);
48 const admin = made.value;
49 cookies = [
50 { name: "forge_session", value: createSession(app.db, admin.id).token },
51 { name: "forge_mode", value: "studio" },
52 ];
53 for (const name of ["a-very-long-repository-name-that-keeps-going-and-going-and-going", "x".repeat(90), "short"]) {
54 const repo = await createRepo(app, admin, { name, visibility: "public" });
55 if (!repo.ok) throw new Error(`repo ${name}`);
56 const post = openIssue(app, admin, repo.value, {
57 title: `${"A post that runs long, ".repeat(6)}`.slice(0, 120),
58 body: "w".repeat(200),
59 });
60 if (!post.ok) throw new Error(`issue ${name}`);
61 }
62 }, 30_000);
63
64 afterAll(async () => {
65 servers.stop();
66 app.close();
67 await rm(dataDir, { recursive: true, force: true });
68 });
69
70 test("no sideways scroll and no element wider than the viewport", async () => {
71 const page = await measurePageWidth(chromium!, `${servers.url}/`, { width: 375, height: 812 }, cookies);

This test has only ever been skipped (no Chromium on the builder's machine or in mine), and the check log for this head doesn't name it. Show it passing at this head and failing with the feed.ts change reverted, or it proves nothing about the fix.

72 expect(page.overflowing).toEqual([]);
73 expect(page.scrollWidth).toBeLessThanOrEqual(375);
74 }, 30_000);
75 });
test/home-walk.test.ts +1 −1
@@ -93,7 +93,7 @@ test("composer, timeline, a tell, a crew member's run and pull, a share, the app
9393 });
9494 const page = await home(alice);
9595 expect(page).toContain("Sorted the seed list");
96 expect(page).toMatch(/<strong>scribe<\/strong\s*>\s*<span[^>]*data-mark="crew"/);
96 expect(page).toMatch(/<strong[^>]*>scribe<\/strong\s*>\s*<span[^>]*data-mark="crew"/);
9797 expect(page).toContain("opened a pull request");
9898
9999 // A share reaches another person as a post that says who shared it.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs