Public: anyone can read this; the crew can change it.
Design: the front page's admin controls draw §5's row, bar and field, and front-admin/pick/pin-any/weights leave §5d #16703
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/4085-design-the-front-page-s-admin-controls-d → main 0 commits fork 2 threads · 2 unresolved
4 files
changed +29
−16
docs/design/areas/front.md −3
| @@ -3,9 +3,6 @@ | ||
| 3 | 3 | The studio's front page (`studioDoor()` in `src/web/studio/home.ts`) shows an admin, under the shelf of public apps, the |
| 4 | 4 | controls that pick what the shelf shows; strangers never see them. The rules live in `src/web/style/content.ts`. |
| 5 | 5 | |
| 6 | - `.front-admin` — the admin's controls under the front page (`studioDoor()` draws it around `frontControls()`), as wide as the shelf above it and centred with it. | |
| 7 | - `.front-pick` — one row of choices in those controls (drawn by `frontControls()`): the entry's name, then its pin, unpin, hide or show buttons at the end, its inline forms without the end margin `form.inline` would give them. | |
| 8 | ||
| 9 | 6 | The page a visitor reads first runs past §3's working scale on purpose, in `clamp()` sizes: it is read once, from a distance, and every other screen is worked in. Its colours are tokens, its section rules are hairlines, its accents are the system monospace, and `.card` and `.look` stay §5's, with the card's frame taken off inside the shelf. `studioDoor()` draws all of these. |
| 10 | 7 | |
| 11 | 8 | - `.door` — the page's frame, with its section rhythm and heading sizes. |
src/web/studio/home.ts +8 −6
| @@ -445,7 +445,7 @@ const WEIGHT_LABEL: Record<(typeof WEIGHT_NAMES)[number], string> = { | ||
| 445 | 445 | function frontControls(ctx: Ctx, front: FrontPage): Html { |
| 446 | 446 | const picks = frontPicksJson(ctx.app); |
| 447 | 447 | const act = (action: string, repo: string, label: string): Html => |
| 448 | html`<form method="post" action="/front" class="inline"> | |
| 448 | html`<form method="post" action="/front" class="bar"> | |
| 449 | 449 | <input type="hidden" name="action" value="${action}" /> |
| 450 | 450 | <input type="hidden" name="repo" value="${repo}" /> |
| 451 | 451 | ${btn(label, { size: "sm" })} |
| @@ -461,7 +461,7 @@ function frontControls(ctx: Ctx, front: FrontPage): Html { | ||
| 461 | 461 | ...front.shelf.filter((e) => !e.pinned), |
| 462 | 462 | ]; |
| 463 | 463 | const row = (label: string, controls: Html): Html => |
| 464 | html`<li class="row front-pick"> | |
| 464 | html`<li class="row"> | |
| 465 | 465 | <span class="mono truncate">${label}</span> |
| 466 | 466 | <span class="spacer"></span>${controls} |
| 467 | 467 | </li>`; |
| @@ -498,17 +498,19 @@ function frontControls(ctx: Ctx, front: FrontPage): Html { | ||
| 498 | 498 | <span class="small muted">What counts, 0 to ${WEIGHT_MAX}:</span> |
| 499 | 499 | ${WEIGHT_NAMES.map( |
| 500 | 500 | (k) => |
| 501 | html`<label class="small" | |
| 502 | >${WEIGHT_LABEL[k]} | |
| 501 | html`<div class="field"> | |
| 502 | <label for="front-weight-${k}">${WEIGHT_LABEL[k]}</label> | |
| 503 | 503 | <input |
| 504 | 504 | class="input" |
| 505 | id="front-weight-${k}" | |
| 505 | 506 | type="number" |
| 506 | 507 | min="0" |
| 507 | 508 | max="${WEIGHT_MAX}" |
| 508 | 509 | step="0.5" |
| 509 | 510 | name="${k}" |
| 510 | 511 | value="${String(picks.weights[k])}" |
| 511 | /></label>`, | |
| 512 | /> | |
| 513 | </div>`, | |
| 512 | 514 | )} |
| 513 | 515 | ${btn("Rank", { size: "sm" })} |
| 514 | 516 | </form> |
| @@ -882,7 +884,7 @@ export function studioDoor(ctx: Ctx): Response { | ||
| 882 | 884 | Building internal applications for an organization? <a href="https://www.open-platform.sh/">Open Platform</a> runs |
| 883 | 885 | them on your own infrastructure. <a href="https://www.espodev.com">EspoDev</a> deploys and supports it. |
| 884 | 886 | </p> |
| 885 | ${when(admin, () => html`<div class="door-section front-admin">${frontControls(ctx, front)}</div>`)} | |
| 887 | ${when(admin, () => html`<div class="door-section">${frontControls(ctx, front)}</div>`)} | |
| 886 | 888 | </div>`; |
| 887 | 889 | const res = page({ |
| 888 | 890 | ctx, |
src/web/style/content.ts +4 −7
| @@ -393,13 +393,10 @@ form.inline { display: inline; margin-left: auto; } | ||
| 393 | 393 | @keyframes door-pulse { 50% { opacity: 0.35; } } |
| 394 | 394 | } |
| 395 | 395 | |
| 396 | .front-admin { max-width: 1040px; margin-inline: auto; } | |
| 397 | .front-pick { gap: 8px; } | |
| 398 | .front-pick form.inline { margin-left: 0; } | |
| 399 | .card[data-front-settings] .bar { padding: 12px 16px; gap: 8px 12px; } | |
| 400 | .card[data-front-settings] .bar:has(> [name=repo]) { flex-wrap: nowrap; } | |
| 401 | .card[data-front-settings] .bar > [name=repo] { flex: 1; min-width: 0; } | |
| 402 | .card[data-front-settings] label .input { width: 4.5em; margin-left: 4px; } | |
| 396 | .card[data-front-settings] .list ~ .bar { padding: 12px 16px; gap: 8px 12px; } | |
| 397 | .card[data-front-settings] .list ~ .bar:has(> [name=repo]) { flex-wrap: nowrap; } | |
| 398 | .card[data-front-settings] .list ~ .bar > [name=repo] { flex: 1; min-width: 0; } | |
| 399 | .card[data-front-settings] .field .input { width: 4.5em; } | |
| 403 | 400 | .card[data-front-settings] .small { padding: 0 16px 14px; } |
| 404 | 401 | @media (max-width: 520px) { |
| 405 | 402 | /* Two to a row on a phone: a few live apps in one screen, not a scroll. */ |
test/front.test.ts +17
| @@ -516,6 +516,23 @@ describe("the front page", () => { | ||
| 516 | 516 | ).text(); |
| 517 | 517 | expect(page).toContain("The front page"); |
| 518 | 518 | expect(page).toContain("owner/forge"); |
| 519 | // Drawn from §5's row, bar and field; the old names are gone and every | |
| 520 | // form posts to /front with the fields it always did. | |
| 521 | for (const old of ["front-admin", "front-pick", "front-pin-any", "front-weights"]) | |
| 522 | expect(page).not.toContain(old); | |
| 523 | const forms = [...page.matchAll(/<form method="post" action="\/front"[^>]*>([\s\S]*?)<\/form>/g)].map( | |
| 524 | (m) => [...m[1]!.matchAll(/name="([a-z]+)"/g)].map((n) => n[1]), | |
| 525 | ); | |
| 526 | expect(forms.some((f) => f.join() === "action,repo")).toBe(true); | |
| 527 | expect(forms.some((f) => f.join() === "action,forks,ships,use,fresh")).toBe(true); | |
| 528 | // The padded bar rules reach only the two form bars after the list, | |
| 529 | // never the one-line action forms inside each row. | |
| 530 | const href = page.match(/<link rel="stylesheet" href="([^"]+)"/)![1]!; | |
| 531 | const css = await (await fetch(`${base}${href}`)).text(); | |
| 532 | expect(css).not.toContain("front-settings] .bar"); | |
| 533 | expect(css).toContain("front-settings] .list ~ .bar {"); | |
| 534 | expect(page).toContain('class="row"'); | |
| 535 | expect(page).toContain('class="field"'); | |
| 519 | 536 | const moved = await fetch(`${base}/front`, { |
| 520 | 537 | method: "POST", |
| 521 | 538 | headers: { cookie, origin: base }, |
new above
offline
Principle 3 (space between things, not padding on everything): this
.barform sits inside arow, and.card[data-front-settings] .barin content.ts addspadding: 12px 16pxto it. Every row's button forms get fat padding. Scope that rule to the Pin-by-name and weights bars only, or the rows balloon on a phone.