Public: anyone can read this; the crew can change it.
Talk opens in a new layout shell, conversations beside the thread, with no horizontal scroll from 360 to 2560 px #15843
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/15813-talk-opens-in-a-new-layout-shell-convers → main 0 commits fork 9 threads · 9 unresolved
docs/design/areas/talk.md +9 −1
| @@ -54,4 +54,12 @@ Search (#8823) adds no component class: the form is a `.bar` with `.input` and ` | ||
| 54 | 54 | |
| 55 | 55 | On a phone the conversations nav is pinned under the topbar (#14943): New stays in view, and `.talk-list` folds the search and the list under a "Conversations" summary. |
| 56 | 56 | |
| 57 | - `.talk-page` (#15734): the one wrapper around the build box and the shell. From 48rem up it is a column the height of the screen less the topbar; the shell takes what the box leaves, so the composer is on screen on a first visit. | |
| 57 | #15813: the new shell. The conversations sit beside the thread from 900 px (56.25rem); below that the thread is alone and the list is one tap away. Nothing scrolls sideways from 360 to 2560 px; the thread's reading width is 72ch, centred. | |
| 58 | ||
| 59 | - `.talk-side` / `.talk-chats` — the list column. Prior art: Slack's sidebar and Linear's list, which keep the list steady while the work changes. | |
| 60 | - `.talk-here` — the head of the thread (name, Rename, Pin, Archive), inside the thread. Prior art: iMessage's conversation header. | |
| 61 | - `.talk-back` — the "Chats" link, first of the `.talk-tabs` so it is there from the chat and the preview alike, drawn only below 900 px (56.25rem); it opens `?chats=1`, the list alone (`data-view="list"` on the shell). Prior art: iMessage's back to Messages on a phone. | |
| 62 | - `.talk` — the thread: its children are capped at 72ch and centred, so wide screens keep a readable line. Prior art: Claude and ChatGPT's centred column. | |
| 63 | - `.talk-compose` — stays sticky at the bottom of the thread at every size. Prior art: ChatGPT and Claude's composer docked under the reading column. | |
| 64 | ||
| 65 | - `.talk-page` (#15734): the one wrapper around the build box and the shell. From 900 px (56.25rem) up it is a column the height of the screen less the topbar; the shell takes what the box leaves, so the composer is on screen on a first visit. |
docs/features/talk-conversation-list.md +4
| @@ -12,3 +12,7 @@ In the terminal, `ssh` in and open Talk: the conversations list shows the same l | ||
| 12 | 12 | |
| 13 | 13 | Both doors take the counts from one grouped query (`conversationActivity` in `src/core/conversations.ts`), however |
| 14 | 14 | many conversations are listed. |
| 15 | ||
| 16 | ## Layout (#15813) | |
| 17 | ||
Wrong breakpoint: "From 48rem the list sits beside the thread". It is 56.25rem (900 px); between 48rem and 900 px the thread is alone with a Chats link. Fix the number. |
||
| 18 | From 900 px (56.25rem) the list sits beside the thread; below that the thread is alone and the tabs above it read **Chats · Chat · Preview**: Chats opens `/talk?chats=1`, the list alone, from the chat or the preview. The thread's reading width is 72ch, centred. The terminal's talk screen is unchanged: the same conversations, no layout. |
docs/features/talk-layout.md +3 −3
| @@ -6,8 +6,8 @@ row: Talk's layout at every screen size | ||
| 6 | 6 | |
| 7 | 7 | `/talk` is one shell in `src/web/pages/talk_client.ts` (`talkCss`) with three breakpoints, checked by `test/talk-layout.test.ts` in a real Chromium at 360, 820, 1280 and 2560 px, and for an empty conversation at 820 and 1280 (#15734). That test skips where no Chromium starts, so the numbers have not yet been seen; the forge's check is where they run. The terminal shows the same conversations in `src/tui/screens/talk_chats.ts`, with no shell around them. |
| 8 | 8 | |
| 9 | - **Phone, under 48rem:** the chat alone, the composer pinned above the keyboard (`--kb`), the chat list folded into one line, Chat/Preview as tabs. | |
| 10 | - **Tablet, 48rem up:** chats beside the chat, each scrolling on its own. The page is one column of the build box (an empty conversation) and the shell; the shell takes the height left, so the composer is on screen with or without the box. | |
| 9 | - **Phone, under 56.25rem (900 px):** the chat alone, the composer pinned above the keyboard (`--kb`), Chats/Chat/Preview as tabs; Chats opens the list alone (`?chats=1`). | |
| 10 | - **Tablet, 56.25rem up:** chats beside the chat, each scrolling on its own. The page is one column of the build box (an empty conversation) and the shell; the shell takes the height left, so the composer is on screen with or without the box. | |
| 11 | 11 | - **Laptop, 80rem up:** chats, chat and preview side by side, no tabs. |
| 12 | 12 | - **Wide, 120rem up:** the reading column stops at 56rem; the preview takes the room. |
| 13 | 13 | |
| @@ -17,4 +17,4 @@ Prior art each choice borrows from: | ||
| 17 | 17 | - The composer that stays put while the log scrolls: every one of them; here it is sticky inside the column, not the page. |
| 18 | 18 | - Preview beside the chat as a third column: Claude's artifacts pane; Linear's detail pane for a list-and-detail layout. |
| 19 | 19 | |
| 20 | Later pulls in #15734 take the log's scroll behaviour (the log scrolls in its own column from 48rem up, so following a growing reply needs the column's scroll, not the window's), the keyboard shortcuts, and code blocks and attachments. | |
| 20 | Later pulls in #15734 take the log's scroll behaviour (the log scrolls in its own column from 56.25rem up, so following a growing reply needs the column's scroll, not the window's), the keyboard shortcuts, and code blocks and attachments. |
src/web/pages/talk.ts +18 −8
| @@ -293,13 +293,12 @@ export function activityLine(a: { readonly messages: number; readonly lastAt: st | ||
| 293 | 293 | * The conversations list, then this one's name with Rename and Archive: each a plain form, so none |
| 294 | 294 | * needs the script. |
| 295 | 295 | */ |
| 296 | function chats(ctx: Ctx, conversation: Conversation, showArchived: boolean, typed: string): Html { | |
| 296 | function chats(ctx: Ctx, conversation: Conversation, showArchived: boolean, typed: string, listOpen = false): Html { | |
| 297 | 297 | const user = ctx.auth.user!; |
| 298 | 298 | const found = typed === "" ? undefined : findConversations(ctx.app.db, user.id, typed); |
| 299 | 299 | const shown = listConversations(ctx.app.db, user.id, { archived: showArchived }); |
| 300 | 300 | const activity = conversationActivity(ctx.app.db, user.id, shown.map((c) => c.id)); |
| 301 | 301 | const put = listConversations(ctx.app.db, user.id, { archived: !showArchived }).length; |
| 302 | const archived = conversation.archivedAt !== null; | |
| 303 | 302 | return html`<nav class="talk-chats" aria-label="Conversations"> |
| 304 | 303 | <div class="bar"> |
| 305 | 304 | <form method="post" action="${HERE}/new">${btn("New", { icon: "plus", label: "New conversation" })}</form> |
| @@ -310,7 +309,7 @@ function chats(ctx: Ctx, conversation: Conversation, showArchived: boolean, type | ||
| 310 | 309 | ? html`<a class="small" href="${HERE}?archived=1">Archived (${put})</a>` |
| 311 | 310 | : null} |
| 312 | 311 | </div> |
| 313 | <details class="talk-list"${typed !== "" || showArchived ? html` open` : null}> | |
| 312 | <details class="talk-list"${typed !== "" || showArchived || listOpen ? html` open` : null}> | |
| 314 | 313 | <summary class="small">Conversations</summary> |
| 315 | 314 | <form class="bar" method="get" action="${HERE}" role="search"> |
| 316 | 315 | <input class="input" type="search" name="find" value="${typed}" maxlength="${FIND_CHARS}" aria-label="Search conversations" placeholder="Search conversations" /> |
| @@ -352,8 +351,16 @@ function chats(ctx: Ctx, conversation: Conversation, showArchived: boolean, type | ||
| 352 | 351 | )} |
| 353 | 352 | </ul> |
| 354 | 353 | </details> |
| 355 | </nav> | |
| 356 | <div class="talk-here bar"> | |
| 354 | </nav>`; | |
| 355 | } | |
| 356 | ||
| 357 | /** | |
| 358 | * The open conversation's head: its name and its controls. The way back to the list on a phone | |
| 359 | * is the first of the tabs, so it is reachable from the preview too. | |
| 360 | */ | |
outdated
aria-label 'Back to conversations' overrides the visible 'Chats' (WCAG 2.5.3 label in name; speech users say 'Chats'). Drop the aria-label or make it start with 'Chats'. |
||
| 361 | function hereBar(conversation: Conversation): Html { | |
| 362 | const archived = conversation.archivedAt !== null; | |
| 363 | return html`<div class="talk-here bar"> | |
| 357 | 364 | <strong>${nameOf(conversation)}${archived ? " (archived)" : ""}</strong> |
| 358 | 365 | <details> |
| 359 | 366 | <summary class="small">Rename</summary> |
| @@ -414,16 +421,19 @@ async function talkPage(ctx: Ctx, conversation: Conversation, before0: string | | ||
| 414 | 421 | const asked = ctx.url.searchParams.get("pane"); |
| 415 | 422 | const view: View | undefined = VIEWS.find((p) => p === asked); |
| 416 | 423 | const shown = view ?? "chat"; |
| 424 | // Below 900 px (56.25rem) the list and the thread take turns; ?chats=1 asks for the list. | |
outdated
Comment says 'Below 900 px' but the breakpoint is 47.99rem. Make the comment and the issue agree (principle 8: plain, true words). |
||
| 425 | const listing = ctx.url.searchParams.get("chats") === "1"; | |
| 417 | 426 | const cited = repoOf(turns); |
| 418 | 427 | const refs = refTarget(ctx.app.db, user, cited); |
| 419 | 428 | const pane = talkPane(ctx, user, cited, works, view); |
| 420 | 429 | const body = html`<div class="talk-page"><h1 class="sr-only">Talk</h1> |
| 421 | 430 | ${box} |
| 422 | <div class="talk-shell" data-shell data-pane="${shown}"> | |
| 423 | <div class="talk-side">${chats(ctx, conversation, showArchived, typed)}</div> | |
| 424 | <nav class="seg talk-tabs" aria-label="Chat or preview"><a href="?pane=chat"${shown === "chat" ? raw(' aria-current="page"') : null}>Chat</a><a href="?pane=preview"${shown !== "chat" ? raw(' aria-current="page"') : null}>Preview</a></nav> | |
| 431 | <div class="talk-shell" data-shell data-pane="${shown}"${listing ? raw(" data-view=\"list\"") : null}> | |
| 432 | <div class="talk-side">${chats(ctx, conversation, showArchived, typed, listing)}</div> | |
| 433 | <nav class="seg talk-tabs" aria-label="Chats, chat or preview"><a class="talk-back" href="${urlOf(conversation)}?chats=1">Chats</a><a href="?pane=chat"${shown === "chat" ? raw(' aria-current="page"') : null}>Chat</a><a href="?pane=preview"${shown !== "chat" ? raw(' aria-current="page"') : null}>Preview</a></nav> | |
| 425 | 434 | <div class="talk" data-talk data-user="${user.id}" data-c="${conversation.id}" data-here="${here}" data-paged="${paged ? "1" : "0"}" data-running="${running && !paged ? "1" : "0"}"> |
| 426 | 435 | <div> |
| 436 | ${hereBar(conversation)} | |
| 427 | 437 | ${totalLine(conversationTotal(ctx.app.db, conversation.id))} |
| 428 | 438 | ${contextLine(context)} |
| 429 | 439 | ${turns.length === DEFAULT_PAGE && turns[0] !== undefined |
src/web/pages/talk_client.ts +14 −11
| @@ -14,28 +14,31 @@ | ||
| 14 | 14 | * as a chip until it is sent or removed. |
| 15 | 15 | * - The pane's tabs (Chat / Preview on a phone; Preview, Code, Diff) are links |
| 16 | 16 | * the server draws; the script follows them in place, so a reply streaming |
| 17 | * beside the pane and the words in the composer are kept. | |
| 17 | * beside the pane and the words in the composer are kept. Chats, the first tab on a | |
| 18 | * phone, is a plain link: the list is its own page below 900 px. | |
| 18 | 19 | */ |
| 19 | 20 | |
| 20 | 21 | export const talkCss = /* css */ ` |
| 21 | 22 | .talk { display: grid; grid-template-rows: auto 1fr auto; gap: .75rem; max-width: min(48rem, 100%); margin: 0 auto; min-width: 0; } |
| 22 | 23 | .talk-shell, .talk-pane { display: grid; grid-template-columns: minmax(0, 1fr); gap: .75rem; min-width: 0; align-content: start; } |
| 23 | 24 | .talk-frame { width: 100%; height: calc(100dvh - 12rem); border: 0; } |
outdated
Cap is applied to div, form and p children only; any other direct child (ul, pre, section) is uncapped, and nothing proves no sideways scroll at 360px. Measure it. |
||
| 24 | @media (max-width: 47.99rem) { | |
| 25 | .talk-side { display: contents; } | |
| 26 | .talk-chats { position: sticky; top: var(--topbar-h); background: var(--bg); border-bottom: 1px solid var(--border); margin: 0; padding: .25rem 0; max-height: 40dvh; overflow-y: auto; } | |
| 27 | .talk-chats .btn, .talk-list summary { min-height: 2.75rem; display: inline-flex; align-items: center; } | |
| 28 | .talk-list summary { cursor: pointer; } | |
| 29 | [data-pane]:not([data-pane="chat"]) :is(.talk, .talk-side), [data-pane="chat"] .talk-pane { display: none; } | |
| 25 | .talk > * { width: 100%; max-width: 72ch; margin-inline: auto; box-sizing: border-box; } | |
| 26 | .talk-chats .btn, .talk-list summary, .talk-back { min-height: 2.75rem; display: inline-flex; align-items: center; } | |
| 27 | .talk-list summary { cursor: pointer; } | |
| 28 | @media (max-width: 56.24rem) { | |
outdated
One 250-char selector list that hides four things is hard to read and to keep right; split into one rule per state. Also the split is at 48rem, not the 900px the issue asked for. |
||
| 29 | [data-view="list"] :is(.talk, .talk-tabs, .talk-pane) { display: none; } | |
outdated
Principle 3/usability: below 900 px with pane=preview, .talk is hidden and the Chats link lives in .talk, so the list is two taps away. Put a list link in .talk-tabs, or show it in the preview pane. |
||
| 30 | .talk-shell:not([data-view="list"]) .talk-side { display: none; } | |
| 31 | [data-pane="chat"] .talk-pane { display: none; } | |
| 32 | [data-pane]:not([data-pane="chat"]) .talk { display: none; } | |
| 30 | 33 | } |
| 31 | @media (min-width: 48rem) { | |
| 34 | @media (min-width: 56.25rem) { | |
| 32 | 35 | .talk-page { display: flex; flex-direction: column; height: calc(100dvh - 7rem); } |
| 33 | 36 | .talk-shell { grid-template-columns: 15rem minmax(0, 1fr); grid-template-areas: "side tabs" "side main"; grid-template-rows: auto minmax(0, 1fr); flex: 1; min-height: 0; } |
| 34 | 37 | .talk-side { grid-area: side; padding-right: .75rem; } |
| 38 | .talk-back { display: none; } | |
| 35 | 39 | .talk-tabs { grid-area: tabs; justify-self: start; } |
| 36 | 40 | .talk, .talk-pane { grid-area: main; } |
| 37 | 41 | .talk-side, .talk-pane, .talk { overflow-y: auto; max-height: 100%; min-height: 0; } |
| 38 | .talk { max-width: min(52rem, 100%); width: 100%; margin: 0 auto; } | |
| 39 | 42 | [data-pane]:not([data-pane="chat"]) .talk, [data-pane="chat"] .talk-pane { display: none; } |
| 40 | 43 | } |
| 41 | 44 | @media (min-width: 80rem) { |
| @@ -89,7 +92,7 @@ export const talkCss = /* css */ ` | ||
| 89 | 92 | .talk-files { justify-content: flex-end; } |
| 90 | 93 | .talk-more { text-align: center; } |
| 91 | 94 | .talk-chats, .talk-here { margin-bottom: 12px; } |
| 92 | @supports selector(::details-content) { @media (min-width: 48rem) { .talk-list > summary { display: none; } .talk-list::details-content { content-visibility: visible; } } } | |
| 95 | @supports selector(::details-content) { @media (min-width: 56.25rem) { .talk-list > summary { display: none; } .talk-list::details-content { content-visibility: visible; } } } | |
| 93 | 96 | .talk-chats :is(.row-meta, .row-title) { overflow-wrap: anywhere; } |
| 94 | 97 | .talk-chats .row-meta { font-variant-numeric: tabular-nums; } |
| 95 | 98 | .talk-turn:target { box-shadow: -2px 0 0 var(--muted); scroll-margin-top: 4rem; } |
| @@ -468,7 +471,7 @@ ${dictateJs} | ||
| 468 | 471 | toEnd(true); |
| 469 | 472 | if (root.dataset.running === "1" && !paged) { log.setAttribute("aria-busy", "true"); follow(); } |
| 470 | 473 | document.addEventListener("click", async (e) => { |
| 471 | const a = e.target.closest("[data-shell] :is(.talk-tabs, .talk-pane nav) a"), shell = a && a.closest("[data-shell]"); | |
| 474 | const a = e.target.closest("[data-shell] :is(.talk-tabs, .talk-pane nav) a:not(.talk-back)"), shell = a && a.closest("[data-shell]"); | |
| 472 | 475 | if (!a || e.metaKey || e.ctrlKey || e.shiftKey) return; |
| 473 | 476 | e.preventDefault(); |
| 474 | 477 | const href = a.getAttribute("href"); |
test/talk-layout.test.ts +31 −8
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | /** |
| 2 | 2 | * The Talk shell at three sizes (#15734), measured in a real Chromium: a phone (360 px) shows the |
| 3 | * chat alone with its composer inside the screen; a tablet (820 px) puts the chats beside the chat; | |
| 3 | * chat alone with its composer inside the screen; a tablet (900 px) puts the chats beside the chat; | |
| 4 | 4 | * a laptop (1280 px) adds the preview as a third column; a wide monitor (2560 px) keeps the reading |
| 5 | 5 | * column at a readable width. At every size the page does not scroll sideways and the composer is |
| 6 | 6 | * on screen. Skipped, and says so, where no Chromium starts. |
| @@ -26,7 +26,7 @@ const chromium = found !== undefined && chromiumRuns(found) ? found : undefined; | ||
| 26 | 26 | if (chromium === undefined) console.log("SKIPPING: no chromium that starts on this machine, so the Talk layout is not measured"); |
| 27 | 27 | |
| 28 | 28 | interface Box { left: number; right: number; top: number; bottom: number; width: number } |
| 29 | interface Seen { scrollWidth: number; vw: number; vh: number; side: Box | null; chat: Box | null; pane: Box | null; compose: Box | null; build: Box | null; tabs: boolean } | |
| 29 | interface Seen { scrollWidth: number; vw: number; vh: number; side: Box | null; chat: Box | null; pane: Box | null; compose: Box | null; build: Box | null; tabs: boolean; back: Box | null } | |
| 30 | 30 | |
| 31 | 31 | let dir: string; |
| 32 | 32 | let app: App; |
| @@ -66,15 +66,15 @@ const EXPRESSION = `(() => { | ||
| 66 | 66 | scrollWidth: document.documentElement.scrollWidth, |
| 67 | 67 | vw: document.documentElement.clientWidth, |
| 68 | 68 | vh: window.innerHeight, |
| 69 | side: box(".talk-chats"), chat: box(".talk-log"), pane: box(".talk-pane"), compose: box(".talk-compose"), build: box(".talk-build-box"), | |
| 69 | side: box(".talk-chats"), chat: box(".talk-log"), pane: box(".talk-pane"), compose: box(".talk-compose"), build: box(".talk-build-box"), back: box(".talk-tabs .talk-back"), | |
| 70 | 70 | tabs: !!tabs && getComputedStyle(tabs).display !== "none", |
| 71 | 71 | }); |
| 72 | 72 | })()`; |
| 73 | 73 | |
| 74 | 74 | /** What was measured, kept so a failing assertion can print it. */ |
| 75 | 75 | let measured = ""; |
| 76 | const look = async (width: number, height: number, as = token): Promise<Seen> => { | |
| 77 | measured = await evaluateLoaded(chromium!, `${servers.url}/talk`, { width, height }, [{ name: "forge_session", value: as }], EXPRESSION); | |
| 76 | const look = async (width: number, height: number, as = token, query = ""): Promise<Seen> => { | |
| 77 | measured = await evaluateLoaded(chromium!, `${servers.url}/talk${query}`, { width, height }, [{ name: "forge_session", value: as }], EXPRESSION); | |
| 78 | 78 | return JSON.parse(measured) as Seen; |
| 79 | 79 | }; |
| 80 | 80 | afterEach(() => { |
| @@ -97,16 +97,39 @@ test.skipIf(chromium === undefined)("a phone shows the chat alone, the composer | ||
| 97 | 97 | expect(s.pane).toBeNull(); |
| 98 | 98 | expect(s.tabs).toBe(true); |
| 99 | 99 | expect(s.chat!.width).toBeGreaterThan(300); |
| 100 | expect(s.back).not.toBeNull(); | |
| 101 | }, 30_000); | |
| 102 | ||
| 103 | test.skipIf(chromium === undefined)("on a phone the preview keeps Chats one tap away, and ?chats=1 with ?pane=preview shows the list", async () => { | |
| 104 | const preview = await look(360, 740, token, "?pane=preview"); | |
| 105 | expect(preview.scrollWidth).toBeLessThanOrEqual(360); | |
| 106 | expect(preview.chat).toBeNull(); | |
| 107 | expect(preview.back).not.toBeNull(); | |
| 108 | const both = await look(360, 740, token, "?chats=1&pane=preview"); | |
| 109 | expect(both.scrollWidth).toBeLessThanOrEqual(360); | |
| 110 | expect(both.side).not.toBeNull(); | |
| 111 | expect(both.chat).toBeNull(); | |
| 112 | expect(both.pane).toBeNull(); | |
| 113 | }, 30_000); | |
| 114 | ||
| 115 | test.skipIf(chromium === undefined)("at 768 px the chat has the width alone, no list squeezing it", async () => { | |
| 116 | const s = await look(768, 1024); | |
| 117 | fits(s, 768); | |
| 118 | // The list is a screen of its own here, so nothing sits beside the chat; its width is the 72ch | |
| 119 | // measure (set by the font, so only a floor is asserted). | |
| 120 | expect(s.side).toBeNull(); | |
| 121 | expect(s.chat!.width).toBeGreaterThan(480); | |
| 100 | 122 | }, 30_000); |
| 101 | 123 | |
| 102 | 124 | test.skipIf(chromium === undefined)("a tablet puts the chats beside the chat, the preview a tab away", async () => { |
| 103 | const s = await look(820, 1100); | |
| 104 | fits(s, 820); | |
| 125 | const s = await look(900, 1100); | |
| 126 | fits(s, 900); | |
| 105 | 127 | expect(s.side).not.toBeNull(); |
| 106 | 128 | expect(s.chat).not.toBeNull(); |
| 107 | 129 | expect(s.side!.right).toBeLessThanOrEqual(s.chat!.left); |
| 108 | 130 | expect(s.pane).toBeNull(); |
| 109 | 131 | expect(s.tabs).toBe(true); |
| 132 | expect(s.back).toBeNull(); | |
| 110 | 133 | }, 30_000); |
| 111 | 134 | |
| 112 | 135 | test.skipIf(chromium === undefined)("a laptop shows chats, chat and preview side by side without tabs", async () => { |
| @@ -127,7 +150,7 @@ test.skipIf(chromium === undefined)("a wide monitor keeps the reading column rea | ||
| 127 | 150 | }, 30_000); |
| 128 | 151 | |
| 129 | 152 | test.skipIf(chromium === undefined)("a first visit, the conversation empty, keeps the composer on screen at a tablet and a laptop", async () => { |
| 130 | for (const [w, h] of [[820, 1100], [1280, 800]] as const) { | |
| 153 | for (const [w, h] of [[900, 1100], [1280, 800]] as const) { | |
| 131 | 154 | const s = await look(w, h, emptyToken); |
| 132 | 155 | fits(s, w); |
| 133 | 156 | expect(s.build).not.toBeNull(); |
test/talk-page.test.ts +35 −1
| @@ -106,6 +106,40 @@ describe("the page", () => { | ||
| 106 | 106 | expect(talkCss).not.toMatch(/\.talk-chats ul\s*\{/); |
| 107 | 107 | }); |
| 108 | 108 | |
| 109 | test("the shell: list beside the thread from 900 px, Chats link back below, thread capped (#15813)", async () => { | |
| 110 | say(alice, "person", "hi"); | |
| 111 | const html = await (await get("/talk", alice)).text(); | |
| 112 | expect(html).toContain('data-shell data-pane="chat">'); | |
| 113 | expect(html).not.toContain(`data-pane="chat" data-view`); | |
| 114 | expect(html).toMatch(/<nav class="seg talk-tabs"[^>]*><a class="talk-back" href="\/talk\/[^"?]+\?chats=1">Chats<\/a>/); | |
| 115 | expect(html.indexOf('class="talk-chats"')).toBeLessThan(html.indexOf('class="talk-here')); | |
| 116 | const listed = await (await get("/talk?chats=1", alice)).text(); | |
| 117 | expect(listed).toContain(`data-pane="chat" data-view="list"`); | |
| 118 | expect(listed).toMatch(/<details class="talk-list" open>/); | |
| 119 | expect(html).not.toContain("Back to conversations"); | |
| 120 | }); | |
outdated
Asserting that the CSS text contains a media query and a selector would pass with a broken layout. Rely on test/talk-layout.test.ts run with a browser, or assert on served markup only. |
||
| 121 | ||
| 122 | test("below 900 px the preview keeps a way to the list, and ?chats=1 with ?pane=preview shows the list (#15813)", async () => { | |
| 123 | say(alice, "person", "hi"); | |
| 124 | const tabsOf = (h: string) => h.match(/<nav class="seg talk-tabs"[^>]*>[\s\S]*?<\/nav>/)?.[0] ?? ""; | |
| 125 | // From the preview, the Chats link is in the tabs, which stay shown while .talk is hidden. | |
| 126 | const preview = await (await get("/talk?pane=preview", alice)).text(); | |
| 127 | expect(preview).toContain('data-shell data-pane="preview">'); | |
| 128 | expect(tabsOf(preview)).toMatch(/<a class="talk-back" href="\/talk\/[^"?]+\?chats=1">Chats<\/a>/); | |
| 129 | const { talkCss } = await import("../src/web/pages/talk_client.ts"); | |
| 130 | const phone = talkCss.slice(talkCss.indexOf("@media (max-width: 56.24rem)"), talkCss.indexOf("@media (min-width: 56.25rem)")); | |
| 131 | expect(phone).not.toMatch(/\[data-pane[^\]]*\][^{]*\.talk-tabs/); | |
| 132 | // Both asked: the list view wins. The side is shown (only hidden off the list view) and the | |
| 133 | // rules that hide .talk and .talk-pane leave .talk-side alone, so the shell is never blank. | |
| 134 | const both = await (await get("/talk?chats=1&pane=preview", alice)).text(); | |
| 135 | expect(both).toContain('data-shell data-pane="preview" data-view="list">'); | |
| 136 | expect(both).toMatch(/<div class="talk-side"><nav class="talk-chats"/); | |
| 137 | expect(phone).toContain('.talk-shell:not([data-view="list"]) .talk-side { display: none; }'); | |
| 138 | for (const rule of phone.split("\n").filter((l) => l.includes("display: none"))) { | |
| 139 | if (rule.includes(".talk-side")) expect(rule).toContain(':not([data-view="list"])'); | |
| 140 | } | |
| 141 | }); | |
| 142 | ||
| 109 | 143 | test("signed out goes to /signin and comes back", async () => { |
| 110 | 144 | const res = await get("/talk"); |
| 111 | 145 | expect(res.status).toBe(303); |
| @@ -294,7 +328,7 @@ describe("the page", () => { | ||
| 294 | 328 | |
| 295 | 329 | test("the page's own bytes are held: stylesheet and script stay small", async () => { |
| 296 | 330 | const { talkCss, talkJs } = await import("../src/web/pages/talk_client.ts"); |
| 297 | expect(Buffer.byteLength(talkCss)).toBeLessThan(5_910); | |
| 331 | expect(Buffer.byteLength(talkCss)).toBeLessThan(5_950); | |
| 298 | 332 | expect(Buffer.byteLength(talkJs)).toBeLessThan(17_600); |
| 299 | 333 | say(alice, "agent", "```ts\nlet x = 1;\n```"); |
| 300 | 334 | const page = await get("/talk", alice); |
Principle 1: this says the list sits beside the thread from 48rem (the #15734 shell), and the page below it also says 48rem. The CSS now splits at 56.25rem (900 px) and the Chats link shows below that. Say 900 px (56.25rem).