Public: anyone can read this; the crew can change it.
Design: the front page's admin controls use §5's row, bar and field, and front-admin/pick/pin-any/weights leave §5d #4077
scout/forge:scout/3941-design-the-front-page-s-admin-controls-u → main 9 commits fork
5 files
changed +50
−47
docs/DESIGN.md −7
| @@ -393,13 +393,6 @@ 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 | - **`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` |
| 395 | 395 | - **`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 | - **`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` | |
| 397 | - **`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` | |
| 398 | - **`style/content.ts`, prose (markdown)** — table cell alignment, built by `markdown.ts` as `ta-${align}`: `.ta-c` `.ta-r` | |
| 399 | - **`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` | |
| 400 | - **`style/content.ts`, apps, runs, and the crew** — run pages, their logs and checks (a pull's look is §5's **look**): `.ln-forge` `.ln-pulse` `.ln-say` `.ln-tool` `.ln-you` `.log-tail-row` `.pinned-failures` `.pinned-slot` `.run-jump` `.run-live` `.run-steer` `.tests-bar` `.tests-words` `.txt` `.who` | |
| 401 | - **`style/content.ts`, search results** — search results, the inbox's ask cards, the client list and the claim link: `.ask-acts` `.ask-card` `.ask-group` `.ask-kind` `.ask-meta` `.ask-more-acts` `.ask-pick` `.ask-pick-hit` `.ask-short` `.ask-waiting` `.claim-link-box` `.forges-sent` `.live-toggle` `.needs-you` `.no-hits` | |
| 402 | - **`pages/board.ts`** — the board itself is §5's **board**; the spend tables `spend.ts` draws wear §5's `.table` and `.stack`, no class of their own | |
| 403 | 396 | - **`pages/map.ts`** — the map of what waits for what: `.map-ask` `.map-breath` `.map-canvas` `.map-card` `.map-counts` `.map-dot` `.map-edge` `.map-edge-crit` `.map-edge-done` `.map-empty` `.map-list` `.map-main` `.map-meta` `.map-node` `.map-pillars` `.map-rule` `.map-svg` `.map-title` `.map-tool` `.map-tools` `.map-who` `.map-who-i` `.map-who-n` `.map-word` `.map-wrap` |
| 404 | 397 | - **`studio/feed_style.ts`** — the home feed's cards, its composer and the apps rail: `.composer` `.composer-bar` `.fcard-form` `.fcard-reason` `.fcard-reply` `.fcard-text` `.fcard-unblock` `.fcard-who` `.fcard-why` `.feed` `.feed-head` `.kpi-spark` `.home-app` `.home-apps` `.home-apps-verbs` `.home-pick` `.home-rail` `.home-tabs` |
| 405 | 398 |
src/web/studio/home.ts +34 −32
| @@ -35,8 +35,10 @@ import { | ||
| 35 | 35 | card, |
| 36 | 36 | empty, |
| 37 | 37 | envStateBadge, |
| 38 | field as fieldInput, | |
| 38 | 39 | icon, |
| 39 | 40 | listCard, |
| 41 | row, | |
| 40 | 42 | timeAgo, |
| 41 | 43 | } from "../ui.ts"; |
| 42 | 44 | import { |
| @@ -416,15 +418,15 @@ function frontControls(ctx: Ctx, front: FrontPage): Html { | ||
| 416 | 418 | ...(front.featured !== undefined && !front.featured.pinned ? [front.featured] : []), |
| 417 | 419 | ...front.shelf.filter((e) => !e.pinned), |
| 418 | 420 | ]; |
| 419 | const row = (label: string, controls: Html): Html => | |
| 420 | html`<li class="row front-pick"> | |
| 421 | <span class="mono truncate">${label}</span> | |
| 422 | <span class="spacer"></span>${controls} | |
| 423 | </li>`; | |
| 421 | const pick = (label: string, controls: Html): Html => | |
| 422 | row({ | |
| 423 | title: html`<span class="mono">${label}</span>`, | |
| 424 | trail: controls, | |
| 425 | }); | |
| 424 | 426 | return card( |
| 425 | 427 | html`<ul class="list"> |
| 426 | 428 | ${picks.pinned.map((repo, at) => |
| 427 | row( | |
| 429 | pick( | |
| 428 | 430 | `${at + 1}. ${repo}${shownToStrangers(repo) ? "" : " (private: shown once public)"}`, |
| 429 | 431 | html`${when(at > 0, () => act("up", repo, "Up"))} |
| 430 | 432 | ${when(at < picks.pinned.length - 1, () => act("down", repo, "Down"))} |
| @@ -432,42 +434,42 @@ function frontControls(ctx: Ctx, front: FrontPage): Html { | ||
| 432 | 434 | ), |
| 433 | 435 | )} |
| 434 | 436 | ${unpinnedShown.map((e) => |
| 435 | row(name(e), html`${act("pin", name(e), "Pin")} ${act("hide", name(e), "Hide")}`), | |
| 437 | pick(name(e), html`${act("pin", name(e), "Pin")} ${act("hide", name(e), "Hide")}`), | |
| 436 | 438 | )} |
| 437 | 439 | ${picks.hidden.map((repo) => |
| 438 | row(`${repo} (hidden)`, act("show", repo, "Show")), | |
| 440 | pick(`${repo} (hidden)`, act("show", repo, "Show")), | |
| 439 | 441 | )} |
| 440 | 442 | </ul> |
| 441 | <form method="post" action="/front" class="bar front-pin-any"> | |
| 443 | <div class="card-body"> | |
| 444 | <form method="post" action="/front" class="bar field-row"> | |
| 442 | 445 | <input type="hidden" name="action" value="pin" /> |
| 443 | <input | |
| 444 | class="input" | |
| 445 | name="repo" | |
| 446 | placeholder="owner/name" | |
| 447 | aria-label="Repository to pin" | |
| 448 | required | |
| 449 | /> | |
| 446 | ${fieldInput({ | |
| 447 | label: "Repository to pin", | |
| 448 | name: "repo", | |
| 449 | placeholder: "owner/name", | |
| 450 | required: true, | |
| 451 | mono: true, | |
| 452 | spellcheck: false, | |
| 453 | })} | |
| 450 | 454 | ${btn("Pin", { size: "sm" })} |
| 451 | 455 | </form> |
| 452 | <form method="post" action="/front" class="front-weights"> | |
| 456 | <form method="post" action="/front" class="bar field-row mt"> | |
| 453 | 457 | <input type="hidden" name="action" value="weights" /> |
| 454 | <span class="small muted">What counts, 0 to ${WEIGHT_MAX}:</span> | |
| 455 | ${WEIGHT_NAMES.map( | |
| 456 | (k) => | |
| 457 | html`<label class="small" | |
| 458 | >${WEIGHT_LABEL[k]} | |
| 459 | <input | |
| 460 | class="input" | |
| 461 | type="number" | |
| 462 | min="0" | |
| 463 | max="${WEIGHT_MAX}" | |
| 464 | step="0.5" | |
| 465 | name="${k}" | |
| 466 | value="${String(picks.weights[k])}" | |
| 467 | /></label>`, | |
| 458 | <p class="muted">What counts, 0 to ${WEIGHT_MAX}:</p> | |
| 459 | ${WEIGHT_NAMES.map((k) => | |
| 460 | fieldInput({ | |
| 461 | label: WEIGHT_LABEL[k], | |
| 462 | name: k, | |
| 463 | type: "number", | |
| 464 | min: 0, | |
| 465 | max: WEIGHT_MAX, | |
| 466 | step: 0.5, | |
| 467 | value: String(picks.weights[k]), | |
| 468 | }), | |
| 468 | 469 | )} |
| 469 | 470 | ${btn("Rank", { size: "sm" })} |
| 470 | 471 | </form> |
| 472 | </div> | |
| 471 | 473 | <p class="small muted"> |
| 472 | 474 | The first pin a stranger can read is featured; the rest lead the |
| 473 | 475 | shelf in this order. The same setting: |
| @@ -555,7 +557,7 @@ export function studioDoor(ctx: Ctx): Response { | ||
| 555 | 557 | })} |
| 556 | 558 | </div>` |
| 557 | 559 | : null} |
| 558 | ${when(admin, () => html`<div class="mt front-admin">${frontControls(ctx, front)}</div>`)}`; | |
| 560 | ${when(admin, () => html`<div class="mt">${frontControls(ctx, front)}</div>`)}`; | |
| 559 | 561 | return page({ ctx, title: "forge", body }); |
| 560 | 562 | } |
| 561 | 563 |
src/web/style/content.ts −7
| @@ -481,13 +481,6 @@ form.inline { display: inline; margin-left: auto; } | ||
| 481 | 481 | .front-issues li { min-width: 0; } |
| 482 | 482 | .front-issues a { color: inherit; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } |
| 483 | 483 | .front-more { text-align: center; } |
| 484 | .front-admin { max-width: 1040px; margin-inline: auto; } | |
| 485 | .front-pick { gap: 8px; } | |
| 486 | .front-pick form.inline { margin-left: 0; } | |
| 487 | .front-pin-any { padding: 12px 16px; flex-wrap: nowrap; } | |
| 488 | .front-weights { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 0 16px 12px; } | |
| 489 | .front-weights .input { width: 4.5em; margin-left: 4px; } | |
| 490 | .front-pin-any .input { flex: 1; min-width: 0; } | |
| 491 | 484 | .front-controls .small { padding: 0 16px 14px; } |
| 492 | 485 | @media (max-width: 520px) { |
| 493 | 486 | /* Two to a row on a phone: a few live apps in one screen, not a scroll. */ |
src/web/ui.ts +7
| @@ -1093,6 +1093,10 @@ export interface FieldOptions { | ||
| 1093 | 1093 | pattern?: string; |
| 1094 | 1094 | minlength?: number; |
| 1095 | 1095 | maxlength?: number; |
| 1096 | /** Bounds and step of a `number` field. */ | |
| 1097 | min?: number; | |
| 1098 | max?: number; | |
| 1099 | step?: number; | |
| 1096 | 1100 | rows?: number; |
| 1097 | 1101 | mono?: boolean; |
| 1098 | 1102 | /** `false` for names and paths, which a spelling checker only underlines. */ |
| @@ -1128,6 +1132,9 @@ ${o.value ?? ""}</textarea | ||
| 1128 | 1132 | ${o.pattern ? html`pattern="${o.pattern}"` : null} |
| 1129 | 1133 | ${o.minlength !== undefined ? html`minlength="${o.minlength}"` : null} |
| 1130 | 1134 | ${o.maxlength !== undefined ? html`maxlength="${o.maxlength}"` : null} |
| 1135 | ${o.min !== undefined ? html`min="${String(o.min)}"` : null} | |
| 1136 | ${o.max !== undefined ? html`max="${String(o.max)}"` : null} | |
| 1137 | ${o.step !== undefined ? html`step="${String(o.step)}"` : null} | |
| 1131 | 1138 | />`; |
| 1132 | 1139 | return html`<div class="field" ${o.error ? raw("data-invalid") : null}> |
| 1133 | 1140 | <label for="${id}">${o.label}</label> |
test/front.test.ts +9 −1
| @@ -758,7 +758,15 @@ describe("the front page", () => { | ||
| 758 | 758 | expect(asAdmin.picks.weights).toEqual({ forks: 10, ships: 0, use: 0, fresh: 0 }); |
| 759 | 759 | const cookie = await signIn("owner"); |
| 760 | 760 | const page = await (await fetch(`${base}/front`, { headers: { cookie } })).text(); |
| 761 | expect(page).toMatch(/name="forks"\s+value="10"/); | |
| 761 | expect(page).toMatch(/name="forks"[^>]*value="10"/); | |
| 762 | for (const old of ["front-admin", "front-pick", "front-pin-any", "front-weights"]) | |
| 763 | expect(page).not.toContain(old); | |
| 764 | expect(page).toContain('name="repo"'); | |
| 765 | const forksInput = page.match(/<input[^>]*name="forks"[^>]*>/)?.[0] ?? ""; | |
| 766 | expect(forksInput).toContain('min="0"'); | |
| 767 | expect(forksInput).toContain('max="10"'); | |
| 768 | expect(forksInput).toContain('step="0.5"'); | |
| 769 | expect(page).toContain('<div class="card-body">'); | |
| 762 | 770 | const reset = await fetch(`${base}/front`, { |
| 763 | 771 | method: "POST", |
| 764 | 772 | headers: { cookie, origin: base }, |
new above
offline