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
Merged 16h 45m ago, live in production
talk-taps → main 0 commits 2 threads · 2 unresolved
2 files
changed +42
−3
src/web/pages/talk_preview.ts +6 −3
| @@ -236,11 +236,16 @@ function crewReply(href: string, who: string): Html { | ||
| 236 | 236 | |
| 237 | 237 | /** |
| 238 | 238 | * 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. | |
| 239 | 243 | */ |
| 240 | 244 | export const paneCss = /* css */ ` |
| 241 | 245 | .talk-pane-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; margin-bottom: 8px; } |
| 242 | 246 | .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; } | |
| 244 | 249 | .talk-stage { position: relative; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--card); } |
| 245 | 250 | .talk-frame { display: block; width: 100%; height: calc(100dvh - 14rem); min-height: 24rem; border: 0; transition: opacity var(--dur-3) var(--ease); } |
| 246 | 251 | .talk-stage[data-busy] .talk-frame { opacity: .35; } |
| @@ -266,7 +271,6 @@ export const paneCss = /* css */ ` | ||
| 266 | 271 | .talk-crew-reply textarea { flex: 1; min-height: 2.75rem; resize: vertical; } |
| 267 | 272 | @media (prefers-reduced-motion: reduce) { .talk-crew-fold > summary::before { transition: none; } } |
| 268 | 273 | .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. */ | |
| 270 | 274 | .talk-stage:has(+ .talk-crew-now:not(:empty):not(:has(> .talk-crew-fold:not([open])))) .talk-frame { height: calc(100dvh - 30rem); min-height: 14rem; } |
| 271 | 275 | .talk-addr-pick { display: flex; align-items: center; gap: 4px; padding: 2px 4px; overflow: visible; } |
| 272 | 276 | .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 */ ` | ||
| 278 | 282 | @media (forced-colors: active) { .talk-addr-pick :is(select, input):focus-visible { outline: 2px solid CanvasText; } } |
| 279 | 283 | :root.js .talk-addr-go { display: none; } |
| 280 | 284 | .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. */ | |
| 282 | 285 | @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; } } |
| 283 | 286 | @media (prefers-reduced-motion: reduce) { .talk-frame { transition: none; } } |
| 284 | 287 | `; |
test/talk-layout.test.ts +36
| @@ -14,6 +14,11 @@ import { createApp, type App } from "../src/app.ts"; | ||
| 14 | 14 | import { appendTurn, openConversation } from "../src/core/conversations.ts"; |
| 15 | 15 | import { createSession } from "../src/core/sessions.ts"; |
| 16 | 16 | 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"; | |
| 17 | 22 | import { findChromium } from "../src/looks/capture.ts"; |
| 18 | 23 | import { serve, type Servers } from "../src/http/server.ts"; |
| 19 | 24 | import { chromiumRuns, evaluateLoaded } from "./helpers/chrome.ts"; |
| @@ -34,6 +39,7 @@ let app: App; | ||
| 34 | 39 | let servers: Servers; |
| 35 | 40 | let token: string; |
| 36 | 41 | let emptyToken: string; |
| 42 | let paneToken: string; | |
| 37 | 43 | |
| 38 | 44 | beforeAll(async () => { |
| 39 | 45 | dir = await mkdtemp(join(tmpdir(), "forge-talk-layout-")); |
| @@ -55,6 +61,23 @@ beforeAll(async () => { | ||
| 55 | 61 | if (!fresh.ok) throw new Error(fresh.error); |
| 56 | 62 | promote(app.db, fresh.value); |
| 57 | 63 | 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; | |
| 58 | 81 | }, 30_000); |
| 59 | 82 | afterAll(async () => { |
| 60 | 83 | servers.stop(); |
| @@ -176,3 +199,16 @@ for (const [w, h, name] of [[390, 844, "a phone"], [900, 1100, "a tablet"], [128 | ||
| 176 | 199 | expect(s.compose!.bottom).toBeLessThan(s.vh * 0.85); |
| 177 | 200 | }, 30_000); |
| 178 | 201 | } |
| 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`, | |
| 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]); | |
| 213 | for (const h of [...seen.tabs, ...seen.dev, ...seen.send]) expect(h).toBeGreaterThanOrEqual(44); | |
| 214 | }, 30_000); |
new above
offline
Tabs only. Also measure
.talk-dev-form .btnand.talk-crew-reply .btn, or the change they were lifted in has no test.