Public: anyone can read this; the crew can change it.
The week page speaks the home page's language #9749
scout/forge:scout/9732-the-week-page-speaks-the-home-page-s-lan → main 2 commits fork
2 files
changed +17
−17
docs/design/areas/week.md +5
| @@ -1,3 +1,8 @@ | ||
| 1 | 1 | # The week |
| 2 | 2 | |
| 3 | 3 | 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 | ||
| 14 | 14 | import { backTo, field, readForm } from "../form.ts"; |
| 15 | 15 | import { html, type Html } from "../html.ts"; |
| 16 | 16 | 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"; | |
| 18 | 18 | |
| 19 | 19 | const lines = (base: string, ls: readonly Line[], none: string): Html => |
| 20 | 20 | ls.length === 0 |
| 21 | 21 | ? 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>`; | |
| 28 | 25 | |
| 29 | 26 | function screen(base: string, retro: Retro, taken: ReadonlySet<number>, writer: boolean): Html { |
| 30 | 27 | const p = retro.projected; |
| 31 | 28 | const shipped = retro.shipped.length; |
| 32 | 29 | const acc = retro.accuracy; |
| 33 | return html`<h2>What shipped</h2> | |
| 30 | return html`<h2 class="mt">What shipped</h2> | |
| 34 | 31 | <p>${p === null |
| 35 | 32 | ? `${shipped} shipped. No projection was made for this week.` |
| 36 | 33 | : `${shipped} shipped against a projection of ${p.shipLow === p.shipHigh ? p.shipHigh : `${p.shipLow} to ${p.shipHigh}`} (${p.confidence} confidence).`}</p> |
| 37 | 34 | ${lines(base, retro.shipped, "Nothing shipped this week.")} |
| 38 | <h2>Estimate accuracy</h2> | |
| 35 | <h2 class="mt">Estimate accuracy</h2> | |
| 39 | 36 | <p>${acc.compared === 0 |
| 40 | 37 | ? "No shipped issue had an estimate to compare." |
| 41 | 38 | : `${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> | |
| 43 | 40 | ${lines(base, retro.costly, "Nothing open spent money this week.")} |
| 44 | <h2>Stuck</h2> | |
| 41 | <h2 class="mt">Stuck</h2> | |
| 45 | 42 | ${lines(base, retro.stuck, "Nothing is stuck.")} |
| 46 | <h2>Proposed changes</h2> | |
| 43 | <h2 class="mt">Proposed changes</h2> | |
| 47 | 44 | ${retro.proposals.length === 0 |
| 48 | 45 | ? html`<p class="muted">Nothing to propose.</p>` |
| 49 | 46 | : 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: | ||
| 66 | 63 | /** Polish spent against its share: a labelled fact, with the words the terminal and the tool print under it. */ |
| 67 | 64 | function polishCard(ctx: Ctx, repo: Repo): Html { |
| 68 | 65 | 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({ | |
| 71 | 67 | label: "Polish share", |
| 72 | 68 | value: `${p.percent.toFixed(1)}% of ${p.share}%`, |
| 73 | 69 | title: "Agent spend in the last seven days on issues labelled polish or in the small-fixes lane, against all agent spend", |
| 74 | 70 | 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>`; | |
| 77 | 72 | } |
| 78 | 73 | |
| 79 | 74 | export function weekPage(ctx: Ctx): Response { |
| @@ -91,7 +86,7 @@ export function weekPage(ctx: Ctx): Response { | ||
| 91 | 86 | ? "The forge writes this when the weekly window closes. None has closed yet." |
| 92 | 87 | : `Written when the window ended ${retro.weekEnd.slice(0, 10)}, once, and never edited.`} <a href="${base}/next">Next up</a></p> |
| 93 | 88 | </div> |
| 94 | <h2>Polish this week</h2> | |
| 89 | <h2 class="mt">Polish this week</h2> | |
| 95 | 90 | ${polishCard(ctx, repo)} |
| 96 | 91 | ${retro === undefined ? null : screen(base, retro, takenOf(ctx.app.db, repo.id, retro.weekEnd), writer)}`; |
| 97 | 92 | const response = page({ ctx, title: `The week · ${repo.name}`, crumbs: crumbsFor(repo), palette: repoPalette(ctx, repo), body }); |
new above
offline