From 9531952873c7078ae1d4e8bbecf37b696c19e891 Mon Sep 17 00:00:00 2001 From: Pranav Mathad Date: Sun, 29 Nov 2026 01:30:59 +0100 Subject: [PATCH 1/9] Show the origin note and take the sponsor date from the bundle in the web app --- web/src/components/Shell.tsx | 5 +++ web/src/data/bundle.ts | 8 ++++ web/src/screens/BeforeAfter.tsx | 12 ++++-- web/src/screens/Decisions.tsx | 3 +- web/src/screens/SizeMap.tsx | 14 +++++-- .../screens/beforeafter/DecisionSeries.tsx | 37 +++++++++++++------ web/src/screens/decisions/FixFirst.tsx | 37 ++++++++++++++----- web/src/screens/decisions/words.ts | 27 +++++++++++--- web/src/screens/size/StatsTable.tsx | 21 +++++++++-- web/src/screens/size/Treemap.tsx | 14 ++++--- 10 files changed, 136 insertions(+), 42 deletions(-) diff --git a/web/src/components/Shell.tsx b/web/src/components/Shell.tsx index b3856473..1165a0ba 100644 --- a/web/src/components/Shell.tsx +++ b/web/src/components/Shell.tsx @@ -105,3 +105,8 @@ export function formatDate(iso: string): string { if (!year || !month || !day) return iso; return `${day} ${MONTHS[month - 1]} ${year}`; } + +/** The sponsor date as shown in running text; a bundle without one gets the plain name. */ +export function formatSponsorDate(iso: string | null): string { + return iso ? formatDate(iso) : "the sponsor date"; +} diff --git a/web/src/data/bundle.ts b/web/src/data/bundle.ts index def65cd0..897899ce 100644 --- a/web/src/data/bundle.ts +++ b/web/src/data/bundle.ts @@ -24,6 +24,14 @@ export interface Bundle { folder: string; } +/** + * The sponsor date of spec.md §12.1 as an ISO date, read from the bundle's own snapshot + * list, or null when the bundle has no snapshot with that role. + */ +export function sponsorDate(index: BundleIndex): string | null { + return index.snapshots.find((snapshot) => snapshot.role === "sponsor_date")?.date ?? null; +} + type FetchJson = (url: string) => Promise; const fetchJson: FetchJson = async (url) => { diff --git a/web/src/screens/BeforeAfter.tsx b/web/src/screens/BeforeAfter.tsx index e33b80f5..a99f5c27 100644 --- a/web/src/screens/BeforeAfter.tsx +++ b/web/src/screens/BeforeAfter.tsx @@ -3,7 +3,7 @@ import "./beforeafter/beforeafter.css"; import { useMemo } from "react"; import { formatDate } from "../components/Shell"; -import type { Bundle } from "../data/bundle"; +import { type Bundle, sponsorDate } from "../data/bundle"; import { useSetView, useView } from "../data/view"; import { Changes } from "./beforeafter/Changes"; import { @@ -24,6 +24,7 @@ export function BeforeAfter({ bundle }: { bundle: Bundle }) { const file = bundle.beforeAfter; const side: Side = view.snapshot === file.before.date ? "before" : "after"; const date = side === "before" ? file.before.date : file.after.date; + const sponsor = sponsorDate(bundle.index); const labels = useMemo(() => { const out: Record = {}; @@ -124,15 +125,20 @@ export function BeforeAfter({ bundle }: { bundle: Bundle }) {

Each decision over time

- +

The project yardsticks

- + ); diff --git a/web/src/screens/Decisions.tsx b/web/src/screens/Decisions.tsx index 3a138417..e2c5a2dc 100644 --- a/web/src/screens/Decisions.tsx +++ b/web/src/screens/Decisions.tsx @@ -5,7 +5,7 @@ import { Link, useSearchParams } from "react-router"; import { formatDate } from "../components/Shell"; import { STATUSES, StatusGlyph } from "../components/Status"; import type { Decision, DecisionCheck } from "../contracts/generated"; -import type { Bundle } from "../data/bundle"; +import { type Bundle, sponsorDate } from "../data/bundle"; import { useView, viewLink } from "../data/view"; import { DecisionsTable, Healthy } from "./decisions/DecisionsTable"; import { FixFirst } from "./decisions/FixFirst"; @@ -160,6 +160,7 @@ export function Decisions({ bundle }: { bundle: Bundle }) { onSelect={select} repoId={index.repo_id} aiOff={aiOff} + sponsor={sponsorDate(index)} /> diff --git a/web/src/screens/SizeMap.tsx b/web/src/screens/SizeMap.tsx index a00e01f9..b6e61e05 100644 --- a/web/src/screens/SizeMap.tsx +++ b/web/src/screens/SizeMap.tsx @@ -2,13 +2,14 @@ // after March 2025 landed, and the numbers behind both. import "./size/size.css"; import { useMemo, useState } from "react"; -import type { Bundle } from "../data/bundle"; +import { type Bundle, sponsorDate } from "../data/bundle"; import { StatsTable } from "./size/StatsTable"; import { Treemap, TreemapLegend } from "./size/Treemap"; import { type SortKey, buildTree } from "./size/tree"; export function SizeMap({ bundle }: { bundle: Bundle }) { const { map, index } = bundle; + const sponsor = sponsorDate(index); const tree = useMemo(() => buildTree(map.nodes), [map.nodes]); const stats = useMemo(() => new Map(map.stats.map((s) => [s.node_id, s])), [map.stats]); const moduleIds = useMemo( @@ -51,13 +52,20 @@ export function SizeMap({ bundle }: { bundle: Bundle }) { ) : ( <> - - + +

Numbers per module

= t0 && t <= t1 ? x(t) : null; }; - const sponsor = marker(SPONSOR_DATE); + const sponsorAt = marker(sponsor); const adopted = marker(adoption); const last = points[points.length - 1]!; @@ -57,8 +57,8 @@ function SeriesLine({ role="img" aria-label={label} > - {sponsor !== null && ( - + {sponsorAt !== null && ( + )} {adopted !== null && ( @@ -84,13 +84,22 @@ function SeriesLine({ ); } -export function SeriesKey({ adoption }: { adoption: string | null }) { +/** `sponsor` and `adoption` are ISO dates from the bundle, or null when it has none. */ +export function SeriesKey({ + sponsor, + adoption, +}: { + sponsor: string | null; + adoption: string | null; +}) { return (

- -