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

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/4085-design-the-front-page-s-admin-controls-d → main 0 commits fork 2 threads · 2 unresolved

  • Merged. scout/4085-design-the-front-page-s-admin-controls-d was merged into main as fbe2465.

Review

Sign in to review this change.
4 files changed +29 −16
docs/design/areas/front.md −3
@@ -3,9 +3,6 @@
33 The studio's front page (`studioDoor()` in `src/web/studio/home.ts`) shows an admin, under the shelf of public apps, the
44 controls that pick what the shelf shows; strangers never see them. The rules live in `src/web/style/content.ts`.
55
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
96 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.
107
118 - `.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> = {
445445 function frontControls(ctx: Ctx, front: FrontPage): Html {
446446 const picks = frontPicksJson(ctx.app);
447447 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">

Principle 3 (space between things, not padding on everything): this .bar form sits inside a row, and .card[data-front-settings] .bar in content.ts adds padding: 12px 16px to 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.

449449 <input type="hidden" name="action" value="${action}" />
450450 <input type="hidden" name="repo" value="${repo}" />
451451 ${btn(label, { size: "sm" })}
@@ -461,7 +461,7 @@ function frontControls(ctx: Ctx, front: FrontPage): Html {
461461 ...front.shelf.filter((e) => !e.pinned),
462462 ];
463463 const row = (label: string, controls: Html): Html =>
464 html`<li class="row front-pick">
464 html`<li class="row">
465465 <span class="mono truncate">${label}</span>
466466 <span class="spacer"></span>${controls}
467467 </li>`;
@@ -498,17 +498,19 @@ function frontControls(ctx: Ctx, front: FrontPage): Html {
498498 <span class="small muted">What counts, 0 to ${WEIGHT_MAX}:</span>
499499 ${WEIGHT_NAMES.map(
500500 (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>
503503 <input
504504 class="input"
505 id="front-weight-${k}"
505506 type="number"
506507 min="0"
507508 max="${WEIGHT_MAX}"
508509 step="0.5"
509510 name="${k}"
510511 value="${String(picks.weights[k])}"
511 /></label>`,
512 />
513 </div>`,
512514 )}
513515 ${btn("Rank", { size: "sm" })}
514516 </form>
@@ -882,7 +884,7 @@ export function studioDoor(ctx: Ctx): Response {
882884 Building internal applications for an organization? <a href="https://www.open-platform.sh/">Open Platform</a> runs
883885 them on your own infrastructure. <a href="https://www.espodev.com">EspoDev</a> deploys and supports it.
884886 </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>`)}
886888 </div>`;
887889 const res = page({
888890 ctx,
src/web/style/content.ts +4 −7
@@ -393,13 +393,10 @@ form.inline { display: inline; margin-left: auto; }
393393 @keyframes door-pulse { 50% { opacity: 0.35; } }
394394 }
395395
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; }
outdated

This .bar rule, and the two :has(> [name=repo]) / > [name=repo] rules below it, now match the row action forms, which carry a hidden repo input. Limit them to the two form bars under the list, for example .card[data-front-settings] > .bar, or whatever the card's body nesting allows.

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; }
403400 .card[data-front-settings] .small { padding: 0 16px 14px; }
404401 @media (max-width: 520px) {
405402 /* 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", () => {
516516 ).text();
517517 expect(page).toContain("The front page");
518518 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"');
519536 const moved = await fetch(`${base}/front`, {
520537 method: "POST",
521538 headers: { cookie, origin: base },

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs