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

Talk: the Preview pane's tabs, its dev server button and its reply Send are 44 px where a thumb taps #17520

opened this

Merged 16h 45m ago, live in production

talk-taps → main 0 commits 2 threads · 2 unresolved

  • Merged. talk-taps was merged into main as c31ba9c.

Review

Sign in to review this change.
2 files changed +42 −3
src/web/pages/talk_preview.ts +6 −3
@@ -236,11 +236,16 @@ function crewReply(href: string, who: string): Html {
236236
237237 /**
238238 * The pane's own styles, sent only on a page that draws one (`data-split`). Spacing is the scale.
239 * Notes stay here, not in the stylesheet, where they would ride every Talk page as bytes: every
240 * pane control is 44 px tall (a mouse loses nothing to a taller tab); while the crew works under
241 * the frame, the frame gives it room, so both are in view at once; on a phone the switcher takes a
242 * row of its own under the tabs, each picker a share of it.
239243 */
240244 export const paneCss = /* css */ `
241245 .talk-pane-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; margin-bottom: 8px; }
242246 .talk-addr { flex: 1; min-width: 0; padding: 6px 12px; border-radius: 999px; background: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
243 .talk-pane-bar .btn-icon { min-width: 2.75rem; min-height: 2.75rem; }
247 .talk-pane-bar .btn-icon { min-width: 2.75rem; }
248 .talk-pane-bar :is(.btn-icon, .seg > a, form .btn), .talk-crew-reply .btn { min-height: 2.75rem; }
244249 .talk-stage { position: relative; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--card); }
245250 .talk-frame { display: block; width: 100%; height: calc(100dvh - 14rem); min-height: 24rem; border: 0; transition: opacity var(--dur-3) var(--ease); }
246251 .talk-stage[data-busy] .talk-frame { opacity: .35; }
@@ -266,7 +271,6 @@ export const paneCss = /* css */ `
266271 .talk-crew-reply textarea { flex: 1; min-height: 2.75rem; resize: vertical; }
267272 @media (prefers-reduced-motion: reduce) { .talk-crew-fold > summary::before { transition: none; } }
268273 .talk-stage:not(.talk-stage-wait) + .talk-crew-now { margin-top: 12px; }
269 /* While the crew works under it, the frame gives it room: both in view at once. */
270274 .talk-stage:has(+ .talk-crew-now:not(:empty):not(:has(> .talk-crew-fold:not([open])))) .talk-frame { height: calc(100dvh - 30rem); min-height: 14rem; }
271275 .talk-addr-pick { display: flex; align-items: center; gap: 4px; padding: 2px 4px; overflow: visible; }
272276 .talk-addr-pick select, .talk-addr-pick input { min-width: 0; min-height: 2.75rem; border: 0; border-radius: 999px; background: transparent; color: var(--fg); font: inherit; padding: 0 8px; }
@@ -278,7 +282,6 @@ export const paneCss = /* css */ `
278282 @media (forced-colors: active) { .talk-addr-pick :is(select, input):focus-visible { outline: 2px solid CanvasText; } }
279283 :root.js .talk-addr-go { display: none; }
280284 .talk-pane-info, .talk-pane-fell, .talk-pane-loop { margin: 0 0 8px; overflow-wrap: anywhere; }
281 /* On a phone the switcher takes a row of its own under the tabs, each picker a share of it. */
282285 @media (max-width: 30rem) { .talk-addr:not(.talk-addr-pick) { display: none; } .talk-addr-pick { order: 1; flex-basis: 100%; } .talk-addr-pick select { flex: 1; max-width: none; } .talk-addr-pick input { flex: 0 1 6rem; } }
283286 @media (prefers-reduced-motion: reduce) { .talk-frame { transition: none; } }
284287 `;
test/talk-layout.test.ts +36
@@ -14,6 +14,11 @@ import { createApp, type App } from "../src/app.ts";
1414 import { appendTurn, openConversation } from "../src/core/conversations.ts";
1515 import { createSession } from "../src/core/sessions.ts";
1616 import { createUser } from "../src/core/users.ts";
17 import { createRepo } from "../src/actions/repos.ts";
18 import { createRun } from "../src/core/runs.ts";
19 import { createApp as createAppRecord } from "../src/core/apps.ts";
20 import { createIssue } from "../src/core/issues.ts";
21 import { startChatBuild } from "../src/core/chat_build.ts";
1722 import { findChromium } from "../src/looks/capture.ts";
1823 import { serve, type Servers } from "../src/http/server.ts";
1924 import { chromiumRuns, evaluateLoaded } from "./helpers/chrome.ts";
@@ -34,6 +39,7 @@ let app: App;
3439 let servers: Servers;
3540 let token: string;
3641 let emptyToken: string;
42 let paneToken: string;
3743
3844 beforeAll(async () => {
3945 dir = await mkdtemp(join(tmpdir(), "forge-talk-layout-"));
@@ -55,6 +61,23 @@ beforeAll(async () => {
5561 if (!fresh.ok) throw new Error(fresh.error);
5662 promote(app.db, fresh.value);
5763 emptyToken = createSession(app.db, fresh.value.id).token;
64 // A person whose conversation builds on their own repository (its talk branch): the pane draws
65 // its bar.
66 const carol = await createUser(app.db, { origin: "seed", trusted: true, username: "carol", email: "[email protected]", password: "a-good-passphrase" });
67 if (!carol.ok) throw new Error(carol.error);
68 promote(app.db, carol.value);
69 const site = await createRepo(app, carol.value, { name: "site", visibility: "public" });
70 if (!site.ok) throw new Error(String(site.error));
71 const hers = openConversation(app.db, carol.value.id);
72 appendTurn(app.db, carol.value.id, hers.id, { role: "person", text: "show me my site" });
73 startChatBuild(app.db, hers.id, site.value.id);
74 appendTurn(app.db, carol.value.id, hers.id, { role: "agent", text: "Here it is." });
75 // A crew run queued on it, so the pane is open beside the chat.
76 createAppRecord(app.db, { repoId: site.value.id, slug: "site", access: "private" });
77 const issue = createIssue(app.db, { repoId: site.value.id, authorId: carol.value.id, title: "A footer", body: "b" });
78 if (!issue.ok) throw new Error(issue.error);
79 createRun(app.db, { repoId: site.value.id, kind: "agent", reason: "assigned", issueId: issue.value.id });
80 paneToken = createSession(app.db, carol.value.id).token;
5881 }, 30_000);
5982 afterAll(async () => {
6083 servers.stop();
@@ -176,3 +199,16 @@ for (const [w, h, name] of [[390, 844, "a phone"], [900, 1100, "a tablet"], [128
176199 expect(s.compose!.bottom).toBeLessThan(s.vh * 0.85);
177200 }, 30_000);
178201 }
202
203 test.skipIf(chromium === undefined)("on a phone the Preview pane's tabs, its dev server button and the crew reply's Send are each 44 px tall", async () => {
204 measured = await evaluateLoaded(
205 chromium!,
206 `${servers.url}/talk?pane=preview`,
outdated

Tabs only. Also measure .talk-dev-form .btn and .talk-crew-reply .btn, or the change they were lifted in has no test.

207 { width: 390, height: 844 },
208 [{ name: "forge_session", value: paneToken }],
209 `(() => { const tall = (sel) => [...document.querySelectorAll(sel)].map((e) => Math.round(e.getBoundingClientRect().height)); return JSON.stringify({ tabs: tall(".talk-pane-bar .seg > a"), dev: tall(".talk-dev-form .btn"), send: tall(".talk-crew-reply .btn") }); })()`,
210 );
211 const seen = JSON.parse(measured) as { tabs: number[]; dev: number[]; send: number[] };
212 expect([seen.tabs.length, seen.dev.length, seen.send.length]).toEqual([3, 1, 1]);
outdated

Unrelated to this change: it covers the dock and sticky footer, which this diff does not touch, and it would pass without the CSS change. Remove it.

213 for (const h of [...seen.tabs, ...seen.dev, ...seen.send]) expect(h).toBeGreaterThanOrEqual(44);
214 }, 30_000);

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs