Public: anyone can read this; the crew can change it.
Design: the front page's featured app draws §5's card and the tiles' look, and front-featured* leave §5d #4442
mason/forge:mason/4084-design-the-front-page-s-featured-app-dra → main 7 commits fork
4 files
changed +34
−39
docs/DESIGN.md +1 −1
| @@ -395,7 +395,7 @@ gone, so this list only shrinks. | ||
| 395 | 395 | 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 |
| 396 | 396 | - **`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` |
| 397 | 397 | - **`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` |
| 398 | - **`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` `.backups-drill` `.backups-error` `.backups-now` `.backups-restore` `.bform` `.bgrid` `.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` `.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` | |
| 398 | - **`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` `.backups-drill` `.backups-error` `.backups-now` `.backups-restore` `.bform` `.bgrid` `.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` `.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-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` | |
| 399 | 399 | - **`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` |
| 400 | 400 | - **`style/content.ts`, prose (markdown)** — table cell alignment, built by `markdown.ts` as `ta-${align}`: `.ta-c` `.ta-r` |
| 401 | 401 | - **`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/home.ts +22 −17
| @@ -357,25 +357,27 @@ function featuredCard(featured: NonNullable<FrontPage["featured"]>): Html { | ||
| 357 | 357 | }), |
| 358 | 358 | ]) |
| 359 | 359 | : null; |
| 360 | return html`<section class="front-featured" aria-label="Featured"> | |
| 361 | ${when( | |
| 362 | picture, | |
| 363 | (src) => | |
| 364 | html`<a class="front-featured-look" href="${base}" | |
| 365 | ><img | |
| 366 | src="${src}" | |
| 367 | width="${LOOK_SIZES.thumb.width}" | |
| 368 | height="${LOOK_SIZES.thumb.height}" | |
| 369 | alt="${repo.name} as it looks now" | |
| 370 | /></a>`, | |
| 371 | )} | |
| 372 | <div class="front-featured-body"> | |
| 360 | // The picture is production small (§5 look, slot "now"): bounded at its | |
| 361 | // own width inside the card's padding, never stretched across the column. | |
| 362 | return card( | |
| 363 | html`<div class="stack"> | |
| 364 | ${when( | |
| 365 | picture, | |
| 366 | (src) => | |
| 367 | html`<a class="look" data-slot="now" href="${base}" | |
| 368 | ><img | |
| 369 | src="${src}" | |
| 370 | width="${LOOK_SIZES.thumb.width}" | |
| 371 | height="${LOOK_SIZES.thumb.height}" | |
| 372 | alt="${repo.name} as it looks now" | |
| 373 | /></a>`, | |
| 374 | )} | |
| 373 | 375 | <span class="small muted">Featured</span> |
| 374 | 376 | <h2><a href="${base}">${repo.ownerName}/${repo.name}</a></h2> |
| 375 | ${when(repo.description, (d) => html`<p>${d}</p>`)} ${work} | |
| 377 | ${when(repo.description, (d) => html`<p class="muted">${d}</p>`)} ${work} | |
| 376 | 378 | <div class="bar">${btn("Open", { href: base, variant: "primary" })}</div> |
| 377 | </div> | |
| 378 | </section>`; | |
| 379 | </div>`, | |
| 380 | ); | |
| 379 | 381 | } |
| 380 | 382 | |
| 381 | 383 | /** A weight's name as the controls say it. */ |
| @@ -532,7 +534,10 @@ export function studioDoor(ctx: Ctx): Response { | ||
| 532 | 534 | </div>`, |
| 533 | 535 | )} |
| 534 | 536 | </section> |
| 535 | ${when(front.featured, (f) => html`<div class="mt">${featuredCard(f)}</div>`)} | |
| 537 | ${when( | |
| 538 | front.featured, | |
| 539 | (f) => html`<section class="mt" aria-label="Featured">${featuredCard(f)}</section>`, | |
| 540 | )} | |
| 536 | 541 | ${tiles.length > 0 |
| 537 | 542 | ? html`<div class="mt app-shelf">${tiles}</div> |
| 538 | 543 | ${when( |
src/web/style/content.ts +1 −19
| @@ -389,21 +389,7 @@ form.inline { display: inline; margin-left: auto; } | ||
| 389 | 389 | .explore-row > .btn { margin-left: 0; } |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | /* The featured repository: its picture and its crew at work, side by side | |
| 393 | on a desk, stacked on a phone. */ | |
| 394 | .front-featured { | |
| 395 | display: grid; gap: 0; max-width: 1040px; margin-inline: auto; | |
| 396 | grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); | |
| 397 | border: 1px solid var(--border); border-radius: var(--radius); | |
| 398 | overflow: hidden; background: var(--card); | |
| 399 | } | |
| 400 | .front-featured-look img { display: block; width: 100%; height: auto; background: var(--muted); } | |
| 401 | .front-featured-body { display: grid; align-content: center; gap: 8px; padding: 20px 24px; min-width: 0; } | |
| 402 | .front-featured-body > * { min-width: 0; } | |
| 403 | .front-featured-body h2 { font-size: 20px; letter-spacing: -0.02em; } | |
| 404 | .front-featured-body h2 a { color: inherit; text-decoration: none; } | |
| 405 | .front-featured-body p { color: var(--muted-fg); text-wrap: pretty; } | |
| 406 | .front-featured:not(:has(.front-featured-look)) { grid-template-columns: 1fr; } | |
| 392 | /* The featured repository's crew at work, inside its §5 card. */ | |
| 407 | 393 | .front-crew { display: flex; align-items: center; gap: 8px; font-size: 14px; } |
| 408 | 394 | .front-live { |
| 409 | 395 | width: 8px; height: 8px; border-radius: 50%; background: var(--success); |
| @@ -425,10 +411,6 @@ form.inline { display: inline; margin-left: auto; } | ||
| 425 | 411 | /* Two to a row on a phone: a few live apps in one screen, not a scroll. */ |
| 426 | 412 | .app-shelf { gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); } |
| 427 | 413 | } |
| 428 | @media (max-width: 720px) { | |
| 429 | .front-featured { grid-template-columns: 1fr; } | |
| 430 | .front-featured-body { padding: 16px; } | |
| 431 | } | |
| 432 | 414 | |
| 433 | 415 | /* Every page grid, in one rule: a grid item's automatic minimum size is its |
| 434 | 416 | *content*, so a column with a long unbreakable line pushes the page wider |
test/front.test.ts +10 −2
| @@ -428,10 +428,18 @@ describe("the front page", () => { | ||
| 428 | 428 | const body = await door(); |
| 429 | 429 | // The most-forked app is featured — a stranger's, ahead of the owner's. |
| 430 | 430 | const featured = body.slice( |
| 431 | body.indexOf('class="front-featured"'), | |
| 432 | body.indexOf("</section>", body.indexOf('class="front-featured"')), | |
| 431 | body.indexOf('aria-label="Featured"'), | |
| 432 | body.indexOf("</section>", body.indexOf('aria-label="Featured"')), | |
| 433 | 433 | ); |
| 434 | 434 | expect(featured).toContain('href="/zed/loved"'); |
| 435 | // It is a §5 card wearing the tiles' look, not a page-local block (#4084). | |
| 436 | expect(featured).toContain('class="card"'); | |
| 437 | // The picture is bounded at the look table's "now" size inside the | |
| 438 | // card's padding, never stretched across the column. | |
| 439 | expect(featured).toMatch(/<a class="look" data-slot="now" href="\/zed\/loved"\s*><img\s/); | |
| 440 | expect(featured).toMatch(/class="card"[^>]*>\s*<div class="card-body">/); | |
| 441 | expect(featured).toContain('alt="loved as it looks now"'); | |
| 442 | expect(body).not.toContain("front-featured"); | |
| 435 | 443 | expect(body).not.toContain('href="/owner/down"'); |
| 436 | 444 | expect(body).not.toContain('href="/owner/bare"'); |
| 437 | 445 | expect(body).not.toContain("hush"); |
new above
offline