Skip to content

Redesign the Election Trends chart, restyle election tables, add a catalogue section bar - #11

Merged
ScottMoore0 merged 5 commits into
ScottMoore0:mainfrom
ACoci86:election-trends-and-catalogue-ui
Sep 19, 2026
Merged

ScottMoore0 merged 5 commits into
ScottMoore0:mainfrom
ACoci86:election-trends-and-catalogue-ui

Conversation

@ACoci86

@ACoci86 ACoci86 commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

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)

  • Real time axis with upright year labels, thin lines in the existing party colours, faint horizontal grid, percentage y-axis capped at 100.
  • Direct labels at the end of each line with the latest share, shortening to abbreviation, value only, then hidden as the pane narrows; pushed apart with leader lines so they never collide.
  • Real gaps: 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. No value is drawn for an election a party did not contest.
  • Crosshair and tooltip at the nearest election (mouse and touch), party focus by click, tap or key entry, arrow-key navigation, re-rendering at the container's real width.
  • Same data path and comparable-election filter. Series ranking puts parties standing at the latest election first, then others by peak. loadTrendSummary falls back to the static bundle when _api is unavailable, as loadBundle already did.
  • Existing test hooks kept; the Trends specs pass unchanged.

Election pane tables (app/src/test2.css, scoped to the pane)

  • White surface, hairline row rules, no vertical grid, quiet bold headers, 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.

Timeline buttons (app/src/app.js)

  • Play and stop only animate boundary layers and were always disabled while an election was open; they now hide instead.

Maps catalogue (src/ui-controller.js, assets/css/main.css, maps/index.html)

  • Elections, Maps, Books and Tables in a segmented bar above the contents box, pinned under the search shell, with Lucide icons. Links keep their classes and data attributes, so click handling is unchanged. The active tab survives re-renders.
  • Icons on the Elections and Maps headings inside the box, a rule and gap between sections, a Tables heading in the Tables pane.
  • Books: Lucide icons by category instead of the emoji from 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)

  • Same wide wrapper as Home, prose no longer capped at 68 characters, stylesheet linked with a content-hash ?v=.

Build output (app/build/*, sw.js, cache tokens in maps/index.html) rebuilt with the project's scripts.

Verification

  • npm run build: exit 0, performance dashboard 9/9.
  • Playwright: the Trends, election, catalogue, Tables and Books specs in app.spec.js and election-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-paths fails on UX-REMEDIATION-PLAN.md on main too, unrelated.
  • Checked in a browser at 1920, 1600, 1280, 1000, 700 and 390 px, light and dark, with touch emulation.

Notes

  • Not changed: the election data pipeline, map, URL and hash state, selectors, overlays, party colours, Browse.
  • Left alone, pre-existing: clicking Maps in the section bar lands part-way into the section rather than on its heading; the Dáil candidate table is wider than the pane and scrolls sideways with the name columns pinned.

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.
@ScottMoore0
ScottMoore0 merged commit 728e0ba into ScottMoore0:main Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants