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

Parked opened this
Closed without merging

scout/forge:scout/3941-design-the-front-page-s-admin-controls-u → main 9 commits fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
5 files changed +50 −47
docs/DESIGN.md −7
@@ -393,13 +393,6 @@ 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 - **`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`
395395 - **`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
403396 - **`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`
404397 - **`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`
405398
src/web/studio/home.ts +34 −32
@@ -35,8 +35,10 @@ import {
3535 card,
3636 empty,
3737 envStateBadge,
38 field as fieldInput,
3839 icon,
3940 listCard,
41 row,
4042 timeAgo,
4143 } from "../ui.ts";
4244 import {
@@ -416,15 +418,15 @@ function frontControls(ctx: Ctx, front: FrontPage): Html {
416418 ...(front.featured !== undefined && !front.featured.pinned ? [front.featured] : []),
417419 ...front.shelf.filter((e) => !e.pinned),
418420 ];
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 });
424426 return card(
425427 html`<ul class="list">
426428 ${picks.pinned.map((repo, at) =>
427 row(
429 pick(
428430 `${at + 1}. ${repo}${shownToStrangers(repo) ? "" : " (private: shown once public)"}`,
429431 html`${when(at > 0, () => act("up", repo, "Up"))}
430432 ${when(at < picks.pinned.length - 1, () => act("down", repo, "Down"))}
@@ -432,42 +434,42 @@ function frontControls(ctx: Ctx, front: FrontPage): Html {
432434 ),
433435 )}
434436 ${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")}`),
436438 )}
437439 ${picks.hidden.map((repo) =>
438 row(`${repo} (hidden)`, act("show", repo, "Show")),
440 pick(`${repo} (hidden)`, act("show", repo, "Show")),
439441 )}
440442 </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">
442445 <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 })}
450454 ${btn("Pin", { size: "sm" })}
451455 </form>
452 <form method="post" action="/front" class="front-weights">
456 <form method="post" action="/front" class="bar field-row mt">
453457 <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 }),
468469 )}
469470 ${btn("Rank", { size: "sm" })}
470471 </form>
472 </div>
471473 <p class="small muted">
472474 The first pin a stranger can read is featured; the rest lead the
473475 shelf in this order. The same setting:
@@ -555,7 +557,7 @@ export function studioDoor(ctx: Ctx): Response {
555557 })}
556558 </div>`
557559 : 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>`)}`;
559561 return page({ ctx, title: "forge", body });
560562 }
561563
src/web/style/content.ts −7
@@ -481,13 +481,6 @@ form.inline { display: inline; margin-left: auto; }
481481 .front-issues li { min-width: 0; }
482482 .front-issues a { color: inherit; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
483483 .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; }
491484 .front-controls .small { padding: 0 16px 14px; }
492485 @media (max-width: 520px) {
493486 /* 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 {
10931093 pattern?: string;
10941094 minlength?: number;
10951095 maxlength?: number;
1096 /** Bounds and step of a `number` field. */
1097 min?: number;
1098 max?: number;
1099 step?: number;
10961100 rows?: number;
10971101 mono?: boolean;
10981102 /** `false` for names and paths, which a spelling checker only underlines. */
@@ -1128,6 +1132,9 @@ ${o.value ?? ""}</textarea
11281132 ${o.pattern ? html`pattern="${o.pattern}"` : null}
11291133 ${o.minlength !== undefined ? html`minlength="${o.minlength}"` : null}
11301134 ${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}
11311138 />`;
11321139 return html`<div class="field" ${o.error ? raw("data-invalid") : null}>
11331140 <label for="${id}">${o.label}</label>
test/front.test.ts +9 −1
@@ -758,7 +758,15 @@ describe("the front page", () => {
758758 expect(asAdmin.picks.weights).toEqual({ forks: 10, ships: 0, use: 0, fresh: 0 });
759759 const cookie = await signIn("owner");
760760 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">');
762770 const reset = await fetch(`${base}/front`, {
763771 method: "POST",
764772 headers: { cookie, origin: base },

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs