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

Parked opened this
Closed without merging

scout/forge:scout/3837-design-an-app-s-policy-line-uses-the-des → main 16 commits fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
5 files changed +46 −38
docs/DESIGN.md +2 −2
@@ -393,8 +393,8 @@ 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 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
395395 - **`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` `.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` `.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`
398398 - **`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`
399399 - **`style/content.ts`, prose (markdown)** — table cell alignment, built by `markdown.ts` as `ta-${align}`: `.ta-c` `.ta-r`
400400 - **`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(
174174 if (standing.kind === "unread") return html``;
175175 const href = `/audit#${repo.ownerName}-${repo.name}`;
176176 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" },
188 );
185189 const last = latestProbes(ctx.app.db, [record.id]).get(record.id);
186190 const open = standing.open.length;
187191 const said =
@@ -194,23 +198,30 @@ async function policyLine(
194198 : last.verdict === "down"
195199 ? "was not running when knocked on"
196200 : "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"
208 : `${open} doors open to anyone`;
209 return listCard(
210 [
211 row({
212 lead: icon("shield"),
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 );
214225 }
215226
216227 export async function studioApp(
src/web/style/content.ts −8
@@ -344,14 +344,6 @@ a.origin-chip:hover { border-color: var(--border-strong); color: var(--fg); }
344344 .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); }
345345 /* The records a domain waits on: type, name, value — as a zone file reads. */
346346 .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); }
347 .policy-line {
348 display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
349 margin: 12px 0 0; font-size: 13px; color: var(--muted-fg);
350 }
351 .policy-line .ico { color: var(--faint); flex: none; }
352 .policy-line b { color: var(--fg); font-weight: 600; }
353 .policy-line[data-tone="mismatch"] .ico { color: var(--danger); }
354 .policy-line[data-tone="ok"] .ico { color: var(--success); }
355347 .wall-cells li + li { margin-top: 3px; }
356348 form.inline { display: inline; margin-left: auto; }
357349
src/web/ui.ts +3 −1
@@ -829,6 +829,8 @@ export interface CardOptions {
829829 pad?: boolean;
830830 id?: string;
831831 extra?: string;
832 /** Class added to a list card's `<ul>`; `setting-list` lets rows wrap. */
833 listClass?: string;
832834 /** Further attributes for the card itself (data hooks, tabindex), already escaped. */
833835 attrs?: Html;
834836 }
@@ -849,7 +851,7 @@ export function card(body: Html, o: CardOptions = {}): Html {
849851 /** A card wrapping a `<ul class="list">` — the shape every listing takes. */
850852 export function listCard(rows: Html[], o: CardOptions = {}): Html {
851853 return card(
852 html`<ul class="list">
854 html`<ul class="list${o.listClass ? ` ${o.listClass}` : ""}">
853855 ${rows}
854856 </ul>`,
855857 { ...o, pad: false },
test/audit.test.ts +5 −2
@@ -442,8 +442,11 @@ describe("the audit reads every app's policy from git", () => {
442442 headers: { cookie: `${cookie}; forge_mode=studio` },
443443 })
444444 ).text();
445 expect(notes).toContain('class="policy-line"');
445 expect(notes).not.toContain("policy-line");
446 expect(notes).toContain("doors open to anyone");
446447 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"');
447450 expect(notes).toContain('href="/audit#alice-notes"');
448451 // The audit page carries that anchor.
449452 const page = await (
@@ -456,6 +459,6 @@ describe("the audit reads every app's policy from git", () => {
456459 headers: { cookie: `${cookie}; forge_mode=studio` },
457460 })
458461 ).text();
459 expect(bare).not.toContain('class="policy-line"');
462 expect(bare).not.toContain("doors open to anyone");
460463 });
461464 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs