Public: anyone can read this; the crew can change it.
Design: an app's policy line uses the design system, and policy-line leaves §5d #3862
scout/forge:scout/3837-design-an-app-s-policy-line-uses-the-des → main 14 commits fork 5 threads · 5 unresolved
5 files
changed +46
−38
docs/DESIGN.md +2 −2
| @@ -393,8 +393,8 @@ gone, so this list only shrinks. | ||
| 393 | 393 | - **`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` |
| 394 | 394 | 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 |
| 395 | 395 | - **`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` |
| 396 | - **`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` | |
| 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, lineage: `.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` `.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` `.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` `.headroom` `.issue-head` `.issue-meta` `.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` | |
| 396 | - **`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` `listCard(rows, { listClass: "setting-list" })` puts the class on the card's list. An app page's policy row uses it, and `data-state` open/closed for the last probe's verdict (ok / mismatch, or closed for an unreadable contract); the words ("Mismatch:", "Its contract does not read") carry the verdict, so the colour is never the only signal. | |
| 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, lineage: `.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` `.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` `.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` `.headroom` `.issue-head` `.issue-meta` `.merge-box` `.merge-form` `.merge-headline` `.merge-sub` `.mirror-form` `.number` `.origin-link` `.origin-mark` `.origin-name` `.origin-row` `.owner` `.page-head` `.path-head` `.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 | 398 | - **`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` |
| 399 | 399 | - **`style/content.ts`, prose (markdown)** — table cell alignment, built by `markdown.ts` as `ta-${align}`: `.ta-c` `.ta-r` |
| 400 | 400 | - **`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/studio/app.ts +36 −25
| @@ -174,14 +174,18 @@ async function policyLine( | ||
| 174 | 174 | if (standing.kind === "unread") return html``; |
| 175 | 175 | const href = `/audit#${repo.ownerName}-${repo.name}`; |
| 176 | 176 | if (standing.kind === "unsound") |
| 177 | return html`<p class="policy-line"> | |
| 178 | ${icon("alert")} | |
| 179 | <span | |
| 180 | ><b>Its contract does not read</b>, so an app built on it does not | |
| 181 | boot.</span | |
| 182 | > | |
| 183 | <a href="${href}">See why</a> | |
| 184 | </p>`; | |
| 177 | return listCard( | |
| 178 | [ | |
| 179 | row({ | |
| 180 | lead: icon("alert"), | |
| 181 | state: "closed", | |
| 182 | title: html`<b>Its contract does not read</b>, so an app built on it | |
| 183 | does not boot.`, | |
| 184 | trail: btn("See why", { href, size: "sm" }), | |
| 185 | }), | |
| 186 | ], | |
| 187 | { listClass: "setting-list" }, | |
outdated
Same truncation risk for the unsound-contract sentence; the 'does not boot' half will be clipped on a phone. |
||
| 188 | ); | |
| 185 | 189 | const last = latestProbes(ctx.app.db, [record.id]).get(record.id); |
| 186 | 190 | const open = standing.open.length; |
| 187 | 191 | const said = |
| @@ -194,23 +198,30 @@ async function policyLine( | ||
| 194 | 198 | : last.verdict === "down" |
| 195 | 199 | ? "was not running when knocked on" |
| 196 | 200 | : "has no door to knock on"; |
| 197 | return html`<p class="policy-line" data-tone="${last?.verdict ?? "none"}"> | |
| 198 | ${icon("shield")} | |
| 199 | <span | |
| 200 | ><b | |
| 201 | >${Object.keys(standing.contract.resources).length === 1 | |
| 202 | ? "One resource" | |
| 203 | : `${Object.keys(standing.contract.resources).length} resources`}</b | |
| 204 | >, | |
| 205 | ${open === 0 | |
| 206 | ? "nothing open to anyone" | |
| 207 | : open === 1 | |
| 208 | ? "one door open to anyone" | |
| 209 | : `${open} doors open to anyone`}; | |
| 210 | ${said}.</span | |
| 211 | > | |
| 212 | <a href="${href}">The table</a> | |
| 213 | </p>`; | |
| 201 | const count = Object.keys(standing.contract.resources).length; | |
| 202 | const mismatch = last?.verdict === "mismatch" ? html`<b>Mismatch:</b> ` : null; | |
| 203 | const doors = | |
| 204 | open === 0 | |
| 205 | ? "nothing open to anyone" | |
| 206 | : open === 1 | |
| 207 | ? "one door open to anyone" | |
outdated
Add a test for this verdict-to-state mapping. Removing it would not fail any test today. |
||
| 208 | : `${open} doors open to anyone`; | |
outdated
This long sentence goes into .row-title, which ellipsizes on one line. On a 360px phone the 'was not running when knocked on' tail is clipped. Let the row wrap (setting-list behaviour) or move the verdict to a wrapping element. |
||
| 209 | return listCard( | |
| 210 | [ | |
| 211 | row({ | |
| 212 | lead: icon("shield"), | |
outdated
This title line is unformatted and very long. Break it like the rest of the file so it reads the same. |
||
| 213 | ...(last?.verdict === "ok" | |
| 214 | ? { state: "open" as const } | |
| 215 | : last?.verdict === "mismatch" | |
| 216 | ? { state: "closed" as const } | |
| 217 | : {}), | |
| 218 | title: html`${mismatch}<b>${count === 1 ? "One resource" : `${count} resources`}</b>, | |
| 219 | ${doors}; ${said}.`, | |
| 220 | trail: btn("The table", { href, size: "sm" }), | |
| 221 | }), | |
| 222 | ], | |
| 223 | { listClass: "setting-list" }, | |
| 224 | ); | |
| 214 | 225 | } |
| 215 | 226 | |
| 216 | 227 | export async function studioApp( |
src/web/style/content.ts −8
| @@ -345,14 +345,6 @@ a.origin-chip:hover { border-color: var(--border-strong); color: var(--fg); } | ||
| 345 | 345 | .backups-restore { margin: 8px 0 0; padding: 8px 10px; font-size: 12.5px; white-space: pre-wrap; word-break: break-all; background: var(--muted); border-radius: var(--radius); } |
| 346 | 346 | /* The records a domain waits on: type, name, value — as a zone file reads. */ |
| 347 | 347 | .domain-records { margin: 6px 0 2px; padding: 8px 10px; font-size: 12.5px; line-height: 1.6; white-space: pre; overflow-x: auto; scrollbar-width: thin; background: var(--muted); border-radius: var(--radius); } |
| 348 | .policy-line { | |
| 349 | display: flex; align-items: center; gap: 8px; flex-wrap: wrap; | |
| 350 | margin: 12px 0 0; font-size: 13px; color: var(--muted-fg); | |
| 351 | } | |
| 352 | .policy-line .ico { color: var(--faint); flex: none; } | |
| 353 | .policy-line b { color: var(--fg); font-weight: 600; } | |
| 354 | .policy-line[data-tone="mismatch"] .ico { color: var(--danger); } | |
| 355 | .policy-line[data-tone="ok"] .ico { color: var(--success); } | |
| 356 | 348 | .wall-cells li + li { margin-top: 3px; } |
| 357 | 349 | form.inline { display: inline; margin-left: auto; } |
| 358 | 350 |
src/web/ui.ts +3 −1
| @@ -829,6 +829,8 @@ export interface CardOptions { | ||
| 829 | 829 | pad?: boolean; |
| 830 | 830 | id?: string; |
| 831 | 831 | extra?: string; |
| 832 | /** Class added to a list card's `<ul>`; `setting-list` lets rows wrap. */ | |
| 833 | listClass?: string; | |
| 832 | 834 | /** Further attributes for the card itself (data hooks, tabindex), already escaped. */ |
| 833 | 835 | attrs?: Html; |
| 834 | 836 | } |
| @@ -849,7 +851,7 @@ export function card(body: Html, o: CardOptions = {}): Html { | ||
| 849 | 851 | /** A card wrapping a `<ul class="list">` — the shape every listing takes. */ |
| 850 | 852 | export function listCard(rows: Html[], o: CardOptions = {}): Html { |
| 851 | 853 | return card( |
| 852 | html`<ul class="list"> | |
| 854 | html`<ul class="list${o.listClass ? ` ${o.listClass}` : ""}"> | |
| 853 | 855 | ${rows} |
| 854 | 856 | </ul>`, |
| 855 | 857 | { ...o, pad: false }, |
test/audit.test.ts +5 −2
| @@ -442,8 +442,11 @@ describe("the audit reads every app's policy from git", () => { | ||
| 442 | 442 | headers: { cookie: `${cookie}; forge_mode=studio` }, |
| 443 | 443 | }) |
| 444 | 444 | ).text(); |
| 445 | expect(notes).toContain('class="policy-line"'); | |
| 445 | expect(notes).not.toContain("policy-line"); | |
| 446 | expect(notes).toContain("doors open to anyone"); | |
| 446 | 447 | expect(notes).toContain("2 resources"); |
| 448 | // The row wraps on a phone: the verdict is never ellipsized away. | |
| 449 | expect(notes).toContain('class="list setting-list"'); | |
| 447 | 450 | expect(notes).toContain('href="/audit#alice-notes"'); |
| 448 | 451 | // The audit page carries that anchor. |
| 449 | 452 | const page = await ( |
| @@ -456,6 +459,6 @@ describe("the audit reads every app's policy from git", () => { | ||
| 456 | 459 | headers: { cookie: `${cookie}; forge_mode=studio` }, |
| 457 | 460 | }) |
| 458 | 461 | ).text(); |
| 459 | expect(bare).not.toContain('class="policy-line"'); | |
| 462 | expect(bare).not.toContain("doors open to anyone"); | |
| 460 | 463 | }); |
| 461 | 464 | }); |
new above
offline
Conflict marker committed. Keep one bullet, drop
.policy-linefrom it, and delete the=======/>>>>>>>lines.