Redesign the Election Trends chart, restyle election tables, add a catalogue section bar - #11
Merged
ScottMoore0 merged 5 commits intoSep 19, 2026
Conversation
The Trends tab drew a marker-heavy chart on an ordinal axis with rotated date labels. It now draws a newsroom-style line chart: a real time axis with upright year labels, thin lines in the existing party colours, a faint horizontal grid, percentages on the y-axis capped at 100, and direct labels at the end of each line carrying the latest share, with shorter forms as the pane narrows. Gaps stay real: the line stops where a party has no comparable result, a faint dotted bridge crosses the missing elections, and a lone result is a dot. Hover or touch shows a crosshair at the nearest election with a tooltip of every charted party's share in descending order; a line, its label or its key entry focuses that party and fades the rest; arrow keys move the crosshair. The chart renders at the container's real width and follows the pane height. The drawing lives in src/election-trend-chart.mjs, whose builders have no DOM dependency; the manager keeps the data path and only supplies points, captions and footnotes. Series ranking puts parties standing at the most recent election first, then others by peak, so the chart reads as a tracker rather than leading with 1918 single points. loadTrendSummary falls back to the static bundle when the elections API is unavailable, as loadBundle already did, so a static server shows the full history. The By Party, By Candidate and By Local Party tables are restyled through a layer scoped to the election pane so they sit with the chart: white surface, hairline row rules, no vertical grid, quiet bold headers, the site font, only the share change coloured, one underlined link per row, a dot for Elected. The shared table rules in assets/css/main.css are untouched, so tables elsewhere on the site are unchanged. The timeline play and stop buttons animate boundary layers and were always disabled while an election was open; they now hide instead. Existing Trends, election, catalogue and Books Playwright specs pass.
About used the 860px wrapper and capped its prose at about 68 characters while Home's body text fills the 1120px wide wrapper. Both About wrappers are now wrap--wide and the caps on paragraphs, lists and boxes are gone. The About stylesheet is linked with a content-hash ?v= because it was linked bare and browsers kept the old copy.
…the Books layout Elections, Maps, Books and Tables were a row of uppercase text links inside the contents box. They are now a segmented bar above it, the active section filled with the site gradient, each with a Lucide icon. The links keep their class and data attributes, so click handling and the Tables tab switch are unchanged. The active tab is remembered on the controller because the flat view is re-rendered when a section expands, which used to wipe aria-current. The bar is pinned under the title-and- search shell, with the shell's measured height published as a custom property, and the scroll-to-target offset now includes the bar. For the pin to hold, the flat view is sized to its content rather than clipped to the pane by flex sizing (the book viewer keeps its bounded height). Inside the box the Elections and Maps headings carry the same icons and each section after the first starts with a rule and a clear gap; the Tables pane gets a heading with the table icon. The Books section no longer reads the emoji from data/database/books.json: category headings and card badges use Lucide icons chosen by category id, all defined in one map in ui-controller.js. Three layout faults are fixed there: the category heading occupied the first grid cell so the first card jumped to the right column; the cover fallback badge was never hidden once a cover loaded, so both drew on top of each other; and cards stacked cover, title, author, date, buttons and a notice vertically. They are now compact rows with author and date on one line and the transcription notice in the Markdown button's tooltip.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Redesigns the Election Trends chart as a newsroom-style line chart, restyles the election pane tables to match, gives the maps catalogue a pinned section bar with Lucide icons, fixes the Books section layout, and lines the About page up with Home.
Everything the change touches, with the reasoning, is written up in
docs/election-trends-chart-and-catalogue-ui.md.What changed
Election Trends chart (
src/election-trend-chart.mjs, new;app/src/election-manager.js;app/src/test2.css)loadTrendSummaryfalls back to the static bundle when_apiis unavailable, asloadBundlealready did.Election pane tables (
app/src/test2.css, scoped to the pane)assets/css/main.cssare untouched.Timeline buttons (
app/src/app.js)Maps catalogue (
src/ui-controller.js,assets/css/main.css,maps/index.html)books.json; the category heading spans the grid (the first card used to jump to the right column); the cover fallback badge hides once a cover loads (both used to draw on top of each other); cards are compact rows with the transcription notice in the Markdown button's tooltip.About page (
pages/about.html,assets/pages/css/about.css)?v=.Build output (
app/build/*,sw.js, cache tokens inmaps/index.html) rebuilt with the project's scripts.Verification
npm run build: exit 0, performance dashboard 9/9.app.spec.jsandelection-layout.spec.js, 21 passed.npm run lint: 60 warnings before and after, none new.check:app-shell-cache,check:site-figures,check:pages-assets,check:root,check:site-partials,check:site-nav,check:asset-refs: pass.check:doc-pathsfails onUX-REMEDIATION-PLAN.mdon main too, unrelated.Notes