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 #4049

Parked opened this
Closed without merging

scout/forge:scout/3868-design-the-family-and-chain-pages-lineag → main 8 commits fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
8 files changed +64 −87
docs/DESIGN.md +4
@@ -393,7 +393,11 @@ gone, so this list only shrinks.
393393 - **`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`
394394 - **`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`
395395 - **`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`
396 <<<<<<< HEAD
397 - **`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` `.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` `.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` `.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-sep`
398 =======
396399 - **`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` `.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` `.handoff` `.handoff-links` `.headroom` `.hero` `.hero-terminal` `.issue-head` `.issue-meta` `.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` `.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-sep`
400 >>>>>>> origin/main
397401 - **`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`
398402 - **`style/content.ts`, prose (markdown)** — table cell alignment, built by `markdown.ts` as `ta-${align}`: `.ta-c` `.ta-r`
399403 - **`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
1717 import { field, readForm } from "../form.ts";
1818 import { html, type Html } from "../html.ts";
1919 import { flashOrJson, page, redirect } from "../layout.ts";
20 import { btn, card } from "../ui.ts";
20 import { badge, btn, card, row } from "../ui.ts";
2121
2222 /** The events that change what the chain page says. */
2323 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 {
5858 : "the root: follows nothing"
5959 : MODE_WORDS[l.mode];
6060 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 });
7167 }
7268
7369 /** Whether this repository is the forge code a spawned forge carries. */
@@ -138,7 +134,7 @@ export async function chainPage(ctx: Ctx): Promise<Response> {
138134 data-live-repo="${repo.ownerName}/${repo.name}"
139135 >
140136 ${card(
141 html`<ul class="list lineage" aria-label="Forges, root first">
137 html`<ul class="list" aria-label="Forges, root first">
142138 ${view.lines.map((l) => lineRow(l, l.here && l.mode !== null ? upstreamWords(state) : undefined))}
143139 </ul>`,
144140 { pad: false },
src/web/pages/family.ts +18 −25
@@ -16,7 +16,7 @@ import { MAX_DEPTH } from "../../spawn/heartbeat.ts";
1616 import { pageHead } from "../chrome.ts";
1717 import { html, type Html } from "../html.ts";
1818 import { page } from "../layout.ts";
19 import { card, time } from "../ui.ts";
19 import { badge, card, row, time } from "../ui.ts";
2020
2121 interface Node {
2222 readonly label: string;
@@ -63,28 +63,21 @@ function standingNode(c: FamilyChild): Node {
6363 };
6464 }
6565
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 });
8881 }
8982
9083 // GET /family
@@ -132,8 +125,8 @@ export async function familyPage(
132125 sub: "The forge this one came from, and the forges it sent. Children report in; nothing here reaches into one.",
133126 })}
134127 ${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)}
137130 </ul>
138131 ${kids.more > 0
139132 ? 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";
4242 import { field, readForm } from "../form.ts";
4343 import { html, raw, when, type Html } from "../html.ts";
4444 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";
4646 import { disconnectedOn } from "./frozen.ts";
4747
4848 /**
@@ -55,38 +55,27 @@ export function lineageCard(lineage: Lineage, hereId: string): Html {
5555 const node = (n: LineageNode, depth: number): Html => {
5656 const here = n.repo.id === hereId;
5757 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 });
8776 };
8877 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">
9079 ${node(lineage.root, 0)}
9180 </ul>
9281 ${when(
src/web/style/components.ts +4
@@ -373,6 +373,10 @@ a.sha:hover { color: var(--accent); }
373373
374374 /* ---- list rows ---- */
375375 .list > li + li { border-top: 1px solid var(--border); }
376 /* A list inside a row's item is its children: a rule and an indent, never a scrollbar. */
377 .list .list { margin-left: 22px; border-left: 1px solid var(--border); }
378 .list > li[aria-current] > .row { background: var(--muted); }
379 @media (max-width: 719px) { .list .list { margin-left: 12px; } }
376380 .row {
377381 display: flex; align-items: center; gap: 10px;
378382 padding: 8px 14px; min-height: 40px;
src/web/style/content.ts −13
@@ -396,19 +396,6 @@ a.origin-chip:hover { border-color: var(--border-strong); color: var(--fg); }
396396 .wall-cells li + li { margin-top: 3px; }
397397 form.inline { display: inline; margin-left: auto; }
398398
399 /* The family tree: nesting is indentation and a rule, never a scrollbar. */
400 .lineage-children {
401 list-style: none; margin: 0 0 0 22px; padding: 0;
402 border-left: 1px solid var(--border);
403 }
404 .lineage-children .row { padding-left: 12px; }
405 .lineage-here {
406 margin-left: 6px; font-family: var(--mono); font-size: var(--fs-min); font-weight: 500;
407 letter-spacing: 0.04em; color: var(--accent);
408 }
409 .lineage .row[aria-current="page"] { background: var(--muted); }
410 @media (max-width: 719px) { .lineage-children { margin-left: 12px; } }
411
412399 .hero { max-width: 620px; margin: 12dvh auto 0; text-align: center; }
413400 .hero h1 { font-size: clamp(30px, 7vw, 44px); letter-spacing: -0.04em; line-height: 1.05; }
414401 .hero p { margin: 12px 0 24px; font-size: 16px; color: var(--muted-fg); text-wrap: pretty; }
src/web/ui.ts +6 −4
@@ -865,11 +865,11 @@ export function disclosure(summary: Html | string, body: Html | string, o: Discl
865865 }
866866
867867 export interface RowOptions {
868 href?: string;
868 href?: string | undefined;
869869 title: Html | string;
870 meta?: Html;
870 meta?: Html | undefined;
871871 lead?: Html;
872 trail?: Html;
872 trail?: Html | undefined;
873873 state?: "open" | "closed" | "merged" | "draft";
874874 /** The row joins `j`/`k` keyboard traversal. */
875875 nav?: boolean;
@@ -882,6 +882,8 @@ export interface RowOptions {
882882 /** The row folds: it is the `<summary>` of a `<details>` holding `body`,
883883 * open when `open` says so. Its `lead` is the caret. */
884884 fold?: { id: string; open: boolean; body: Html };
885 /** A nested `<ul class="list">` under the row: the row's children. */
886 children?: Html | undefined;
885887 }
886888
887889 /** One list row. `<a>` when it navigates, `<div>` when it holds its own
@@ -916,7 +918,7 @@ export function row(o: RowOptions): Html {
916918 </details>`
917919 : o.href !== undefined
918920 ? html`<a href="${o.href}" ${attrs}>${inner}</a>`
919 : html`<div ${attrs}>${inner}</div>`}
921 : html`<div ${attrs}>${inner}</div>`}${o.children ?? null}
920922 </li>`;
921923 }
922924
test/following.test.ts +4 −2
@@ -730,12 +730,14 @@ describe("a fork that follows its parent", () => {
730730 expect(page).toContain("fay/game-fay");
731731 expect(page).toMatch(
732732 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`,
734734 ),
735735 );
736736 const bobAt = page.indexOf('href="/bob/game"');
737 const nested = page.indexOf("lineage-children", bobAt);
737 const nested = page.indexOf('<ul class="list">', bobAt);
738738 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);
739741 expect(bobAt).toBeGreaterThan(-1);
740742 expect(nested).toBeGreaterThan(bobAt);
741743 expect(fayAt).toBeGreaterThan(nested);

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs