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 #4368

Parked opened this
Closed without merging

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

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
5 files changed +124 −65
docs/DESIGN.md +5
@@ -399,8 +399,13 @@ gone, so this list only shrinks.
399399 - **`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`
400400 - **`style/content.ts`, prose (markdown)** — table cell alignment, built by `markdown.ts` as `ta-${align}`: `.ta-c` `.ta-r`
401401 - **`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`
402 <<<<<<< HEAD
403 - **`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` `.pinned-failures` `.pinned-slot` `.txt` `.who`
404 - **`style/content.ts`, search results** — search results; the inbox's ask cards are §5 cards marked `data-ask` in `#needs-you`: `.live-toggle`
405 =======
402406 - **`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` `.txt` `.who`
403407 - **`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`
408 >>>>>>> origin/main
404409 - **`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
405410 - **`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-rule` `.map-svg` `.map-title` `.map-tool` `.map-tools` `.map-who` `.map-who-i` `.map-who-n` `.map-word` `.map-wrap`
406411 - **`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` `.fcard-form` `.fcard-reason` `.fcard-reply` `.fcard-text` `.fcard-unblock` `.fcard-who` `.fcard-why` `.feed` `.feed-head`
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
@@ -1039,8 +1039,10 @@ textarea.editor:focus-visible { outline: none; }
10391039 its words, not the column. */
10401040 #needs-you #asks-bulk select { width: auto; max-width: 100%; }
10411041 #needs-you #asks-bulk .input[name="reason"] { flex: 1 1 12rem; width: auto; min-width: 0; }
1042 /* A row's box sits in a label, so a phone's thumb has 44 px to hit. */
1043 .ask-pick-hit { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
1042 /* An ask is a §5 card marked \`data-ask\` (asks_page.ts); its rules reach
1043 the card's own parts. A row's box sits in a label, in the card's head or
1044 a row's lead, so a phone's thumb has 44 px to hit. */
1045 #needs-you [data-ask] :is(.card-head, .row-lead) > label { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
10441046 /* A phone shows the top asks and one "N more" that opens in place to all
10451047 of them; a wider screen shows ASKS_SHOWN and its own "N more" past that.
10461048 Only where a details element can be held open: elsewhere both summaries
@@ -1055,57 +1057,59 @@ textarea.editor:focus-visible { outline: none; }
10551057 #needs-you #asks-phone-more > summary { display: none; }
10561058 #needs-you #asks-phone-more::details-content { content-visibility: visible; }
10571059 #needs-you #asks-phone-more > .stack { margin-top: 0; }
1058 #needs-you .ask-group > summary { display: none; }
1059 #needs-you .ask-group::details-content { content-visibility: visible; }
1060 #needs-you [data-ask] > details > summary { display: none; }
1061 #needs-you [data-ask] > details::details-content { content-visibility: visible; }
10601062 }
10611063 }
1062 #needs-you .ask-group > summary { padding: 10px 14px; cursor: pointer; }
1063 /* An ask's actions: the decider, then the rest. Wide: in a line, as ever.
1064 The kind label is for a phone, where the sentence under the title goes. */
1065 .ask-acts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
1066 .ask-more-acts { display: contents; }
1067 .ask-more-acts > summary { list-style: none; }
1068 .ask-more-acts > summary::-webkit-details-marker { display: none; }
1069 .ask-kind { display: none; }
1070 .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%; }
1071 .row .ask-acts { margin-top: 0; }
1064 #needs-you [data-ask] > details > summary { padding: 10px 14px; cursor: pointer; }
1065 /* An ask's actions are its one \`div.bar\`: the decider, then the rest
1066 behind a details. Wide: in a line, as ever. The kind label (the head's
1067 bold word) is for a phone, where the sentence under the title goes. */
1068 #needs-you [data-ask] div.bar { gap: 6px; }
1069 #needs-you [data-ask] .card-body > div.bar { margin-top: 12px; }
1070 #needs-you [data-ask] div.bar > details { display: contents; }
1071 #needs-you [data-ask] div.bar > details > summary { list-style: none; }
1072 #needs-you [data-ask] div.bar > details > summary::-webkit-details-marker { display: none; }
1073 #needs-you [data-ask] .card-head > .muted > b { display: none; }
1074 #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%; }
10721075 @supports selector(::details-content) {
10731076 @media (min-width: 481px) {
1074 .ask-more-acts > summary { display: none; }
1075 .ask-more-acts::details-content { content-visibility: visible; display: contents; }
1077 #needs-you [data-ask] div.bar > details > summary { display: none; }
1078 #needs-you [data-ask] div.bar > details::details-content { content-visibility: visible; display: contents; }
10761079 }
10771080 }
10781081 /* A phone: rows run edge to edge (the card's box, border and body padding
10791082 go; the page's 16 px gutter stays), the title wraps under "kind · repo",
10801083 the decider sits at the trailing edge and the rest wait behind "More". */
10811084 @media (max-width: 480px) {
1082 #needs-you .ask-card {
1085 #needs-you [data-ask] {
10831086 margin-inline: -16px; border-inline: 0; border-radius: 0; box-shadow: none; background: none;
10841087 }
1085 .ask-card .card-head { padding: 12px 16px 0; background: none; border: 0; gap: 4px 8px; align-items: baseline; }
1086 .ask-card .card-body { padding: 4px 16px 12px; }
1087 .ask-card .card-foot { padding: 0 16px 12px; background: none; border: 0; }
1088 .ask-card .card-head h2 { order: 2; flex: 1 1 100%; min-width: 0; overflow-wrap: anywhere; font-size: 1.05em; }
1089 .ask-card .card-head h2 a { white-space: normal; overflow: visible; text-overflow: clip; }
1090 .ask-card .ask-meta { order: 1; flex: 1; min-width: 0; overflow-wrap: anywhere; }
1091 .ask-card .ask-kind { display: inline; margin-right: 6px; color: var(--fg); }
1092 .ask-card .ask-kind::after { content: " ·"; font-weight: 400; }
1093 .ask-card .ask-short { display: none; }
1094 .ask-card .ask-waiting { order: 3; flex: 0 1 auto; margin-left: 0; min-width: 0; max-width: 100%; white-space: normal; }
1095 .ask-card .ask-pick-hit { order: 0; }
1096 #needs-you .ask-pick-hit { min-width: 44px; min-height: 44px; }
1097 .ask-card .ask-pick { min-width: 24px; min-height: 24px; }
1098 .ask-card .ask-group > summary { padding: 10px 16px; min-height: 44px; }
1099 .ask-card .ask-group .row { flex-wrap: wrap; padding-inline: 16px; }
1100 .ask-card .ask-group .row-main { flex-basis: 100%; }
1101 .ask-card .ask-group .row-meta { flex: 1 1 100%; white-space: normal; }
1102 .ask-acts { flex-direction: row-reverse; justify-content: space-between; }
1103 .ask-acts > .btn { min-height: 44px; min-width: 96px; padding: 0 20px; flex: 0 0 auto; }
1104 .ask-more-acts { display: flex; flex-wrap: wrap; gap: 6px; }
1105 .ask-more-acts > summary { display: inline-flex; min-height: 44px; padding: 0 16px; }
1106 .ask-more-acts[open] { flex: 1 1 100%; order: 2; }
1107 .ask-more-acts[open] > summary { display: none; }
1108 .ask-more-acts > .btn { min-height: 44px; flex: 1 1 auto; }
1088 #needs-you [data-ask] .card-head { padding: 12px 16px 0; background: none; border: 0; gap: 4px 8px; align-items: baseline; }
1089 #needs-you [data-ask] .card-body { padding: 4px 16px 12px; }
1090 #needs-you [data-ask] .card-foot { padding: 0 16px 12px; background: none; border: 0; }
1091 #needs-you [data-ask] .card-head h2 { order: 2; flex: 1 1 100%; min-width: 0; overflow-wrap: anywhere; font-size: 1.05em; }
1092 #needs-you [data-ask] .card-head h2 a { white-space: normal; overflow: visible; text-overflow: clip; }
1093 #needs-you [data-ask] .card-head > .muted { order: 1; flex: 1; min-width: 0; overflow-wrap: anywhere; }
1094 #needs-you [data-ask] .card-head > .muted > b { display: inline; margin-right: 6px; color: var(--fg); }
1095 #needs-you [data-ask] .card-head > .muted > b::after { content: " ·"; font-weight: 400; }
1096 /* The ask's own sentence (\`data-short\`): the kind says it here. */
1097 #needs-you [data-ask] [data-short] { display: none; }
1098 #needs-you [data-ask] [data-waiting] { order: 3; flex: 0 1 auto; margin-left: 0; min-width: 0; max-width: 100%; white-space: normal; }
1099 #needs-you [data-ask] .card-head > label { order: 0; }
1100 #needs-you [data-ask] :is(.card-head, .row-lead) > label { min-width: 44px; min-height: 44px; }
1101 #needs-you [data-ask] label > input[type="checkbox"] { min-width: 24px; min-height: 24px; }
1102 #needs-you [data-ask] > details > summary { padding: 10px 16px; min-height: 44px; }
1103 #needs-you [data-ask] > details .row { flex-wrap: wrap; padding-inline: 16px; }
1104 #needs-you [data-ask] > details .row-main { flex-basis: 100%; }
1105 #needs-you [data-ask] > details .row-meta { flex: 1 1 100%; white-space: normal; }
1106 #needs-you [data-ask] div.bar { flex-direction: row-reverse; justify-content: space-between; }
1107 #needs-you [data-ask] div.bar > .btn { min-height: 44px; min-width: 96px; padding: 0 20px; flex: 0 0 auto; }
1108 #needs-you [data-ask] div.bar > details { display: flex; flex-wrap: wrap; gap: 6px; }
1109 #needs-you [data-ask] div.bar > details > summary { display: inline-flex; min-height: 44px; padding: 0 16px; }
1110 #needs-you [data-ask] div.bar > details[open] { flex: 1 1 100%; order: 2; }
1111 #needs-you [data-ask] div.bar > details[open] > summary { display: none; }
1112 #needs-you [data-ask] div.bar > details > .btn { min-height: 44px; flex: 1 1 auto; }
11091113 }
11101114 /* Reduced motion: the pulses hold still at a legible level, the scroll-tied
11111115 fade stays at its resting width, and these transitions land at once. */
test/asks-rank.test.ts +62 −10
@@ -342,17 +342,21 @@ 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 // The markup lost the .needs-you class (#4189): no selector may still need it.
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 markup lost the .needs-you class (#4258): no selector may still need it.
354354 expect(css).not.toMatch(/\.needs-you\b/);
355 expect(css).toContain("#needs-you .ask-card {\n margin-inline: -16px;");
355 // The sentence a phone hides is named, not found by its place in the line.
356 expect(asks).toMatch(/<span data-short>[^<]+\. <\/span><span class="muted"/);
357 const phone = css.slice(css.indexOf("@media (max-width: 480px) {\n #needs-you [data-ask] {"));
358 expect(phone).toContain("#needs-you [data-ask] [data-short] { display: none; }");
359 expect(css).not.toContain("span:not(.muted)");
356360 });
357361
358362 test("a collapsed row that ranks for security names which of its asks it is", async () => {
@@ -365,12 +369,60 @@ describe("asks that earn their place", () => {
365369 // On a phone the row is its head line, its two asks one tap away; a
366370 // wider screen holds them open (the lead's call: the fold wins).
367371 const group = asks.slice(asks.indexOf("2 green changes wait for your look"));
368 expect(group).toContain('<details class="ask-group">');
372 const at = asks.indexOf("2 green changes wait for your look");
373 expect(asks.slice(asks.lastIndexOf("<div class=\"card\"", at), at)).toContain("data-ask");
374 expect(group).toContain("</div> <details> <summary>Show all 2</summary>");
369375 expect(group).toContain("<summary>Show all 2</summary>");
370376 const css = await (await fetch(`${servers.url}${asks.match(/href="(\/[^"]*\.css[^"]*)"/)![1]}`)).text();
371377 const wide = css.slice(css.indexOf("@supports selector(::details-content) {"));
372378 expect(wide.slice(wide.indexOf("@media (min-width: 481px)"))).toContain(
373 "#needs-you .ask-group > summary { display: none; }",
379 "#needs-you [data-ask] > details > summary { display: none; }",
374380 );
375381 });
382
383 test("an ask is §5's card, row and btn: no ask-* class, and ship, decline and say post what they did (#4083)", async () => {
384 const toShip = await greenPull("shipped", "Ship this one");
385 const toDecline = await greenPull("declined", "Decline this one");
386 const asks = await page("/asks");
387 const section = asks.slice(asks.indexOf('<section id="needs-you"'));
388 for (const old of ["ask-acts", "ask-card", "ask-group", "ask-kind", "ask-meta", "ask-more-acts", "ask-pick", "ask-short", "ask-waiting"])
389 expect(section).not.toContain(old);
390 const id = `look:${toShip.id}`;
391 // Ship: the card's primary button submits the ask's own hidden form.
392 expect(section).toContain(`<button type="submit" form="ask-${id}" class="btn" data-variant="primary" data-size="sm" > Ship </button>`);
393 expect(section).toContain(
394 `<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>`,
395 );
396 // Decline: the ask's box joins the bulk form, whose verbs include decline.
397 expect(section).toMatch(new RegExp(`<input type="checkbox" name="item" value="${id}" form="asks-bulk"`));
398 expect(section).toContain('<form id="asks-bulk" method="post" action="/asks/bulk"');
399 expect(section).toContain('<option value="decline" >Decline</option>');
400 // Say: the words go on the change's own page.
401 expect(section).toContain(`<a href="/alice/shipped/pulls/${toShip.number}#comment-body" class="btn" data-size="sm" >Not like this</a >`);
402 // Each posts and comes back to the page.
403 const declined = await fetch(`${servers.url}/asks/bulk`, {
404 method: "POST",
405 redirect: "manual",
406 headers: { cookie, origin: servers.url },
407 body: new URLSearchParams({ action: "decline", item: `look:${toDecline.id}` }),
408 });
409 expect(declined.status).toBe(200);
410 expect(await declined.text()).toContain("Decline: 1 of 1");
411 const applied = await fetch(`${servers.url}/asks/bulk`, {
412 method: "POST",
413 redirect: "manual",
414 headers: { cookie, origin: servers.url },
415 body: new URLSearchParams({ action: "decline", item: `look:${toDecline.id}`, apply: "1" }),
416 });
417 expect(applied.status).toBe(303);
418 expect(applied.headers.get("location")).toStartWith("/asks?op=");
419 const shipped = await fetch(`${servers.url}/alice/shipped/pulls/${toShip.number}/ship`, {
420 method: "POST",
421 redirect: "manual",
422 headers: { cookie, origin: servers.url },
423 body: new URLSearchParams({ pull: String(toShip.number), back: "/asks" }),
424 });
425 expect(shipped.status).toBe(303);
426 expect(shipped.headers.get("location")).toStartWith("/asks");
427 });
376428 });
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