Public: anyone can read this; the crew can change it.

A commit's head and body draw §5 components on the commit and report pages #4648

Parked opened this
Closed without merging

scout/forge:scout/4585-a-commit-s-head-and-body-draw-5-componen → main 5 commits fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
5 files changed +27 −15
docs/DESIGN.md +2 −2
@@ -176,7 +176,7 @@ specification.
176176 | **empty state** `empty()` | `.card.empty` | — | icon, one title, one sentence, **exactly one** action | the same three lines, centered |
177177 | **diff file** | `.diff-file` | `data-status`, `<details open>`, `.diff-viewed` | collapsed, viewed | a foldable file section |
178178 | **code block** | `.code` | `:target` / `[data-hl]` line highlight | — | a numbered gutter |
179 | **prose** | `.prose` | — | 15px, 72ch measure | wrapped markdown |
179 | **prose** | `.prose` | `data-text=message`: a `<pre>` of written text that wraps, for commit messages and reports | 15px, 72ch measure | wrapped markdown |
180180 | **settings shell** `settingsLayout()` | `.settings` (`.settings-nav`, `.settings-main`) | — | sticky nav ≥860px, scroll strip below | a sidebar and a pane |
181181 | **repo header** `repoHeader()` | `.repo-head` | — | tab counts, Settings only for admins | a title line and a tab row |
182182 | **where strip** `whereStrip()` (`scope.ts`) | `.where > .where-place` | `data-state=reading\|present\|absent` — accent dot, success dot, faint dot — the dot is the place's `aria-hidden` glyph span, its aside `.muted` | three places, always in this order and these words; a place is a link where one exists, and the third is the pin toggle | `● codeberg.org · ● workbench · ◆ this machine` |
@@ -395,7 +395,7 @@ gone, so this list only shrinks.
395395 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
396396 - **`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`
397397 - **`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 - **`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` `.wall-cells` `.where-sep`
398 - **`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` `.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` `.wall-cells` `.where-sep`
399399 - **`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`
400400 - **`style/content.ts`, prose (markdown)** — table cell alignment, built by `markdown.ts` as `ta-${align}`: `.ta-c` `.ta-r`
401401 - **`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/commits.ts +4 −5
@@ -105,12 +105,11 @@ export function renderCommit(
105105 syntax: SyntaxMap,
106106 ): Html {
107107 const head: Html = card(
108 html`<h2>${commit.subject}</h2>
109 ${when(
108 html`${when(
110109 commit.body.trim() !== "",
111 () => html`<pre class="commit-body">${commit.body}</pre>`,
110 () => html`<div class="prose" data-text="message"><pre>${commit.body}</pre></div>`,
112111 )}
113 <div class="bar small muted">
112 <div class="card-body bar small muted">
114113 ${commit.login
115114 ? originTag(
116115 commit.login,
@@ -132,7 +131,7 @@ export function renderCommit(
132131 >${icon("repo")}Browse files</a
133132 >
134133 </div>`,
135 { extra: "commit-head" },
134 { head: html`<h2>${commit.subject}</h2>`, pad: false },
136135 );
137136 return html`<div class="mt">${head}</div>
138137 <div class="mt">
src/web/pages/reports.ts +1 −1
@@ -208,7 +208,7 @@ function reportCard(base: string, report: Report): Html {
208208 html`<p><strong>${report.title}</strong></p>
209209 ${when(
210210 report.body !== "",
211 () => html`<pre class="commit-body">${report.body}</pre>`,
211 () => html`<div class="prose" data-text="message"><pre>${report.body}</pre></div>`,
212212 )}
213213 ${when(report.page, (p) => html`<p class="hint">Sent from ${p}</p>`)}
214214 <form
src/web/style/content.ts +3 −7
@@ -224,13 +224,6 @@ a.origin-chip:hover { border-color: var(--border-strong); color: var(--fg); }
224224 .bar .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
225225 @media (max-width: 420px) { .bar .seg > a { padding: 0 8px; } }
226226
227 .commit-head .card-body { padding: 14px 16px; }
228 .commit-body {
229 white-space: pre-wrap; font-family: var(--mono); font-size: 12.5px;
230 color: var(--muted-fg); margin: 8px 0 4px;
231 }
232
233
234227 /* A mirror whose origin went: what froze, and the one way back. */
235228 .frozen { margin-top: 12px; }
236229 .frozen-sentence { margin: 0; text-wrap: pretty; }
@@ -459,6 +452,9 @@ form.inline { display: inline; margin-left: auto; }
459452 border-radius: var(--radius); max-width: none;
460453 padding: 12px 14px; overflow-x: auto; margin: 14px 0; scrollbar-width: thin;
461454 }
455 /* Written text kept as typed (a commit message, a report): wraps, never scrolls sideways. */
456 .prose[data-text="message"] { padding-bottom: 0; }
457 .prose[data-text="message"] pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
462458 .prose code { background: var(--muted); border: 1px solid var(--border); padding: 1px 5px; border-radius: 4px; }
463459 .prose pre code { background: none; border: none; padding: 0; }
464460 .prose blockquote {
test/commit-page-timing.test.ts +17
@@ -95,3 +95,20 @@ test("a commit's head draws §5's bar, not .issue-meta", async () => {
9595 expect(body).toContain("Browse files");
9696 expect(body).toContain(oid.slice(0, 7));
9797 });
98
99 test("a commit's head and body draw §5's card-head and prose, not commit-head/commit-body", async () => {
100 const body = await (await fetch(`${servers.url}/ada/engine/commit/${oid}`)).text();
101 expect(body).not.toContain("commit-head");
102 expect(body).not.toContain("commit-body");
103 expect(body).toContain('<div class="card-head"><h2>add a</h2></div>');
104 });
105
106 test("a served commit body wraps instead of scrolling sideways", async () => {
107 const page = await (await fetch(`${servers.url}/ada/engine/commit/${oid}`)).text();
108 const href = page.match(/href="(\/assets\/[^"]+\.css)"/)?.[1] ?? "";
109 expect(href).not.toBe("");
110 const css = await (await fetch(`${servers.url}${href}`)).text();
111 const rule = css.match(/\.prose\[data-text="message"\] pre\s*\{[^}]*\}/)?.[0] ?? "";
112 expect(rule).toContain("white-space:");
113 expect(rule).toMatch(/white-space:\s*pre-wrap/);
114 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs