Public: anyone can read this; the crew can change it.

Design: the inbox's ask cards use §5's card and buttons, and the ask-* classes leave §5d #3905

Parked opened this
Closed without merging

scout/forge:scout/3876-design-the-inbox-s-ask-cards-use-5-s-car → main 3 commits fork 1 thread · 1 unresolved

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
7 files changed +83 −77
docs/DESIGN.md +2 −2
@@ -156,7 +156,7 @@ specification.
156156 | **progress bar** `progress()` (`pages/milestones.ts`) | `progress` (element rule in `style/components.ts`; every `<progress>` on the site except `.tests-bar`, the run page's own bar) | — | native `<progress max value>`, 4px, full width, an `aria-label` saying what is done; no width rule per value | `▓▓▓░░ 3 of 5` |
157157 | **meter** `meter()` | `meter` | `data-tone=attn` when the share is a limit reached | native `<meter min=0 max=100>`, a whole percentage, an `aria-label` saying what it is a share of; no width rule per value, so no inline style | `▓▓▓░░ 62%` |
158158 | **kbd** `kbd()` | `kbd` | — | — | a reverse-video key name |
159 | **card** `card()` / `listCard()` | `.card` (`.card-head`, `.card-links`, `.card-body`, `.card-foot`) | `data-tone=success\|danger\|merged\|attn` | — | a box with a title bar |
159 | **card** `card()` / `listCard()` | `.card` (`.card-head`, `.card-links`, `.card-body`, `.card-foot`) | `data-tone=success\|danger\|merged\|attn`; `data-variant=ask` is the inbox's decision card (parts by `data-part`: kind, meta, short, pick, box, group, more), edge to edge on a phone, with its actions in `.bar[data-variant=split]` | — | a box with a title bar |
160160 | **list row** `row()` | `.row` (`.row-lead`, `.row-main`, `.row-title`, `.row-meta`, `.row-trail`, `.row-actions`; settings: `.setting-list`, `.row-fields`) | `data-state=open\|closed\|merged\|draft` — colours the **lead glyph**, so a list filtered by state carries no badge repeating the filter | hover, focus, `data-nav`; `fold` makes the row a `<details>`'s `<summary>`, its lead the caret turned when open (/map's lanes); `.row-meta` is one honest line: nowrap, ellipsis, `title` — except in a `.setting-list`, where it wraps | one line: glyph, title, right-aligned meta |
161161 | **edit row** | `.edit-row` | — | one line on a desktop, stacked below 720px | a form line |
162162 | **colour field** | `.color-field` | — | native `<input type=color>` plus its hex; works with no script | a hex entry |
@@ -391,7 +391,7 @@ gone, so this list only shrinks.
391391 - **`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`
392392 - **`style/content.ts`, apps, runs, and the crew** — run pages, their logs and checks (a pull's look is §5's **look**): `.app-url` `.check-progress` `.check-steps` `.ln-forge` `.ln-pulse` `.ln-say` `.ln-tool` `.ln-you` `.log-tail-row` `.pinned-failures` `.pinned-slot` `.run-actions` `.run-jump` `.run-live` `.run-steer` `.run-summary` `.step-state` `.tests-bar` `.tests-words` `.txt` `.who`
393393 - **`style/content.ts`, the code browser: explorer beside content** — the explorer column's own parts: `.code-main` `.code-split` `.ex-empty` `.ex-find` `.ex-head` `.ex-list` `.ex-name` `.ex-ref` `.ex-twist` `.explorer-toggle`
394 - **`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`
394 - **`style/content.ts`, search results** — search results, the client list and the claim link: `.claim-link-box` `.forges-sent` `.live-toggle` `.needs-you` `.no-hits`
395395 - **`pages/board.ts`** — the spend tables `spend.ts` draws, first on the board (the board itself is §5's **board**): `.spend-table` `.spend-totals`
396396 - **`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`
397397 - **`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` `.kpi-note` `.kpi-spark` `.kpi-value` `.kpis` `.home-app` `.home-apps` `.home-apps-verbs` `.home-pick` `.home-rail` `.home-tabs`
docs/design/baseline.json +1 −1
@@ -2,7 +2,7 @@
22 "files": {
33 "src/web/style/components.ts": {
44 "colour": 3,
5 "size": 2,
5 "size": 0,
66 "motion": 0,
77 "forced": 1,
88 "focus": 2,
src/web/studio/asks_page.ts +13 −13
@@ -77,9 +77,9 @@ const BULK_KINDS: ReadonlySet<Decision["kind"]> = new Set(["look", "review", "st
7777 /** A row's box for the bulk form, which sits apart (`form="asks-bulk"`): forms do not nest. */
7878 const pick = (d: Decision, picked: ReadonlySet<string>): Html | null =>
7979 BULK_KINDS.has(d.kind)
80 ? html`<label class="ask-pick-hit"><input
80 ? html`<label data-part="pick"><input
8181 type="checkbox"
82 class="ask-pick"
82 data-part="box"
8383 name="item"
8484 value="${d.id}"
8585 form="asks-bulk"
@@ -161,7 +161,7 @@ const clause = (
161161 which?: string,
162162 ): Html =>
163163 html`<p>
164 ${weight(c, which)}${d === undefined ? null : html`<span class="ask-short">${d.short.charAt(0).toUpperCase()}${d.short.slice(1)}. </span>`}<span class="muted"
164 ${weight(c, which)}${d === undefined ? null : html`<span data-part="short">${d.short.charAt(0).toUpperCase()}${d.short.slice(1)}. </span>`}<span class="muted"
165165 >If nobody acts, ${ASK_WORDS[kind].ifNothing}.</span
166166 >
167167 </p>`;
@@ -186,11 +186,11 @@ const KIND_LABEL: Readonly<Record<Decision["kind"], string>> = {
186186 */
187187 function acts(ctx: Ctx, d: Decision): Html {
188188 const { primary, others } = decisionButtons(ctx, d);
189 return html`<div class="ask-acts">
189 return html`<div class="bar" data-variant="split">
190190 ${primary}
191191 ${others.length === 0
192192 ? null
193 : html`<details class="ask-more-acts">
193 : html`<details data-part="more">
194194 <summary class="btn" data-size="sm">More</summary>
195195 ${others}
196196 </details>`}
@@ -227,11 +227,11 @@ function decisionCard(ctx: Ctx, d: Decision, picked: ReadonlySet<string>): Html
227227 ${acts(ctx, d)}`,
228228 {
229229 id: askAnchor(d.id),
230 extra: "ask-card",
230 variant: "ask",
231231 head: html`${pick(d, picked)}
232232 <h2>${title}</h2>
233 <span class="ask-meta muted small"
234 ><b class="ask-kind">${KIND_LABEL[d.kind]}</b>${d.repo.ownerName}/${d.repo.name}</span
233 <span class="muted small" data-part="meta"
234 ><b data-part="kind">${KIND_LABEL[d.kind]}</b>${d.repo.ownerName}/${d.repo.name}</span
235235 >${waitChip(d.waiting)}`,
236236 },
237237 );
@@ -239,7 +239,7 @@ function decisionCard(ctx: Ctx, d: Decision, picked: ReadonlySet<string>): Html
239239
240240 /** What the row waits for and on whom: "ready to land · on you". */
241241 const waitChip = (w: WaitingFor): Html =>
242 html`<span class="ask-waiting small" data-waiting="${w.word}"
242 html`<span class="badge" data-variant="outline" data-waiting="${w.word}"
243243 ><span class="sr-only">waiting for </span>${w.word} · on ${w.on}</span
244244 >`;
245245
@@ -284,7 +284,7 @@ function rowCard(ctx: Ctx, r: AskRow<Decision>, picked: ReadonlySet<string>): Ht
284284 // groups never push the composer past the fold; a wider screen holds the
285285 // details open and shows every line, as before.
286286 return card(
287 html`<details class="ask-group">
287 html`<details data-part="group">
288288 <summary>Show all ${r.items.length}</summary>
289289 <ul class="list">
290290 ${lines}
@@ -293,11 +293,11 @@ function rowCard(ctx: Ctx, r: AskRow<Decision>, picked: ReadonlySet<string>): Ht
293293 {
294294 pad: false,
295295 id: askAnchor(r.id),
296 extra: "ask-card",
296 variant: "ask",
297297 head: html`${BULK_KINDS.has(r.kind)
298 ? html`<label class="ask-pick-hit"><input
298 ? html`<label data-part="pick"><input
299299 type="checkbox"
300 class="ask-pick"
300 data-part="box"
301301 data-select-all
302302 aria-label="Select all ${r.items.length}"
303303 /></label>`
src/web/style/components.ts +50
@@ -860,4 +860,54 @@ details[open] > summary.row > .row-lead { transform: rotate(90deg); }
860860 }
861861 .btn[aria-busy="true"] .ico-loader { opacity: .6; }
862862 }
863 /* card[data-variant=ask]: the inbox's decision card. Its parts are named
864 by data-part (kind, meta, short, pick, box, group, more) and its actions
865 are a .bar[data-variant=split]: the decider, then the rest behind "More".
866 A wide screen lays them in a line; a phone runs the card edge to edge
867 (the page's 16 px gutter stays), puts "kind · repo" over the wrapped
868 title, the decider at the trailing edge, 44 px tall. */
869 .bar[data-variant="split"] { gap: 6px; margin-top: 12px; }
870 .row .bar[data-variant="split"] { margin-top: 0; }
871 .bar[data-variant="split"] > details[data-part="more"] { display: contents; }
872 .bar[data-variant="split"] > details[data-part="more"] > summary { list-style: none; }
873 .bar[data-variant="split"] > details[data-part="more"] > summary::-webkit-details-marker { display: none; }
874 .card[data-variant="ask"] [data-part="pick"] { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
875 .card[data-variant="ask"] [data-part="kind"] { display: none; }
876 .card[data-variant="ask"] details[data-part="group"] > summary { padding: 10px 14px; cursor: pointer; }
877 @supports selector(::details-content) {
878 @media (min-width: 481px) {
879 .bar[data-variant="split"] > details[data-part="more"] > summary { display: none; }
880 .bar[data-variant="split"] > details[data-part="more"]::details-content { content-visibility: visible; display: contents; }
881 .card[data-variant="ask"] details[data-part="group"] > summary { display: none; }
882 .card[data-variant="ask"] details[data-part="group"]::details-content { content-visibility: visible; }
883 }
884 }
885 @media (max-width: 480px) {
886 .card[data-variant="ask"] {
887 margin-inline: -16px; border-inline: 0; border-radius: 0; box-shadow: none; background: none;
888 }
889 .card[data-variant="ask"] .card-head { padding: 12px 16px 0; background: none; border: 0; gap: 4px 8px; align-items: baseline; }
890 .card[data-variant="ask"] .card-body { padding: 4px 16px 12px; }
891 .card[data-variant="ask"] .card-foot { padding: 0 16px 12px; background: none; border: 0; }
892 .card[data-variant="ask"] .card-head h2 { order: 2; flex: 1 1 100%; min-width: 0; overflow-wrap: anywhere; font-size: 1.05em; }
893 .card[data-variant="ask"] .card-head h2 a { white-space: normal; overflow: visible; text-overflow: clip; }
894 .card[data-variant="ask"] [data-part="meta"] { order: 1; flex: 1; min-width: 0; overflow-wrap: anywhere; }
895 .card[data-variant="ask"] [data-part="kind"] { display: inline; margin-right: 6px; color: var(--fg); }
896 .card[data-variant="ask"] [data-part="kind"]::after { content: " ·"; font-weight: 400; }
897 .card[data-variant="ask"] [data-part="short"] { display: none; }
898 .card[data-variant="ask"] .card-head > .badge { order: 3; flex: 0 1 auto; min-width: 0; max-width: 100%; white-space: normal; }
899 .card[data-variant="ask"] [data-part="pick"] { order: 0; min-width: 44px; min-height: 44px; }
900 .card[data-variant="ask"] [data-part="box"] { min-width: 24px; min-height: 24px; }
901 .card[data-variant="ask"] details[data-part="group"] > summary { padding: 10px 16px; min-height: 44px; }
902 .card[data-variant="ask"] details[data-part="group"] .row { flex-wrap: wrap; padding-inline: 16px; }
903 .card[data-variant="ask"] details[data-part="group"] .row-main { flex-basis: 100%; }
904 .card[data-variant="ask"] details[data-part="group"] .row-meta { flex: 1 1 100%; white-space: normal; }
905 .bar[data-variant="split"] { flex-direction: row-reverse; justify-content: space-between; }
906 .bar[data-variant="split"] > .btn { min-height: 44px; min-width: 96px; padding: 0 20px; flex: 0 0 auto; }
907 .bar[data-variant="split"] > details[data-part="more"] { display: flex; flex-wrap: wrap; gap: 6px; }
908 .bar[data-variant="split"] > details[data-part="more"] > summary { display: inline-flex; min-height: 44px; padding: 0 16px; }
909 .bar[data-variant="split"] > details[data-part="more"][open] { flex: 1 1 100%; order: 2; }
910 .bar[data-variant="split"] > details[data-part="more"][open] > summary { display: none; }
911 .bar[data-variant="split"] > details[data-part="more"] > .btn { min-height: 44px; flex: 1 1 auto; }
912 }
863913 `;
src/web/style/content.ts −52
@@ -1173,8 +1173,6 @@ textarea.editor:focus-visible { outline: none; }
11731173 its words, not the column. */
11741174 .needs-you #asks-bulk select { width: auto; max-width: 100%; }
11751175 .needs-you #asks-bulk .input[name="reason"] { flex: 1 1 12rem; width: auto; min-width: 0; }
1176 /* A row's box sits in a label, so a phone's thumb has 44 px to hit. */
1177 .ask-pick-hit { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
11781176 /* A phone shows the top asks and one "N more" that opens in place to all
11791177 of them; a wider screen shows ASKS_SHOWN and its own "N more" past that.
11801178 Only where a details element can be held open: elsewhere both summaries
@@ -1189,58 +1187,8 @@ textarea.editor:focus-visible { outline: none; }
11891187 .needs-you #asks-phone-more > summary { display: none; }
11901188 .needs-you #asks-phone-more::details-content { content-visibility: visible; }
11911189 .needs-you #asks-phone-more > .stack { margin-top: 0; }
1192 .needs-you .ask-group > summary { display: none; }
1193 .needs-you .ask-group::details-content { content-visibility: visible; }
11941190 }
11951191 }
1196 .needs-you .ask-group > summary { padding: 10px 14px; cursor: pointer; }
1197 /* An ask's actions: the decider, then the rest. Wide: in a line, as ever.
1198 The kind label is for a phone, where the sentence under the title goes. */
1199 .ask-acts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
1200 .ask-more-acts { display: contents; }
1201 .ask-more-acts > summary { list-style: none; }
1202 .ask-more-acts > summary::-webkit-details-marker { display: none; }
1203 .ask-kind { display: none; }
1204 .ask-waiting { display: inline-block; margin-left: 8px; padding: 0 6px; border: 1px solid var(--border); border-radius: 999px; color: var(--fg); white-space: nowrap; max-width: 100%; }
1205 .row .ask-acts { margin-top: 0; }
1206 @supports selector(::details-content) {
1207 @media (min-width: 481px) {
1208 .ask-more-acts > summary { display: none; }
1209 .ask-more-acts::details-content { content-visibility: visible; display: contents; }
1210 }
1211 }
1212 /* A phone: rows run edge to edge (the card's box, border and body padding
1213 go; the page's 16 px gutter stays), the title wraps under "kind · repo",
1214 the decider sits at the trailing edge and the rest wait behind "More". */
1215 @media (max-width: 480px) {
1216 .needs-you .ask-card {
1217 margin-inline: -16px; border-inline: 0; border-radius: 0; box-shadow: none; background: none;
1218 }
1219 .ask-card .card-head { padding: 12px 16px 0; background: none; border: 0; gap: 4px 8px; align-items: baseline; }
1220 .ask-card .card-body { padding: 4px 16px 12px; }
1221 .ask-card .card-foot { padding: 0 16px 12px; background: none; border: 0; }
1222 .ask-card .card-head h2 { order: 2; flex: 1 1 100%; min-width: 0; overflow-wrap: anywhere; font-size: 1.05em; }
1223 .ask-card .card-head h2 a { white-space: normal; overflow: visible; text-overflow: clip; }
1224 .ask-card .ask-meta { order: 1; flex: 1; min-width: 0; overflow-wrap: anywhere; }
1225 .ask-card .ask-kind { display: inline; margin-right: 6px; color: var(--fg); }
1226 .ask-card .ask-kind::after { content: " ·"; font-weight: 400; }
1227 .ask-card .ask-short { display: none; }
1228 .ask-card .ask-waiting { order: 3; flex: 0 1 auto; margin-left: 0; min-width: 0; max-width: 100%; white-space: normal; }
1229 .ask-card .ask-pick-hit { order: 0; }
1230 .needs-you .ask-pick-hit { min-width: 44px; min-height: 44px; }
1231 .ask-card .ask-pick { min-width: 24px; min-height: 24px; }
1232 .ask-card .ask-group > summary { padding: 10px 16px; min-height: 44px; }
1233 .ask-card .ask-group .row { flex-wrap: wrap; padding-inline: 16px; }
1234 .ask-card .ask-group .row-main { flex-basis: 100%; }
1235 .ask-card .ask-group .row-meta { flex: 1 1 100%; white-space: normal; }
1236 .ask-acts { flex-direction: row-reverse; justify-content: space-between; }
1237 .ask-acts > .btn { min-height: 44px; min-width: 96px; padding: 0 20px; flex: 0 0 auto; }
1238 .ask-more-acts { display: flex; flex-wrap: wrap; gap: 6px; }
1239 .ask-more-acts > summary { display: inline-flex; min-height: 44px; padding: 0 16px; }
1240 .ask-more-acts[open] { flex: 1 1 100%; order: 2; }
1241 .ask-more-acts[open] > summary { display: none; }
1242 .ask-more-acts > .btn { min-height: 44px; flex: 1 1 auto; }
1243 }
12441192 /* Reduced motion: the pulses hold still at a legible level, the scroll-tied
12451193 fade stays at its resting width, and these transitions land at once. */
12461194 @media (prefers-reduced-motion: reduce) {
src/web/ui.ts +3
@@ -792,6 +792,8 @@ export interface CardOptions {
792792 pad?: boolean;
793793 id?: string;
794794 extra?: string;
795 /** `ask`: the inbox's decision card, edge to edge on a phone (§5, card). */
796 variant?: "ask";
795797 /** Further attributes for the card itself (data hooks, tabindex), already escaped. */
796798 attrs?: Html;
797799 }
@@ -801,6 +803,7 @@ export function card(body: Html, o: CardOptions = {}): Html {
801803 class="card${o.extra ? ` ${o.extra}` : ""}"
802804 ${o.id ? html`id="${o.id}"` : null}
803805 ${o.attrs ?? null}
806 ${o.variant ? html`data-variant="${o.variant}"` : null}
804807 ${o.tone && o.tone !== "default" ? html`data-tone="${o.tone}"` : null}
805808 >
806809 ${o.head ? html`<div class="card-head">${o.head}</div>` : null}
test/asks-rank.test.ts +14 −9
@@ -342,15 +342,20 @@ describe("asks that earn their place", () => {
342342 test("a phone's ask is a full-width row: kind and repo on one line, the decider apart, the rest behind More", async () => {
343343 const home = await page("/asks");
344344 const asks = home.slice(home.indexOf('<section id="needs-you"'));
345 expect(asks).toContain("ask-card");
346 expect(asks).toContain('<b class="ask-kind">');
345 expect(asks).toContain('data-variant="ask"');
346 expect(asks).toContain('<b data-part="kind">');
347347 // No icon column: the row opens with its kind, not a picture.
348 expect(asks.slice(0, asks.indexOf("<h2", asks.indexOf("ask-card")))).not.toContain("<svg");
349 expect(asks).toContain('<details class="ask-more-acts">');
350 expect(asks).toMatch(/class="ask-acts">\s*<button[^>]*data-variant="primary"/);
348 expect(asks.slice(0, asks.indexOf("<h2", asks.indexOf('data-variant="ask"')))).not.toContain("<svg");
349 expect(asks).toContain('<details data-part="more">');
350 expect(asks).toMatch(/class="bar" data-variant="split">\s*<button[^>]*data-variant="primary"/);
351351 const css = await (await fetch(`${servers.url}${home.match(/href="(\/[^"]*\.css[^"]*)"/)![1]}`)).text();
352 expect(css).toContain(".ask-acts > .btn { min-height: 44px;");
353 expect(css).toContain(".needs-you .ask-card {\n margin-inline: -16px;");
352 expect(css).toContain('.bar[data-variant="split"] > .btn { min-height: 44px;');
353 expect(css).toContain('.card[data-variant="ask"] {\n margin-inline: -16px;');
354 // The select box leads the card head on a phone (a doubled selector once broke this).
355 expect(css).toContain('.card[data-variant="ask"] [data-part="pick"] { order: 0;');
356 // The old ask-* classes are gone from the page and its stylesheet (#3876).
357 expect(asks).not.toMatch(/class="[^"]*\bask-(acts|card|group|kind|meta|more-acts|pick|pick-hit|short|waiting)\b/);
358 expect(css).not.toMatch(/\.ask-(acts|card|group|kind|meta|more-acts|pick|pick-hit|short|waiting)\b/);
354359 });
355360
356361 test("a collapsed row that ranks for security names which of its asks it is", async () => {
@@ -363,12 +368,12 @@ describe("asks that earn their place", () => {
363368 // On a phone the row is its head line, its two asks one tap away; a
364369 // wider screen holds them open (the lead's call: the fold wins).
365370 const group = asks.slice(asks.indexOf("2 green changes wait for your look"));
366 expect(group).toContain('<details class="ask-group">');
371 expect(group).toContain('<details data-part="group">');
367372 expect(group).toContain("<summary>Show all 2</summary>");
368373 const css = await (await fetch(`${servers.url}${asks.match(/href="(\/[^"]*\.css[^"]*)"/)![1]}`)).text();
369374 const wide = css.slice(css.indexOf("@supports selector(::details-content) {"));
370375 expect(wide.slice(wide.indexOf("@media (min-width: 481px)"))).toContain(
371 ".needs-you .ask-group > summary { display: none; }",
376 '.card[data-variant="ask"] details[data-part="group"] > summary { display: none; }',
372377 );
373378 });
374379 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs