Public: anyone can read this; the crew can change it.
Design: the family and chain pages' lineage uses §5's row, and lineage/lineage-children/lineage-here leave §5d #4024
scout/forge:scout/3868-design-the-family-and-chain-pages-lineag → main 3 commits fork
8 files
changed +61
−88
docs/DESIGN.md +1 −1
| @@ -385,7 +385,7 @@ gone, so this list only shrinks. | ||
| 385 | 385 | - **`style/base.ts`** — the page shell (topbar, main, footer) and the layout and text utilities every page leans on: `.bar` `.bare` `.foot` `.grow` `.hide-lg` `.hide-sm` `.js-only` `.live-pill` `.mark` `.mb` `.mt` `.muted` `.narrow` `.narrow-wide` `.num` `.reduced` `.shell` `.shell-wide` `.skip` `.small` `.spacer` `.sr-only` `.stack` `.stack-tight` `.topbar` `.topbar-tools` `.truncate` `.wordmark` |
| 386 | 386 | - **`style/components.ts`** — parts of the §5 components that the table does not spell out — the palette's list, the menu's items, a dialog's head and foot, comments, the theme picker — and a few small helpers beside them: `.cat` `.clone` `.clone-text` `.comment` `.comment-body` `.comment-form` `.dash` `.dialog-body` `.dialog-foot` `.dialog-head` `.empty-title` `.error-note` `.field-row` `.form-actions` `.hex` `.ico` `.ico-loader` `.list` `.live-status` `.menu-item` `.menu-panel` `.menu-sep` `.menu-title` `.palette-empty` `.palette-foot` `.palette-group` `.palette-heading` `.palette-input` `.palette-item` `.palette-list` `.passkey` `.passkey-lead` `.passkey-note` `.passkey-off` `.passkey-on` `.preview` `.sep` `.split` `.sprite` `.swatch` `.table-scroll` `.tell-here` `.theme-apply` `.theme-option` `.tick` `.timeline` `.tl-dot` `.toast-body` `.topbar-search` |
| 387 | 387 | - **`style/components.ts`, settings rows** — a list whose rows are settings (limits, capacity): the `<ul class="list setting-list">` lets title and meta wrap instead of ellipsizing, and a row's controls take their own line under 640px. `.row-fields` is the form in that row's trail (input, Save, Default): always visible, never hover-gated, wrapping under the text before it would clip. Use both for any page whose rows show a name, a current value, and a control to change it; use `.row-actions` only for secondary actions (delete, wake, pin, revoke). Flags, telemetry, cloud, people, crew roles and subscription headroom/budget use `.row-fields`. Classes: `.row-fields` `.setting-list` |
| 388 | - **`style/content.ts`, page furniture** — what frames a page's content: page and repo heads, the merge box, the front page and its tiles, explore, backups, boards, the fleet chart's series colours, following, lineage: `.about` `.act` `.app-shelf` `.app-tile` `.app-tile-body` `.app-tile-desc` `.app-tile-look` `.app-tile-name` `.backups-drill` `.backups-error` `.backups-now` `.backups-restore` `.bform` `.bgrid` `.big` `.bmanage` `.boards-result` `.bp-h2` `.bp-h3` `.bp-w2` `.bp-w3` `.break` `.bt-bar` `.bt-grid` `.bt-group` `.bt-hist` `.bt-name` `.bt-procs` `.bt-row` `.bt-val` `.chart` `.chart-box` `.close-into` `.close-reason` `.commit-body` `.commit-head` `.connect-more` `.connect-path` `.domain-records` `.explore-filters` `.explore-line` `.explore-main` `.explore-name` `.explore-row` `.fg-s0` `.fg-s1` `.fg-s2` `.fg-s3` `.fg-s4` `.fg-s5` `.fg-s6` `.fg-s7` `.filters` `.flag-form` `.following` `.following-actions` `.following-eyebrow` `.following-foot` `.following-head` `.following-sentence` `.fork-bar` `.front-admin` `.front-controls` `.front-crew` `.front-featured` `.front-featured-body` `.front-featured-look` `.front-issues` `.front-live` `.front-more` `.front-pick` `.front-pin-any` `.front-weights` `.frozen` `.frozen-form` `.frozen-sentence` `.grants` `.grants-foot` `.handoff` `.handoff-links` `.headroom` `.hero` `.hero-terminal` `.issue-head` `.issue-meta` `.kv` `.lineage` `.lineage-children` `.lineage-here` `.merge-box` `.merge-form` `.merge-headline` `.merge-sub` `.mirror-form` `.number` `.origin-link` `.origin-mark` `.origin-name` `.origin-row` `.owner` `.page-head` `.path-head` `.policy-line` `.qf` `.quiet-details` `.repo-actions` `.repo-audience` `.repo-desc` `.repo-layout` `.repo-lineage` `.repo-title` `.search` `.slash` `.stage-detail` `.stage-dot` `.steps` `.sub` `.sys-pair` `.table-wrap` `.terminal-line` `.tok` `.tree-row` `.tree-total` `.wall-cells` `.where-dot` `.where-note` `.where-sep` | |
| 388 | - **`style/content.ts`, page furniture** — what frames a page's content: page and repo heads, the merge box, the front page and its tiles, explore, backups, boards, the fleet chart's series colours, following: `.about` `.act` `.app-shelf` `.app-tile` `.app-tile-body` `.app-tile-desc` `.app-tile-look` `.app-tile-name` `.backups-drill` `.backups-error` `.backups-now` `.backups-restore` `.bform` `.bgrid` `.big` `.bmanage` `.boards-result` `.bp-h2` `.bp-h3` `.bp-w2` `.bp-w3` `.break` `.bt-bar` `.bt-grid` `.bt-group` `.bt-hist` `.bt-name` `.bt-procs` `.bt-row` `.bt-val` `.chart` `.chart-box` `.close-into` `.close-reason` `.commit-body` `.commit-head` `.connect-more` `.connect-path` `.domain-records` `.explore-filters` `.explore-line` `.explore-main` `.explore-name` `.explore-row` `.fg-s0` `.fg-s1` `.fg-s2` `.fg-s3` `.fg-s4` `.fg-s5` `.fg-s6` `.fg-s7` `.filters` `.flag-form` `.following` `.following-actions` `.following-eyebrow` `.following-foot` `.following-head` `.following-sentence` `.fork-bar` `.front-admin` `.front-controls` `.front-crew` `.front-featured` `.front-featured-body` `.front-featured-look` `.front-issues` `.front-live` `.front-more` `.front-pick` `.front-pin-any` `.front-weights` `.frozen` `.frozen-form` `.frozen-sentence` `.grants` `.grants-foot` `.handoff` `.handoff-links` `.headroom` `.hero` `.hero-terminal` `.issue-head` `.issue-meta` `.kv` `.merge-box` `.merge-form` `.merge-headline` `.merge-sub` `.mirror-form` `.number` `.origin-link` `.origin-mark` `.origin-name` `.origin-row` `.owner` `.page-head` `.path-head` `.policy-line` `.qf` `.quiet-details` `.repo-actions` `.repo-audience` `.repo-desc` `.repo-layout` `.repo-lineage` `.repo-title` `.search` `.slash` `.stage-detail` `.stage-dot` `.steps` `.sub` `.sys-pair` `.table-wrap` `.terminal-line` `.tok` `.tree-row` `.tree-total` `.wall-cells` `.where-dot` `.where-note` `.where-sep` | |
| 389 | 389 | - **`style/content.ts`, code view** — the source view and the syntax-highlight token classes `highlight-html.ts` builds as `tok-${kind}`: `.blob-view` `.ln` `.tok-attribute` `.tok-comment` `.tok-constant` `.tok-decorator` `.tok-deleted` `.tok-emphasis` `.tok-function` `.tok-heading` `.tok-inserted` `.tok-keyword` `.tok-link` `.tok-meta` `.tok-number` `.tok-operator` `.tok-plain` `.tok-property` `.tok-punctuation` `.tok-regex` `.tok-string` `.tok-tag` `.tok-type` `.tok-variable` |
| 390 | 390 | - **`style/content.ts`, prose (markdown)** — table cell alignment, built by `markdown.ts` as `ta-${align}`: `.ta-c` `.ta-r` |
| 391 | 391 | - **`style/content.ts`, diff viewer** — the diff table: its gutters, line kinds, file head and inline review comments: `.add` `.del` `.dh` `.diff` `.diff-body` `.diff-head` `.diff-note` `.diff-path` `.diff-stat` `.diff-stub` `.diff-summary` `.diff-table` `.dl` `.dl-review` `.dn` `.dn-comment` `.nonl` `.rc-hidden` `.rc-resolve` `.rc-resolved` `.wd` |
src/web/pages/chain.ts +8 −12
| @@ -17,7 +17,7 @@ import { loadRepo, notFoundPage, pageHead, repoBase, signInFirst } from "../chro | ||
| 17 | 17 | import { field, readForm } from "../form.ts"; |
| 18 | 18 | import { html, type Html } from "../html.ts"; |
| 19 | 19 | import { flashOrJson, page, redirect } from "../layout.ts"; |
| 20 | import { btn, card } from "../ui.ts"; | |
| 20 | import { badge, btn, card, row } from "../ui.ts"; | |
| 21 | 21 | |
| 22 | 22 | /** The events that change what the chain page says. */ |
| 23 | 23 | export const CHAIN_LIVE = "forge.severed,forge.proposal,forge.follow_mode,forge.upstream,forge.updates_taken"; |
| @@ -58,16 +58,12 @@ function lineRow(l: ChainLine, upstream?: string): Html { | ||
| 58 | 58 | : "the root: follows nothing" |
| 59 | 59 | : MODE_WORDS[l.mode]; |
| 60 | 60 | const ahead = l.ahead === null ? "" : l.ahead === 0 ? " · nothing of its own" : ` · ${l.ahead} of its own`; |
| 61 | return html`<li> | |
| 62 | <div class="row"> | |
| 63 | <span class="row-main"> | |
| 64 | <span class="row-title" | |
| 65 | >${l.repo}${where}${l.here ? html` <span class="lineage-here">you are here</span>` : null}</span | |
| 66 | > | |
| 67 | <span class="row-meta">${how}${ahead}${upstream === undefined ? null : ` · ${upstream}`}</span> | |
| 68 | </span> | |
| 69 | </div> | |
| 70 | </li>`; | |
| 61 | return row({ | |
| 62 | title: html`${l.repo}${where}`, | |
| 63 | meta: html`${how}${ahead}${upstream === undefined ? null : ` · ${upstream}`}`, | |
| 64 | trail: l.here ? badge("you are here") : undefined, | |
| 65 | current: l.here, | |
| 66 | }); | |
| 71 | 67 | } |
| 72 | 68 | |
| 73 | 69 | /** Whether this repository is the forge code a spawned forge carries. */ |
| @@ -138,7 +134,7 @@ export async function chainPage(ctx: Ctx): Promise<Response> { | ||
| 138 | 134 | data-live-repo="${repo.ownerName}/${repo.name}" |
| 139 | 135 | > |
| 140 | 136 | ${card( |
| 141 | html`<ul class="list lineage" aria-label="Forges, root first"> | |
| 137 | html`<ul class="list" aria-label="Forges, root first"> | |
| 142 | 138 | ${view.lines.map((l) => lineRow(l, l.here && l.mode !== null ? upstreamWords(state) : undefined))} |
| 143 | 139 | </ul>`, |
| 144 | 140 | { pad: false }, |
src/web/pages/family.ts +18 −25
| @@ -16,7 +16,7 @@ import { MAX_DEPTH } from "../../spawn/heartbeat.ts"; | ||
| 16 | 16 | import { pageHead } from "../chrome.ts"; |
| 17 | 17 | import { html, type Html } from "../html.ts"; |
| 18 | 18 | import { page } from "../layout.ts"; |
| 19 | import { card, time } from "../ui.ts"; | |
| 19 | import { badge, card, row, time } from "../ui.ts"; | |
| 20 | 20 | |
| 21 | 21 | interface Node { |
| 22 | 22 | readonly label: string; |
| @@ -63,28 +63,21 @@ function standingNode(c: FamilyChild): Node { | ||
| 63 | 63 | }; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | function row(n: Node, depth: number): Html { | |
| 67 | const inner = html`<span class="row-main"> | |
| 68 | <span class="row-title" | |
| 69 | >${n.label}${n.here ? html` <span class="lineage-here">you are here</span>` : null}</span | |
| 70 | > | |
| 71 | ${n.meta.length === 0 | |
| 72 | ? null | |
| 73 | : html`<span class="row-meta" | |
| 74 | >${n.meta.map((m, i) => html`${i > 0 ? " · " : ""}${m}`)}</span | |
| 75 | >`} | |
| 76 | </span> | |
| 77 | ${n.badge === null ? null : html`<span class="row-trail">${n.badge}</span>`}`; | |
| 78 | return html`<li> | |
| 79 | ${n.href === null | |
| 80 | ? html`<div class="row">${inner}</div>` | |
| 81 | : html`<a class="row" href="${n.href}" rel="noopener noreferrer">${inner}</a>`} | |
| 82 | ${n.children.length === 0 || depth + 1 >= MAX_DEPTH | |
| 83 | ? null | |
| 84 | : html`<ul class="lineage-children"> | |
| 85 | ${n.children.map((c) => row(c, depth + 1))} | |
| 86 | </ul>`} | |
| 87 | </li>`; | |
| 66 | function rowOf(n: Node, depth: number): Html { | |
| 67 | const trail = [n.here ? badge("you are here") : null, n.badge]; | |
| 68 | return row({ | |
| 69 | href: n.href ?? undefined, | |
| 70 | title: n.label, | |
| 71 | meta: n.meta.length === 0 ? undefined : html`${n.meta.map((m, i) => html`${i > 0 ? " · " : ""}${m}`)}`, | |
| 72 | trail: trail[0] === null && trail[1] === null ? undefined : html`${trail}`, | |
| 73 | current: n.here === true, | |
| 74 | children: | |
| 75 | n.children.length === 0 || depth + 1 >= MAX_DEPTH | |
| 76 | ? undefined | |
| 77 | : html`<ul class="list"> | |
| 78 | ${n.children.map((c) => rowOf(c, depth + 1))} | |
| 79 | </ul>`, | |
| 80 | }); | |
| 88 | 81 | } |
| 89 | 82 | |
| 90 | 83 | // GET /family |
| @@ -132,8 +125,8 @@ export async function familyPage( | ||
| 132 | 125 | sub: "The forge this one came from, and the forges it sent. Children report in; nothing here reaches into one.", |
| 133 | 126 | })} |
| 134 | 127 | ${card( |
| 135 | html`<ul class="list lineage" aria-label="Forges, by who sent whom"> | |
| 136 | ${row(root, 0)} | |
| 128 | html`<ul class="list" aria-label="Forges, by who sent whom"> | |
| 129 | ${rowOf(root, 0)} | |
| 137 | 130 | </ul> |
| 138 | 131 | ${kids.more > 0 |
| 139 | 132 | ? html`<p class="muted small card-body"> |
src/web/pages/following.ts +20 −31
| @@ -42,7 +42,7 @@ import { openProposal, proposeUpstream } from "../../actions/upstream.ts"; | ||
| 42 | 42 | import { field, readForm } from "../form.ts"; |
| 43 | 43 | import { html, raw, when, type Html } from "../html.ts"; |
| 44 | 44 | import { flashOrJson } from "../layout.ts"; |
| 45 | import { badge, btn, card, icon, type Tone } from "../ui.ts"; | |
| 45 | import { badge, btn, card, icon, row, type Tone } from "../ui.ts"; | |
| 46 | 46 | import { disconnectedOn } from "./frozen.ts"; |
| 47 | 47 | |
| 48 | 48 | /** |
| @@ -55,38 +55,27 @@ export function lineageCard(lineage: Lineage, hereId: string): Html { | ||
| 55 | 55 | const node = (n: LineageNode, depth: number): Html => { |
| 56 | 56 | const here = n.repo.id === hereId; |
| 57 | 57 | const name = `${n.repo.ownerName}/${n.repo.name}`; |
| 58 | return html`<li> | |
| 59 | <a | |
| 60 | href="/${n.repo.ownerName}/${n.repo.name}" | |
| 61 | class="row" | |
| 62 | data-nav | |
| 63 | tabindex="-1" | |
| 64 | ${here ? raw('aria-current="page"') : null} | |
| 65 | > | |
| 66 | <span class="row-lead">${icon(depth === 0 ? "repo" : "fork")}</span> | |
| 67 | <span class="row-main"> | |
| 68 | <span class="row-title" | |
| 69 | >${name}${here | |
| 70 | ? html` <span class="lineage-here">you are here</span>` | |
| 71 | : null}</span | |
| 72 | > | |
| 73 | ${n.repo.description === "" | |
| 74 | ? null | |
| 75 | : html`<span class="row-meta">${n.repo.description}</span>`} | |
| 76 | </span> | |
| 77 | ${n.relation === undefined | |
| 78 | ? null | |
| 79 | : html`<span class="row-trail">${relationBadge(n.relation)}</span>`} | |
| 80 | </a> | |
| 81 | ${n.children.length === 0 | |
| 82 | ? null | |
| 83 | : html`<ul class="lineage-children"> | |
| 84 | ${n.children.map((c) => node(c, depth + 1))} | |
| 85 | </ul>`} | |
| 86 | </li>`; | |
| 58 | return row({ | |
| 59 | href: `/${n.repo.ownerName}/${n.repo.name}`, | |
| 60 | nav: true, | |
| 61 | lead: icon(depth === 0 ? "repo" : "fork"), | |
| 62 | title: name, | |
| 63 | meta: n.repo.description === "" ? undefined : html`${n.repo.description}`, | |
| 64 | trail: | |
| 65 | !here && n.relation === undefined | |
| 66 | ? undefined | |
| 67 | : html`${here ? badge("you are here") : null}${n.relation === undefined ? null : relationBadge(n.relation)}`, | |
| 68 | current: here, | |
| 69 | children: | |
| 70 | n.children.length === 0 | |
| 71 | ? undefined | |
| 72 | : html`<ul class="list"> | |
| 73 | ${n.children.map((c) => node(c, depth + 1))} | |
| 74 | </ul>`, | |
| 75 | }); | |
| 87 | 76 | }; |
| 88 | 77 | return card( |
| 89 | html`<ul class="list lineage" aria-label="Forks, by who follows whom"> | |
| 78 | html`<ul class="list" aria-label="Forks, by who follows whom"> | |
| 90 | 79 | ${node(lineage.root, 0)} |
| 91 | 80 | </ul> |
| 92 | 81 | ${when( |
src/web/style/components.ts +4
| @@ -348,6 +348,10 @@ a.sha:hover { color: var(--accent); } | ||
| 348 | 348 | |
| 349 | 349 | /* ---- list rows ---- */ |
| 350 | 350 | .list > li + li { border-top: 1px solid var(--border); } |
| 351 | /* A list inside a row's item is its children: a rule and an indent, never a scrollbar. */ | |
| 352 | .list .list { margin-left: 22px; border-left: 1px solid var(--border); } | |
| 353 | .list > li[aria-current] > .row { background: var(--muted); } | |
| 354 | @media (max-width: 719px) { .list .list { margin-left: 12px; } } | |
| 351 | 355 | .row { |
| 352 | 356 | display: flex; align-items: center; gap: 10px; |
| 353 | 357 | padding: 8px 14px; min-height: 40px; |
src/web/style/content.ts −13
| @@ -420,19 +420,6 @@ a.origin-chip:hover { border-color: var(--border-strong); color: var(--fg); } | ||
| 420 | 420 | .wall-cells li + li { margin-top: 3px; } |
| 421 | 421 | form.inline { display: inline; margin-left: auto; } |
| 422 | 422 | |
| 423 | /* The family tree: nesting is indentation and a rule, never a scrollbar. */ | |
| 424 | .lineage-children { | |
| 425 | list-style: none; margin: 0 0 0 22px; padding: 0; | |
| 426 | border-left: 1px solid var(--border); | |
| 427 | } | |
| 428 | .lineage-children .row { padding-left: 12px; } | |
| 429 | .lineage-here { | |
| 430 | margin-left: 6px; font-family: var(--mono); font-size: var(--fs-min); font-weight: 500; | |
| 431 | letter-spacing: 0.04em; color: var(--accent); | |
| 432 | } | |
| 433 | .lineage .row[aria-current="page"] { background: var(--muted); } | |
| 434 | @media (max-width: 719px) { .lineage-children { margin-left: 12px; } } | |
| 435 | ||
| 436 | 423 | .hero { max-width: 620px; margin: 12dvh auto 0; text-align: center; } |
| 437 | 424 | .hero h1 { font-size: clamp(30px, 7vw, 44px); letter-spacing: -0.04em; line-height: 1.05; } |
| 438 | 425 | .hero p { margin: 12px 0 24px; font-size: 16px; color: var(--muted-fg); text-wrap: pretty; } |
src/web/ui.ts +6 −4
| @@ -820,11 +820,11 @@ export function listCard(rows: Html[], o: CardOptions = {}): Html { | ||
| 820 | 820 | } |
| 821 | 821 | |
| 822 | 822 | export interface RowOptions { |
| 823 | href?: string; | |
| 823 | href?: string | undefined; | |
| 824 | 824 | title: Html | string; |
| 825 | meta?: Html; | |
| 825 | meta?: Html | undefined; | |
| 826 | 826 | lead?: Html; |
| 827 | trail?: Html; | |
| 827 | trail?: Html | undefined; | |
| 828 | 828 | state?: "open" | "closed" | "merged" | "draft"; |
| 829 | 829 | /** The row joins `j`/`k` keyboard traversal. */ |
| 830 | 830 | nav?: boolean; |
| @@ -837,6 +837,8 @@ export interface RowOptions { | ||
| 837 | 837 | /** The row folds: it is the `<summary>` of a `<details>` holding `body`, |
| 838 | 838 | * open when `open` says so. Its `lead` is the caret. */ |
| 839 | 839 | fold?: { id: string; open: boolean; body: Html }; |
| 840 | /** A nested `<ul class="list">` under the row: the row's children. */ | |
| 841 | children?: Html | undefined; | |
| 840 | 842 | } |
| 841 | 843 | |
| 842 | 844 | /** One list row. `<a>` when it navigates, `<div>` when it holds its own |
| @@ -871,7 +873,7 @@ export function row(o: RowOptions): Html { | ||
| 871 | 873 | </details>` |
| 872 | 874 | : o.href !== undefined |
| 873 | 875 | ? html`<a href="${o.href}" ${attrs}>${inner}</a>` |
| 874 | : html`<div ${attrs}>${inner}</div>`} | |
| 876 | : html`<div ${attrs}>${inner}</div>`}${o.children ?? null} | |
| 875 | 877 | </li>`; |
| 876 | 878 | } |
| 877 | 879 |
test/following.test.ts +4 −2
| @@ -730,12 +730,14 @@ describe("a fork that follows its parent", () => { | ||
| 730 | 730 | expect(page).toContain("fay/game-fay"); |
| 731 | 731 | expect(page).toMatch( |
| 732 | 732 | new RegExp( |
| 733 | `aria-current="page"[\\s\\S]{0,2000}${here}[\\s\\S]{0,80}you are here`, | |
| 733 | `aria-current="true"[\\s\\S]{0,2000}${here}[\\s\\S]{0,200}you are here`, | |
| 734 | 734 | ), |
| 735 | 735 | ); |
| 736 | 736 | const bobAt = page.indexOf('href="/bob/game"'); |
| 737 | const nested = page.indexOf("lineage-children", bobAt); | |
| 737 | const nested = page.indexOf('<ul class="list">', bobAt); | |
| 738 | 738 | const fayAt = page.indexOf('href="/fay/game-fay"'); |
| 739 | for (const gone of ["lineage-children", "lineage-here", 'class="list lineage"']) | |
| 740 | expect(page).not.toContain(gone); | |
| 739 | 741 | expect(bobAt).toBeGreaterThan(-1); |
| 740 | 742 | expect(nested).toBeGreaterThan(bobAt); |
| 741 | 743 | expect(fayAt).toBeGreaterThan(nested); |
new above
offline