Public: anyone can read this; the crew can change it.
Design: /explore's rows and filters use §5's row and filters, and the explore-* classes leave §5d #4426
mason/forge:mason/3801-design-explore-s-rows-and-filters-use-5 → main 14 commits fork
6 files
changed +43
−57
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, 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` `.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` | |
| 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/pages/limb_view.ts +1 −1
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /** |
| 2 | * The parts the milestone and limb pages share, drawn from the §5 | |
| 2 | * The parts the milestone, limb and explore pages share, drawn from the §5 | |
| 3 | 3 | * components: an issue as a row, and a list that folds its tail. No styling of their own. |
| 4 | 4 | */ |
| 5 | 5 |
src/web/studio/explore.ts +20 −26
| @@ -18,7 +18,8 @@ import type { Ctx } from "../../http/context.ts"; | ||
| 18 | 18 | import { pageHead } from "../chrome.ts"; |
| 19 | 19 | import { html, when, type Html } from "../html.ts"; |
| 20 | 20 | import { page } from "../layout.ts"; |
| 21 | import { btn, empty, listCard, nameMark, seg, timeAgo } from "../ui.ts"; | |
| 21 | import { wrappedCard } from "../pages/limb_view.ts"; | |
| 22 | import { btn, empty, nameMark, row as listRow, seg, timeAgo } from "../ui.ts"; | |
| 22 | 23 | |
| 23 | 24 | const href = (query: ExploreQuery): string => { |
| 24 | 25 | const line = exploreLine(query); |
| @@ -39,27 +40,20 @@ function numbers(row: ExploreRow): string { | ||
| 39 | 40 | } |
| 40 | 41 | |
| 41 | 42 | function rowHtml(row: ExploreRow): Html { |
| 42 | const said = numbers(row); | |
| 43 | return html`<li class="row explore-row"> | |
| 44 | <span class="explore-main"> | |
| 45 | <a class="explore-name" href="${row.url}">${row.name}</a | |
| 46 | >${nameMark(row.mark)} | |
| 47 | ${when( | |
| 48 | row.description, | |
| 49 | (d) => html`<span class="muted small truncate">${d}</span>`, | |
| 50 | )} | |
| 51 | ${when(said, (s) => html`<span class="muted small">${s}</span>`)} | |
| 52 | </span> | |
| 53 | ${when( | |
| 54 | row.copyable === true ? row.repo : undefined, | |
| 55 | (repo) => | |
| 56 | btn("Make it yours", { | |
| 57 | href: `/${repo.owner}/${repo.name}/make-it-yours`, | |
| 58 | size: "sm", | |
| 59 | icon: "fork", | |
| 60 | }), | |
| 61 | )} | |
| 62 | </li>`; | |
| 43 | const said = [row.description, numbers(row)].filter((p) => p !== ""); | |
| 44 | return listRow({ | |
| 45 | title: html`<a href="${row.url}">${row.name}</a>${nameMark(row.mark)}`, | |
| 46 | ...(said.length === 0 ? {} : { meta: html`${said.join(" · ")}` }), | |
| 47 | ...(row.copyable === true && row.repo !== undefined | |
| 48 | ? { | |
| 49 | trail: btn("Make it yours", { | |
| 50 | href: `/${row.repo.owner}/${row.repo.name}/make-it-yours`, | |
| 51 | size: "sm", | |
| 52 | icon: "fork", | |
| 53 | }), | |
| 54 | } | |
| 55 | : {}), | |
| 56 | }); | |
| 63 | 57 | } |
| 64 | 58 | |
| 65 | 59 | /** Nothing to list: a bare line means nothing is public yet, not a miss. */ |
| @@ -109,9 +103,9 @@ export async function explorePage(ctx: Ctx): Promise<Response> { | ||
| 109 | 103 | const body = html`${pageHead("Explore", { |
| 110 | 104 | sub: "Apps and their makers, ranked by forks, ships, use and how lately — the numbers on every row.", |
| 111 | 105 | })} |
| 112 | <form method="get" action="/explore" class="bar mb explore-line"> | |
| 106 | <form method="get" action="/explore" class="filters"> | |
| 113 | 107 | <input |
| 114 | class="input mono" | |
| 108 | class="input mono search" | |
| 115 | 109 | name="q" |
| 116 | 110 | value="${exploreLine(query)}" |
| 117 | 111 | placeholder="kind:app sort:forks garden" |
| @@ -121,7 +115,7 @@ export async function explorePage(ctx: Ctx): Promise<Response> { | ||
| 121 | 115 | /> |
| 122 | 116 | ${btn("Go", { size: "sm" })} |
| 123 | 117 | </form> |
| 124 | <div class="filters mb explore-filters"> | |
| 118 | <div class="filters mb"> | |
| 125 | 119 | ${seg( |
| 126 | 120 | kinds.map((k) => ({ |
| 127 | 121 | label: k.label, |
| @@ -145,7 +139,7 @@ export async function explorePage(ctx: Ctx): Promise<Response> { | ||
| 145 | 139 | </div> |
| 146 | 140 | ${rows.length === 0 |
| 147 | 141 | ? emptyState(ctx.auth.user !== undefined, query) |
| 148 | : listCard(rows.map(rowHtml))}`; | |
| 142 | : wrappedCard(rows.map(rowHtml))}`; | |
| 149 | 143 | const response = page({ ctx, title: "Explore", body }); |
| 150 | 144 | notePhase(ctx.request, "render", performance.now() - rendering); |
| 151 | 145 | return response; |
src/web/style/content.ts +2 −28
| @@ -363,31 +363,6 @@ form.inline { display: inline; margin-left: auto; } | ||
| 363 | 363 | grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | /* Explore (#607): a row is a name, a line, its numbers, and one verb. */ | |
| 367 | .explore-row { gap: 12px; } | |
| 368 | .explore-main { display: grid; gap: 2px; min-width: 0; flex: 1; } | |
| 369 | .explore-name { font-weight: 600; } | |
| 370 | .explore-line .input { flex: 1; min-width: 0; } | |
| 371 | /* On a phone the first rows belong on the first screen: one row of chips | |
| 372 | that scrolls sideways, and a row's verb under its numbers. The chips fade | |
| 373 | at the right edge, so a cut one says there is more; where the browser | |
| 374 | ties an animation to scrolling, the fade lifts at the end. */ | |
| 375 | @property --chip-fade { syntax: "<length>"; inherits: false; initial-value: 32px; } | |
| 376 | @keyframes chip-fade { 90% { --chip-fade: 32px; } to { --chip-fade: 0px; } } | |
| 377 | @media (max-width: 600px) { | |
| 378 | .explore-filters { | |
| 379 | flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; | |
| 380 | mask-image: linear-gradient(to right, var(--fg) calc(100% - var(--chip-fade)), transparent); | |
| 381 | } | |
| 382 | @supports (animation-timeline: scroll()) { | |
| 383 | .explore-filters { animation: chip-fade linear both; animation-timeline: scroll(self inline); } | |
| 384 | } | |
| 385 | .explore-filters .seg { flex: none; } | |
| 386 | .explore-row { flex-wrap: wrap; row-gap: 6px; } | |
| 387 | .explore-row > .explore-main { flex-basis: 100%; } | |
| 388 | .explore-row > .btn { margin-left: 0; } | |
| 389 | } | |
| 390 | ||
| 391 | 366 | /* The featured repository: its picture and its crew at work, side by side |
| 392 | 367 | on a desk, stacked on a phone. */ |
| 393 | 368 | .front-featured { |
| @@ -1097,12 +1072,11 @@ textarea.editor:focus-visible { outline: none; } | ||
| 1097 | 1072 | .ask-more-acts[open] > summary { display: none; } |
| 1098 | 1073 | .ask-more-acts > .btn { min-height: 44px; flex: 1 1 auto; } |
| 1099 | 1074 | } |
| 1100 | /* Reduced motion: the pulses hold still at a legible level, the scroll-tied | |
| 1101 | fade stays at its resting width, and these transitions land at once. */ | |
| 1075 | /* Reduced motion: the pulses hold still at a legible level, and these | |
| 1076 | transitions land at once. */ | |
| 1102 | 1077 | @media (prefers-reduced-motion: reduce) { |
| 1103 | 1078 | .front-live, .run-log .ln-pulse i { animation: none; } |
| 1104 | 1079 | .run-log .ln-pulse i { opacity: .6; } |
| 1105 | .explore-filters { animation: none; } | |
| 1106 | 1080 | .ex-dir > summary > .ico, .code-layout > #code-main[aria-busy="true"], .code-layout > [data-split]::after { transition: none; } |
| 1107 | 1081 | } |
| 1108 | 1082 | `; |
test/explore.test.ts +18
| @@ -237,6 +237,24 @@ describe("explore", () => { | ||
| 237 | 237 | expect(names(told.items)).toEqual(names((await api("kind:app sort:ships", bobToken)).items)); |
| 238 | 238 | }); |
| 239 | 239 | |
| 240 | test("the rows and filters are §5's row and filters; the explore-* classes are gone (#3801)", async () => { | |
| 241 | const page = await ( | |
| 242 | await fetch(`${base}/explore`, { | |
| 243 | headers: { authorization: `Bearer ${bobToken}` }, | |
| 244 | }) | |
| 245 | ).text(); | |
| 246 | expect(page).toContain('<ul class="list setting-list">'); | |
| 247 | const loved = | |
| 248 | page.match(/<li>\s*<div class="row"[^>]*>(?:(?!<\/li>)[\s\S])*?href="\/alice\/loved"[\s\S]*?<\/li>/)?.[0] ?? ""; | |
| 249 | expect(loved).toContain('class="row-title"'); | |
| 250 | expect(loved).toMatch(/<span class="row-meta">the loved app · 2 forks/); | |
| 251 | expect(loved).toMatch(/<span class="row-trail">[\s\S]*Make it yours/); | |
| 252 | expect(page).toMatch(/<form method="get" action="\/explore" class="filters">/); | |
| 253 | expect(page).toContain('<div class="filters mb">'); | |
| 254 | for (const old of ["explore-filters", "explore-line", "explore-main", "explore-name", "explore-row"]) | |
| 255 | expect(page).not.toContain(old); | |
| 256 | }); | |
| 257 | ||
| 240 | 258 | test("a suspended account's apps and the account itself are offered to nobody", async () => { |
| 241 | 259 | const sus = await user("sus"); |
| 242 | 260 | await appOf(sus, "susapp"); |
test/name-marks.test.ts +1 −1
| @@ -286,7 +286,7 @@ describe("a name always says who it is", () => { | ||
| 286 | 286 | const row = (name: string) => |
| 287 | 287 | html.match( |
| 288 | 288 | new RegExp( |
| 289 | `<li class="row explore-row">[\\s\\S]*?href="/${name}"[\\s\\S]*?</li>`, | |
| 289 | `<li>\\s*<div class="row"[^>]*>[\\s\\S]*?href="/${name}"[\\s\\S]*?</li>`, | |
| 290 | 290 | ), |
| 291 | 291 | )?.[0] ?? ""; |
| 292 | 292 | expect(marksIn(row("alice"))).toEqual(["owner"]); |
new above
offline