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

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

Parked opened this
Closed without merging

mason/forge:mason/4083-design-the-inbox-s-ask-cards-draw-5-s-ca → main 6 commits fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
5 files changed +119 −65
docs/DESIGN.md +1 −1
@@ -399,7 +399,7 @@ gone, so this list only shrinks.
399399 - **`style/content.ts`, prose (markdown)** — table cell alignment, built by `markdown.ts` as `ta-${align}`: `.ta-c` `.ta-r`
400400 - **`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`
401401 - **`style/content.ts`, apps, runs, and the crew** — run pages, their logs and checks (a pull's look is §5's **look**): `.ln-forge` `.ln-pulse` `.ln-say` `.ln-tool` `.ln-you` `.log-tail-row` `.pinned-failures` `.pinned-slot` `.run-jump` `.run-live` `.run-steer` `.txt` `.who`
402 - **`style/content.ts`, search results** — search results, the inbox's ask cards: `.ask-acts` `.ask-card` `.ask-group` `.ask-kind` `.ask-meta` `.ask-more-acts` `.ask-pick` `.ask-pick-hit` `.ask-short` `.ask-waiting` `.live-toggle` `.needs-you`
402 - **`style/content.ts`, search results** — search results, and the section that holds the inbox's ask cards (each a §5 card marked `data-ask`): `.live-toggle` `.needs-you`
403403 - **`pages/board.ts`** — the board itself is §5's **board**; the spend tables `spend.ts` draws wear §5's `.table` and `.stack`, no class of their own
404404 - **`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`
405405 - **`studio/feed_style.ts`** — the home feed's cards and its composer (the apps rail is §5's card, row and btn; an admin's tick boxes and Archive are always shown, deliberately, with no Select toggle): `.composer` `.composer-bar` `.fcard-form` `.fcard-reason` `.fcard-reply` `.fcard-text` `.fcard-unblock` `.fcard-who` `.fcard-why` `.feed` `.feed-head` `.home-tabs`
src/web/studio/asks_page.ts +11 −13
@@ -79,9 +79,8 @@ const BULK_KINDS: ReadonlySet<Decision["kind"]> = new Set(["look", "review", "st
7979 /** A row's box for the bulk form, which sits apart (`form="asks-bulk"`): forms do not nest. */
8080 const pick = (d: Decision, picked: ReadonlySet<string>): Html | null =>
8181 BULK_KINDS.has(d.kind)
82 ? html`<label class="ask-pick-hit"><input
82 ? html`<label><input
8383 type="checkbox"
84 class="ask-pick"
8584 name="item"
8685 value="${d.id}"
8786 form="asks-bulk"
@@ -163,7 +162,7 @@ const clause = (
163162 which?: string,
164163 ): Html =>
165164 html`<p>
166 ${weight(c, which)}${d === undefined ? null : html`<span class="ask-short">${d.short.charAt(0).toUpperCase()}${d.short.slice(1)}. </span>`}<span class="muted"
165 ${weight(c, which)}${d === undefined ? null : html`<span data-short>${d.short.charAt(0).toUpperCase()}${d.short.slice(1)}. </span>`}<span class="muted"
167166 >If nobody acts, ${ASK_WORDS[kind].ifNothing}.</span
168167 >
169168 </p>`;
@@ -189,11 +188,11 @@ const KIND_LABEL: Readonly<Record<Decision["kind"], string>> = {
189188 */
190189 function acts(ctx: Ctx, d: Decision): Html {
191190 const { primary, others } = decisionButtons(ctx, d);
192 return html`<div class="ask-acts">
191 return html`<div class="bar">
193192 ${primary}
194193 ${others.length === 0
195194 ? null
196 : html`<details class="ask-more-acts">
195 : html`<details>
197196 <summary class="btn" data-size="sm">More</summary>
198197 ${others}
199198 </details>`}
@@ -237,11 +236,11 @@ function decisionCard(ctx: Ctx, d: Decision, picked: ReadonlySet<string>): Html
237236 ${acts(ctx, d)}`,
238237 {
239238 id: askAnchor(d.id),
240 extra: "ask-card",
239 attrs: html`data-ask`,
241240 head: html`${pick(d, picked)}
242241 <h2>${title}</h2>
243 <span class="ask-meta muted small"
244 ><b class="ask-kind">${KIND_LABEL[d.kind]}</b>${d.repo.ownerName}/${d.repo.name}</span
242 <span class="muted small"
243 ><b>${KIND_LABEL[d.kind]}</b>${d.repo.ownerName}/${d.repo.name}</span
245244 >${waitChip(d.waiting)}`,
246245 },
247246 );
@@ -249,7 +248,7 @@ function decisionCard(ctx: Ctx, d: Decision, picked: ReadonlySet<string>): Html
249248
250249 /** What the row waits for and on whom: "ready to land · on you". */
251250 const waitChip = (w: WaitingFor): Html =>
252 html`<span class="ask-waiting small" data-waiting="${w.word}"
251 html`<span class="small" data-waiting="${w.word}"
253252 ><span class="sr-only">waiting for </span>${w.word} · on ${w.on}</span
254253 >`;
255254
@@ -294,7 +293,7 @@ function rowCard(ctx: Ctx, r: AskRow<Decision>, picked: ReadonlySet<string>): Ht
294293 // groups never push the composer past the fold; a wider screen holds the
295294 // details open and shows every line, as before.
296295 return card(
297 html`<details class="ask-group">
296 html`<details>
298297 <summary>Show all ${r.items.length}</summary>
299298 <ul class="list">
300299 ${lines}
@@ -303,11 +302,10 @@ function rowCard(ctx: Ctx, r: AskRow<Decision>, picked: ReadonlySet<string>): Ht
303302 {
304303 pad: false,
305304 id: askAnchor(r.id),
306 extra: "ask-card",
305 attrs: html`data-ask`,
307306 head: html`${BULK_KINDS.has(r.kind)
308 ? html`<label class="ask-pick-hit"><input
307 ? html`<label><input
309308 type="checkbox"
310 class="ask-pick"
311309 data-select-all
312310 aria-label="Select all ${r.items.length}"
313311 /></label>`
src/web/style/content.ts +45 −41
@@ -1088,8 +1088,10 @@ textarea.editor:focus-visible { outline: none; }
10881088 its words, not the column. */
10891089 .needs-you #asks-bulk select { width: auto; max-width: 100%; }
10901090 .needs-you #asks-bulk .input[name="reason"] { flex: 1 1 12rem; width: auto; min-width: 0; }
1091 /* A row's box sits in a label, so a phone's thumb has 44 px to hit. */
1092 .ask-pick-hit { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
1091 /* An ask is a §5 card marked \`data-ask\` (asks_page.ts); its rules reach
1092 the card's own parts. A row's box sits in a label, in the card's head or
1093 a row's lead, so a phone's thumb has 44 px to hit. */
1094 .needs-you [data-ask] :is(.card-head, .row-lead) > label { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
10931095 /* A phone shows the top asks and one "N more" that opens in place to all
10941096 of them; a wider screen shows ASKS_SHOWN and its own "N more" past that.
10951097 Only where a details element can be held open: elsewhere both summaries
@@ -1104,57 +1106,59 @@ textarea.editor:focus-visible { outline: none; }
11041106 .needs-you #asks-phone-more > summary { display: none; }
11051107 .needs-you #asks-phone-more::details-content { content-visibility: visible; }
11061108 .needs-you #asks-phone-more > .stack { margin-top: 0; }
1107 .needs-you .ask-group > summary { display: none; }
1108 .needs-you .ask-group::details-content { content-visibility: visible; }
1109 .needs-you [data-ask] > details > summary { display: none; }
1110 .needs-you [data-ask] > details::details-content { content-visibility: visible; }
11091111 }
11101112 }
1111 .needs-you .ask-group > summary { padding: 10px 14px; cursor: pointer; }
1112 /* An ask's actions: the decider, then the rest. Wide: in a line, as ever.
1113 The kind label is for a phone, where the sentence under the title goes. */
1114 .ask-acts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
1115 .ask-more-acts { display: contents; }
1116 .ask-more-acts > summary { list-style: none; }
1117 .ask-more-acts > summary::-webkit-details-marker { display: none; }
1118 .ask-kind { display: none; }
1119 .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%; }
1120 .row .ask-acts { margin-top: 0; }
1113 .needs-you [data-ask] > details > summary { padding: 10px 14px; cursor: pointer; }
1114 /* An ask's actions are its one \`div.bar\`: the decider, then the rest
1115 behind a details. Wide: in a line, as ever. The kind label (the head's
1116 bold word) is for a phone, where the sentence under the title goes. */
1117 .needs-you [data-ask] div.bar { gap: 6px; }
1118 .needs-you [data-ask] .card-body > div.bar { margin-top: 12px; }
1119 .needs-you [data-ask] div.bar > details { display: contents; }
1120 .needs-you [data-ask] div.bar > details > summary { list-style: none; }
1121 .needs-you [data-ask] div.bar > details > summary::-webkit-details-marker { display: none; }
1122 .needs-you [data-ask] .card-head > .muted > b { display: none; }
1123 .needs-you [data-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%; }
11211124 @supports selector(::details-content) {
11221125 @media (min-width: 481px) {
1123 .ask-more-acts > summary { display: none; }
1124 .ask-more-acts::details-content { content-visibility: visible; display: contents; }
1126 .needs-you [data-ask] div.bar > details > summary { display: none; }
1127 .needs-you [data-ask] div.bar > details::details-content { content-visibility: visible; display: contents; }
11251128 }
11261129 }
11271130 /* A phone: rows run edge to edge (the card's box, border and body padding
11281131 go; the page's 16 px gutter stays), the title wraps under "kind · repo",
11291132 the decider sits at the trailing edge and the rest wait behind "More". */
11301133 @media (max-width: 480px) {
1131 .needs-you .ask-card {
1134 .needs-you [data-ask] {
11321135 margin-inline: -16px; border-inline: 0; border-radius: 0; box-shadow: none; background: none;
11331136 }
1134 .ask-card .card-head { padding: 12px 16px 0; background: none; border: 0; gap: 4px 8px; align-items: baseline; }
1135 .ask-card .card-body { padding: 4px 16px 12px; }
1136 .ask-card .card-foot { padding: 0 16px 12px; background: none; border: 0; }
1137 .ask-card .card-head h2 { order: 2; flex: 1 1 100%; min-width: 0; overflow-wrap: anywhere; font-size: 1.05em; }
1138 .ask-card .card-head h2 a { white-space: normal; overflow: visible; text-overflow: clip; }
1139 .ask-card .ask-meta { order: 1; flex: 1; min-width: 0; overflow-wrap: anywhere; }
1140 .ask-card .ask-kind { display: inline; margin-right: 6px; color: var(--fg); }
1141 .ask-card .ask-kind::after { content: " ·"; font-weight: 400; }
1142 .ask-card .ask-short { display: none; }
1143 .ask-card .ask-waiting { order: 3; flex: 0 1 auto; margin-left: 0; min-width: 0; max-width: 100%; white-space: normal; }
1144 .ask-card .ask-pick-hit { order: 0; }
1145 .needs-you .ask-pick-hit { min-width: 44px; min-height: 44px; }
1146 .ask-card .ask-pick { min-width: 24px; min-height: 24px; }
1147 .ask-card .ask-group > summary { padding: 10px 16px; min-height: 44px; }
1148 .ask-card .ask-group .row { flex-wrap: wrap; padding-inline: 16px; }
1149 .ask-card .ask-group .row-main { flex-basis: 100%; }
1150 .ask-card .ask-group .row-meta { flex: 1 1 100%; white-space: normal; }
1151 .ask-acts { flex-direction: row-reverse; justify-content: space-between; }
1152 .ask-acts > .btn { min-height: 44px; min-width: 96px; padding: 0 20px; flex: 0 0 auto; }
1153 .ask-more-acts { display: flex; flex-wrap: wrap; gap: 6px; }
1154 .ask-more-acts > summary { display: inline-flex; min-height: 44px; padding: 0 16px; }
1155 .ask-more-acts[open] { flex: 1 1 100%; order: 2; }
1156 .ask-more-acts[open] > summary { display: none; }
1157 .ask-more-acts > .btn { min-height: 44px; flex: 1 1 auto; }
1137 .needs-you [data-ask] .card-head { padding: 12px 16px 0; background: none; border: 0; gap: 4px 8px; align-items: baseline; }
1138 .needs-you [data-ask] .card-body { padding: 4px 16px 12px; }
1139 .needs-you [data-ask] .card-foot { padding: 0 16px 12px; background: none; border: 0; }
1140 .needs-you [data-ask] .card-head h2 { order: 2; flex: 1 1 100%; min-width: 0; overflow-wrap: anywhere; font-size: 1.05em; }
1141 .needs-you [data-ask] .card-head h2 a { white-space: normal; overflow: visible; text-overflow: clip; }
1142 .needs-you [data-ask] .card-head > .muted { order: 1; flex: 1; min-width: 0; overflow-wrap: anywhere; }
1143 .needs-you [data-ask] .card-head > .muted > b { display: inline; margin-right: 6px; color: var(--fg); }
1144 .needs-you [data-ask] .card-head > .muted > b::after { content: " ·"; font-weight: 400; }
1145 /* The ask's own sentence (\`data-short\`): the kind says it here. */
1146 .needs-you [data-ask] [data-short] { display: none; }
1147 .needs-you [data-ask] [data-waiting] { order: 3; flex: 0 1 auto; margin-left: 0; min-width: 0; max-width: 100%; white-space: normal; }
1148 .needs-you [data-ask] .card-head > label { order: 0; }
1149 .needs-you [data-ask] :is(.card-head, .row-lead) > label { min-width: 44px; min-height: 44px; }
1150 .needs-you [data-ask] label > input[type="checkbox"] { min-width: 24px; min-height: 24px; }
1151 .needs-you [data-ask] > details > summary { padding: 10px 16px; min-height: 44px; }
1152 .needs-you [data-ask] > details .row { flex-wrap: wrap; padding-inline: 16px; }
1153 .needs-you [data-ask] > details .row-main { flex-basis: 100%; }
1154 .needs-you [data-ask] > details .row-meta { flex: 1 1 100%; white-space: normal; }
1155 .needs-you [data-ask] div.bar { flex-direction: row-reverse; justify-content: space-between; }
1156 .needs-you [data-ask] div.bar > .btn { min-height: 44px; min-width: 96px; padding: 0 20px; flex: 0 0 auto; }
1157 .needs-you [data-ask] div.bar > details { display: flex; flex-wrap: wrap; gap: 6px; }
1158 .needs-you [data-ask] div.bar > details > summary { display: inline-flex; min-height: 44px; padding: 0 16px; }
1159 .needs-you [data-ask] div.bar > details[open] { flex: 1 1 100%; order: 2; }
1160 .needs-you [data-ask] div.bar > details[open] > summary { display: none; }
1161 .needs-you [data-ask] div.bar > details > .btn { min-height: 44px; flex: 1 1 auto; }
11581162 }
11591163 /* Reduced motion: the pulses hold still at a legible level, the scroll-tied
11601164 fade stays at its resting width, and these transitions land at once. */
test/asks-rank.test.ts +61 −9
@@ -342,15 +342,19 @@ 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-ask");
346 expect(asks).toMatch(/<span class="muted small" ><b>[^<]+<\/b>/);
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-ask")))).not.toContain("<svg");
349 expect(asks).toMatch(/<div class="bar">\s*<button[^>]*data-variant="primary"[^]*?<details> <summary class="btn" data-size="sm">More<\/summary>/);
351350 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;");
351 expect(css).toContain(".needs-you [data-ask] div.bar > .btn { min-height: 44px;");
352 expect(css).toContain(".needs-you [data-ask] {\n margin-inline: -16px;");
353 // The sentence a phone hides is named, not found by its place in the line.
354 expect(asks).toMatch(/<span data-short>[^<]+\. <\/span><span class="muted"/);
355 const phone = css.slice(css.indexOf("@media (max-width: 480px) {\n .needs-you [data-ask] {"));
356 expect(phone).toContain(".needs-you [data-ask] [data-short] { display: none; }");
357 expect(css).not.toContain("span:not(.muted)");
354358 });
355359
356360 test("a collapsed row that ranks for security names which of its asks it is", async () => {
@@ -363,12 +367,60 @@ describe("asks that earn their place", () => {
363367 // On a phone the row is its head line, its two asks one tap away; a
364368 // wider screen holds them open (the lead's call: the fold wins).
365369 const group = asks.slice(asks.indexOf("2 green changes wait for your look"));
366 expect(group).toContain('<details class="ask-group">');
370 const at = asks.indexOf("2 green changes wait for your look");
371 expect(asks.slice(asks.lastIndexOf("<div class=\"card\"", at), at)).toContain("data-ask");
372 expect(group).toContain("</div> <details> <summary>Show all 2</summary>");
367373 expect(group).toContain("<summary>Show all 2</summary>");
368374 const css = await (await fetch(`${servers.url}${asks.match(/href="(\/[^"]*\.css[^"]*)"/)![1]}`)).text();
369375 const wide = css.slice(css.indexOf("@supports selector(::details-content) {"));
370376 expect(wide.slice(wide.indexOf("@media (min-width: 481px)"))).toContain(
371 ".needs-you .ask-group > summary { display: none; }",
377 ".needs-you [data-ask] > details > summary { display: none; }",
372378 );
373379 });
380
381 test("an ask is §5's card, row and btn: no ask-* class, and ship, decline and say post what they did (#4083)", async () => {
382 const toShip = await greenPull("shipped", "Ship this one");
383 const toDecline = await greenPull("declined", "Decline this one");
384 const asks = await page("/asks");
385 const section = asks.slice(asks.indexOf('<section id="needs-you"'));
386 for (const old of ["ask-acts", "ask-card", "ask-group", "ask-kind", "ask-meta", "ask-more-acts", "ask-pick", "ask-short", "ask-waiting"])
387 expect(section).not.toContain(old);
388 const id = `look:${toShip.id}`;
389 // Ship: the card's primary button submits the ask's own hidden form.
390 expect(section).toContain(`<button type="submit" form="ask-${id}" class="btn" data-variant="primary" data-size="sm" > Ship </button>`);
391 expect(section).toContain(
392 `<form id="ask-${id}" method="post" hidden action="/alice/shipped/pulls/${toShip.number}/ship"> <input type="hidden" name="pull" value="${toShip.number}" /><input type="hidden" name="back" value="/asks" /> </form>`,
393 );
394 // Decline: the ask's box joins the bulk form, whose verbs include decline.
395 expect(section).toMatch(new RegExp(`<input type="checkbox" name="item" value="${id}" form="asks-bulk"`));
396 expect(section).toContain('<form id="asks-bulk" method="post" action="/asks/bulk"');
397 expect(section).toContain('<option value="decline" >Decline</option>');
398 // Say: the words go on the change's own page.
399 expect(section).toContain(`<a href="/alice/shipped/pulls/${toShip.number}#comment-body" class="btn" data-size="sm" >Not like this</a >`);
400 // Each posts and comes back to the page.
401 const declined = await fetch(`${servers.url}/asks/bulk`, {
402 method: "POST",
403 redirect: "manual",
404 headers: { cookie, origin: servers.url },
405 body: new URLSearchParams({ action: "decline", item: `look:${toDecline.id}` }),
406 });
407 expect(declined.status).toBe(200);
408 expect(await declined.text()).toContain("Decline: 1 of 1");
409 const applied = await fetch(`${servers.url}/asks/bulk`, {
410 method: "POST",
411 redirect: "manual",
412 headers: { cookie, origin: servers.url },
413 body: new URLSearchParams({ action: "decline", item: `look:${toDecline.id}`, apply: "1" }),
414 });
415 expect(applied.status).toBe(303);
416 expect(applied.headers.get("location")).toStartWith("/asks?op=");
417 const shipped = await fetch(`${servers.url}/alice/shipped/pulls/${toShip.number}/ship`, {
418 method: "POST",
419 redirect: "manual",
420 headers: { cookie, origin: servers.url },
421 body: new URLSearchParams({ pull: String(toShip.number), back: "/asks" }),
422 });
423 expect(shipped.status).toBe(303);
424 expect(shipped.headers.get("location")).toStartWith("/asks");
425 });
374426 });
test/asks-waiting.test.ts +1 −1
@@ -180,7 +180,7 @@ describe("asks that wait on a person", () => {
180180 expect(page).toContain("Say what to change");
181181 expect(row).not.toContain("/settings/autonomy");
182182 expect(page).toContain(">Handed over<");
183 expect(page).toMatch(/class="ask-pick"[^>]*value="waiting:[^"]+"[^>]*data-kind="waiting"/);
183 expect(page).toMatch(/type="checkbox"\s+name="item"\s+value="waiting:[^"]+"[^>]*data-kind="waiting"/);
184184 });
185185
186186 test("the MCP asks tool carries the waiting kind, its why and the recommendation", async () => {

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs