Public: anyone can read this; the crew can change it.
A repository's path head draws §5's head, and .path-head leaves the stylesheet #4649
scout/forge:scout/4591-a-repository-s-path-head-draws-5-s-head → main 7 commits fork 1 thread · 1 unresolved
4 files
changed +69
−12
docs/DESIGN.md +4
| @@ -395,7 +395,11 @@ gone, so this list only shrinks. | ||
| 395 | 395 | A `.field` directly inside a `.bar` drops its bottom margin and the bar aligns to the end, so a labelled input and its button share a baseline |
| 396 | 396 | - **`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` `.menu-item` `.menu-panel` `.menu-sep` `.menu-title` `.palette-empty` `.palette-foot` `.palette-group` `.palette-heading` `.palette-input` `.palette-item` `.palette-list` `.passkey` `.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` |
| 397 | 397 | - **`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` |
| 398 | <<<<<<< HEAD | |
| 399 | - **`style/content.ts`, page furniture** — what frames a page's content: page and repo heads, the front page and its tiles, explore, backups, boards, the fleet chart's series colours, lineage: `.bform` `.bgrid` `.bmanage` `.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` `.commit-body` `.commit-head` `.domain-records` `.fg-s0` `.fg-s1` `.fg-s2` `.fg-s3` `.fg-s4` `.fg-s5` `.fg-s6` `.fg-s7` `.filters` `.flag-form` `.front-admin` `.front-controls` `.front-crew` `.front-featured` `.front-featured-body` `.front-featured-look` `.front-issues` `.front-live` `.front-more` `.front-pick` `.frozen` `.frozen-form` `.frozen-sentence` `.headroom` `.issue-head` `.issue-meta` `.mirror-form` `.number` `.origin-mark` `.origin-name` `.origin-row` `.owner` `.page-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` `.tok` `.wall-cells` `.where-sep` | |
| 400 | ======= | |
| 398 | 401 | - **`style/content.ts`, page furniture** — what frames a page's content: page and repo heads, the front page and its tiles, explore, backups, boards, the fleet chart's series colours, lineage: `.bform` `.bgrid` `.bmanage` `.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` `.commit-body` `.commit-head` `.domain-records` `.fg-s0` `.fg-s1` `.fg-s2` `.fg-s3` `.fg-s4` `.fg-s5` `.fg-s6` `.fg-s7` `.filters` `.flag-form` `.front-admin` `.front-controls` `.front-crew` `.front-featured` `.front-featured-body` `.front-featured-look` `.front-issues` `.front-live` `.front-more` `.front-pick` `.frozen` `.frozen-form` `.frozen-sentence` `.headroom` `.issue-head` `.issue-meta` `.mirror-form` `.number` `.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` `.tok` `.where-sep` |
| 402 | >>>>>>> origin/main | |
| 399 | 403 | - **`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` |
| 400 | 404 | - **`style/content.ts`, prose (markdown)** — table cell alignment, built by `markdown.ts` as `ta-${align}`: `.ta-c` `.ta-r` |
| 401 | 405 | - **`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/repo.ts +2 −2
| @@ -746,7 +746,7 @@ export async function renderCode( | ||
| 746 | 746 | <span class="spacer"></span> |
| 747 | 747 | ${finderButton()} |
| 748 | 748 | </div>` |
| 749 | : html`<div class="path-head"> | |
| 749 | : html`<div class="bar mb"> | |
| 750 | 750 | ${refMenu( |
| 751 | 751 | o.refs, |
| 752 | 752 | ref, |
| @@ -850,7 +850,7 @@ export function renderBlob( | ||
| 850 | 850 | o.blob.kind === "too_large" ? "" : sizeWithTokens(o.blob.size, o.path); |
| 851 | 851 | const fileHref = `${base}/blob/${encoded}/${o.path}`; |
| 852 | 852 | return html`<div class="code-pane" id="code-pane" data-path="${o.path}"> |
| 853 | <div class="path-head"> | |
| 853 | <div class="bar mb"> | |
| 854 | 854 | ${refMenu( |
| 855 | 855 | o.refs, |
| 856 | 856 | o.ref, |
src/web/style/content.ts −10
| @@ -202,16 +202,6 @@ a.origin-chip:hover { border-color: var(--border-strong); color: var(--fg); } | ||
| 202 | 202 | |
| 203 | 203 | .tok { white-space: nowrap; } |
| 204 | 204 | |
| 205 | /* The file's location stays on screen while its contents scroll past. Opaque | |
| 206 | on purpose: code sliding under a blur is noise, not depth. */ | |
| 207 | .path-head { | |
| 208 | position: sticky; top: calc(var(--topbar-h) - 1px); z-index: 6; | |
| 209 | display: flex; align-items: center; gap: 8px; flex-wrap: wrap; | |
| 210 | margin: 12px 0; padding: 8px 10px; | |
| 211 | background: var(--card); border: 1px solid var(--border); | |
| 212 | border-radius: var(--radius-sm); | |
| 213 | } | |
| 214 | ||
| 215 | 205 | .filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; } |
| 216 | 206 | .filters form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } |
| 217 | 207 | .filters .search { min-width: 180px; flex: 1; max-width: 320px; } |
test/repo-path-head.test.ts added +63
| @@ -0,0 +1,63 @@ | ||
| 1 | /** | |
| 2 | * A repository's path head (the ref menu, the breadcrumb and History on a | |
| 3 | * folder; the same on a file) is drawn with §5's .bar, not a class of its own. | |
| 4 | */ | |
| 5 | import { afterAll, beforeAll, expect, test } from "bun:test"; | |
| 6 | import { mkdtemp, rm } from "node:fs/promises"; | |
| 7 | import { tmpdir } from "node:os"; | |
| 8 | import { join } from "node:path"; | |
| 9 | import { commitToBranch, createRepo } from "../src/actions/repos.ts"; | |
| 10 | import { createApp, type App } from "../src/app.ts"; | |
| 11 | import { createUser } from "../src/core/users.ts"; | |
| 12 | import { serve, type Servers } from "../src/http/server.ts"; | |
| 13 | import { quietLogs } from "./helpers/globals.ts"; | |
| 14 | ||
| 15 | quietLogs(); | |
| 16 | ||
| 17 | let dataDir: string; | |
| 18 | let app: App; | |
| 19 | let servers: Servers; | |
| 20 | ||
| 21 | const page = async (path: string): Promise<string> => { | |
| 22 | const r = await fetch(`${servers.url}${path}`); | |
| 23 | expect(r.status).toBe(200); | |
| 24 | return r.text(); | |
| 25 | }; | |
| 26 | ||
| 27 | beforeAll(async () => { | |
| 28 | dataDir = await mkdtemp(join(tmpdir(), "forge-path-head-")); | |
| 29 | app = createApp({ dataDir, port: 0, host: "forge.test" }); | |
| 30 | servers = await serve(app); | |
| 31 | const made = await createUser(app.db, { | |
| 32 | origin: "seed", | |
| 33 | trusted: true, | |
| 34 | username: "olive", | |
| 35 | email: "[email protected]", | |
| 36 | password: "a-good-passphrase", | |
| 37 | adminIfFirst: true, | |
| 38 | }); | |
| 39 | if (!made.ok) throw new Error(made.error); | |
| 40 | const r = await createRepo(app, made.value, { name: "yard", visibility: "public" }); | |
| 41 | if (!r.ok) throw new Error(String(r.error)); | |
| 42 | await commitToBranch(app, made.value, r.value, { | |
| 43 | message: "first", | |
| 44 | files: [{ path: "src/a.txt", content: "a\n" }], | |
| 45 | }); | |
| 46 | }); | |
| 47 | ||
| 48 | afterAll(async () => { | |
| 49 | await servers.stop(); | |
| 50 | await rm(dataDir, { recursive: true, force: true }); | |
| 51 | }); | |
| 52 | ||
| 53 | test("a tree page's head is a .bar with the crumbs and History, no path-head", async () => { | |
| 54 | const h = await page("/olive/yard/tree/main/src"); | |
| 55 | expect(h).not.toContain("path-head"); | |
| 56 | expect(h).toContain('class="bar mb"'); | |
| 57 | expect(h).toContain("History"); | |
| 58 | }); | |
| 59 | ||
| 60 | test("a file page has no path-head either", async () => { | |
| 61 | const h = await page("/olive/yard/blob/main/src/a.txt"); | |
| 62 | expect(h).not.toContain("path-head"); | |
| 63 | }); |
new above
offline
Fine. The sticky behaviour is lost here; see the stale comment above renderBlob that still describes it.