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

The week page speaks the home page's language #9749

Parked opened this
Closed without merging

scout/forge:scout/9732-the-week-page-speaks-the-home-page-s-lan → main 2 commits fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
2 files changed +17 −17
docs/design/areas/week.md +5
@@ -1,3 +1,8 @@
11 # The week
22
33 On Next up (`src/web/pages/next.ts`) `.cut-line` is the separator row drawn between what this week's capacity can ship and what reads as next week: a dashed rule in `--series-1` with muted words under it. `.estimate` is a row's cost range, in `--fg` with tabular figures so ranges line up down the list. `/:owner/:name/week` uses only existing components (`card`, `row`, `btn`).
4
5 ## The week speaks home's language (#9732)
6
7
8 `/:owner/:name/week` speaks the home page's language: each part is an `<h2 class="mt">` over a `list setting-list` of rows or one muted line, and the polish share is a bare `stat` (home's figure type) with its `meter`, no card. A proposal is a row with one action: its own `<form method="post">` holding "Take it", shown only to someone who writes here; the same-origin and write check stays in `weekSubmit`. No new class, no fixed width.
src/web/pages/week.ts +12 −17
@@ -14,36 +14,33 @@ import { crumbsFor, loadRepo, notFoundPage, repoBase, repoHeader, repoPalette, s
1414 import { backTo, field, readForm } from "../form.ts";
1515 import { html, type Html } from "../html.ts";
1616 import { flashOrJson, page } from "../layout.ts";
17 import { btn, card, meter, row, stat } from "../ui.ts";
17 import { btn, meter, row, stat } from "../ui.ts";
1818
1919 const lines = (base: string, ls: readonly Line[], none: string): Html =>
2020 ls.length === 0
2121 ? html`<p class="muted">${none}</p>`
22 : card(
23 html`<ul class="list setting-list">${ls.map((l) =>
24 row({ href: `${base}/issues/${l.number}`, title: l.title, meta: html`#${String(l.number)} · ${l.why}` }),
25 )}</ul>`,
26 { pad: false },
27 );
22 : html`<ul class="list setting-list">${ls.map((l) =>
23 row({ href: `${base}/issues/${l.number}`, title: l.title, meta: html`#${String(l.number)} · ${l.why}` }),
24 )}</ul>`;
2825
2926 function screen(base: string, retro: Retro, taken: ReadonlySet<number>, writer: boolean): Html {
3027 const p = retro.projected;
3128 const shipped = retro.shipped.length;
3229 const acc = retro.accuracy;
33 return html`<h2>What shipped</h2>
30 return html`<h2 class="mt">What shipped</h2>
3431 <p>${p === null
3532 ? `${shipped} shipped. No projection was made for this week.`
3633 : `${shipped} shipped against a projection of ${p.shipLow === p.shipHigh ? p.shipHigh : `${p.shipLow} to ${p.shipHigh}`} (${p.confidence} confidence).`}</p>
3734 ${lines(base, retro.shipped, "Nothing shipped this week.")}
38 <h2>Estimate accuracy</h2>
35 <h2 class="mt">Estimate accuracy</h2>
3936 <p>${acc.compared === 0
4037 ? "No shipped issue had an estimate to compare."
4138 : `${acc.inside} of ${acc.compared} shipped issues cost inside their estimated range.`}</p>
42 <h2>Cost most for least</h2>
39 <h2 class="mt">Cost most for least</h2>
4340 ${lines(base, retro.costly, "Nothing open spent money this week.")}
44 <h2>Stuck</h2>
41 <h2 class="mt">Stuck</h2>
4542 ${lines(base, retro.stuck, "Nothing is stuck.")}
46 <h2>Proposed changes</h2>
43 <h2 class="mt">Proposed changes</h2>
4744 ${retro.proposals.length === 0
4845 ? html`<p class="muted">Nothing to propose.</p>`
4946 : html`<ul class="list setting-list">${retro.proposals.map((pr, idx) =>
@@ -66,14 +63,12 @@ function screen(base: string, retro: Retro, taken: ReadonlySet<number>, writer:
6663 /** Polish spent against its share: a labelled fact, with the words the terminal and the tool print under it. */
6764 function polishCard(ctx: Ctx, repo: Repo): Html {
6865 const p = polishSpend(ctx.app.db, repo.id, repo.polishShare, new Date());
69 return card(
70 html`<div data-polish>${stat({
66 return html`<div data-polish>${stat({
7167 label: "Polish share",
7268 value: `${p.percent.toFixed(1)}% of ${p.share}%`,
7369 title: "Agent spend in the last seven days on issues labelled polish or in the small-fixes lane, against all agent spend",
7470 note: html`${polishWords(p)}`,
75 })}${meter(p.share === 0 ? 100 : (p.percent / p.share) * 100, `polish has used ${p.percent.toFixed(1)}% of the week's spend; its share is ${p.share}%`, p.under ? undefined : "attn")}</div>`,
76 );
71 })}${meter(p.share === 0 ? 100 : (p.percent / p.share) * 100, `polish has used ${p.percent.toFixed(1)}% of the week's spend; its share is ${p.share}%`, p.under ? undefined : "attn")}</div>`;
7772 }
7873
7974 export function weekPage(ctx: Ctx): Response {
@@ -91,7 +86,7 @@ export function weekPage(ctx: Ctx): Response {
9186 ? "The forge writes this when the weekly window closes. None has closed yet."
9287 : `Written when the window ended ${retro.weekEnd.slice(0, 10)}, once, and never edited.`} <a href="${base}/next">Next up</a></p>
9388 </div>
94 <h2>Polish this week</h2>
89 <h2 class="mt">Polish this week</h2>
9590 ${polishCard(ctx, repo)}
9691 ${retro === undefined ? null : screen(base, retro, takenOf(ctx.app.db, repo.id, retro.weekEnd), writer)}`;
9792 const response = page({ ctx, title: `The week · ${repo.name}`, crumbs: crumbsFor(repo), palette: repoPalette(ctx, repo), body });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs