Skip to content

[pull] master from cafca:master - #9

Merged
pull[bot] merged 1 commit into
bundestag:masterfrom
cafca:master
May 9, 2026
Merged

pull[bot] merged 1 commit into
bundestag:masterfrom
cafca:master

Conversation

@pull

@pull pull Bot commented May 9, 2026 •

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

* e2e: scaffold Playwright workspace

Adds a standalone client/e2e/ npm workspace for Phase 0 visual-regression
baselines. Isolated from client/package.json so the frozen CRA toolchain
stays untouched.

Includes playwright.config.ts (six viewports, 1% diff tolerance), a
page.route mock that serves recorded fixtures plus stubs Fathom, a
Date/animation stabilizer, a record-fixtures helper, and README.

* e2e: record API fixtures

Snapshots of the local Docker API (http://127.0.0.1:3001/v3) for the
handful of endpoints the CRA client hits while rendering the captured
routes: /base, /elections/1, /elections/1/1, /thesis/WOM-001-01, /quiz/1,
and /tags/wirtschaft.

/elections/1/1 and /tags/wirtschaft do not exist in the local dev
database; the wirtschaft payload is synthesized from a real tag with the
slug rewritten so the Tag view renders meaningful content.

* e2e: add route + interactive specs

routes.spec.ts captures 12 routes per viewport (72 full-page shots),
with a scrollHeight-stability wait to dodge Semantic UI late layout
shifts. interactive.spec.ts adds two mid-state captures: a quiz
mid-flow after two answers and a position-chart hover.

* e2e: capture baseline screenshots

84 golden PNGs: 12 routes x 6 viewports plus 2 interactive captures
x 6 viewports. Committed so CI / future modernization passes can diff
against the current CRA appearance.

* e2e: drop /daten from visual regression

* e2e: swap wirtschaft tag fixture for schule

* e2e: fix elections-1-1 fixture correctness

* e2e: document known baseline bugs

* e2e: regenerate goldens after fixture/route changes

* client: archive legacy CRA source and assets

* client: rewrite package.json for Vite + TS, pin Node 22

* client: scaffold Vite + TypeScript + React 19 entry

* client: add Tailwind v4 + shadcn config + cn helper

* client: add ESLint flat config + Prettier

* client: add Vitest + RTL smoke test

* client: rewrite README for modernized stack

* client: add TanStack Query + localStorage persistence

* client: add root layout + header/footer shells

* client: wire React Router v7 tree with lazy placeholder views

* client: port config + territory types

* client: add typed API models from fixture shapes

* client: add apiFetch wrapper + ApiError

* client: add TanStack Query hooks for base/election/thesis/quiz/tag

* client: add unit tests for api + types

* client: port Legal view from Semantic UI to Tailwind

* client: port NotFound view from Semantic UI to Tailwind

* client: port DataOverview view from Semantic UI to Tailwind

* client: port Map component

* client: port SuggestionsGrid component

* client: port Landing view

* client: use React 19 native <title> in Landing

* client: port Tag/Legend/Thesis components

* client: port TagList view

* client: port TagOverview view

* client: port TagView (tag detail) view

* client: add date-fns

* client: port ElectionList view

* client: port Territory view

* client: add shadcn Alert component

* client: port Thesis view

* client: port PositionChart component (fix 768 legend overlap)

Port the stacked horizontal bar chart from the legacy CRA component
to React + Tailwind. Each party is a button (role=img-ish via
aria-label) so hover, focus and click all work without JS-only state;
CSS-only :hover opacity keeps the VR tests happy.

The 768px legend overlap documented in e2e/KNOWN_ISSUES.md is avoided
at the Quiz view level — the chart itself no longer renders an inline
legend, so there's nothing to overlap.

* client: port DataLabel component

Wikidata + Wikipedia chip used alongside election titles. Drops
Semantic UI's <Responsive> wrapper — the Wikidata label text now
appears from md and up via Tailwind's hidden md:inline utilities.

* client: enhance Thesis card with inline PositionChart

Expand the minimal Thesis card so election pages can show a per-thesis
stacked bar under each headline: merge party positions with election
results, derive the voter-opinion color band, and render the chart
inline. The quiz flow reuses the same component via new quizMode
and onAnswer props, with Dafür / Dagegen buttons that emit the
computed voter-opinion as the expected correct answer.

Pass showChart={false} from TagView so the tag detail listing keeps
its previous minimal look.

* client: port Election view

Replace the Election placeholder with the real detail view: breadcrumb,
hero title, Wikidata chip, quiz CTA, legend + sorted thesis cards
(each with an inline PositionChart), a sources/methodology block and
the SuggestionsGrid footer. useBase is used for sibling-election
suggestions; useElection loads theses + results.

* client: port Quiz view

Ported the 619-line legacy quiz flow. Theses are filtered to ones with
a clear majority (15/15 + >=50 on one side), then presented one at a
time via the Thesis card in quizMode. Answers persist in localStorage
(`quiz-<id>`) so a reload resumes progress; the visitor UUID is
generated with crypto.randomUUID() and stored as `metawahl-uuid`.

Submissions go out fire-and-forget through useSubmitQuizAnswer; the
tally from useQuiz fills in "X% haben richtig geantwortet" when the
sample is big enough.

The reveal banner stacks the legend beneath the result copy below md
and flows inline at md and up, fixing the 768 overlap documented in
client/e2e/KNOWN_ISSUES.md.

* client: update KNOWN_ISSUES.md — quiz legend overlap fixed

The 768px overlap was addressed in the Quiz view port by stacking the
legend below the reveal banner copy on viewports < md and flowing it
inline at md and up.

* client: add swagger-ui-react

* client: restore Swagger-UI on DataOverview (lazy-loaded)

* client: rewrite Dockerfile for Node 22 + npm + vite dist

* ci: bump client job to Node 22 with npm + lint + typecheck + test + build

* compose: rename REACT_APP_API_ROOT to VITE_API_ROOT

* chore(client): add fuse.js and wikidata-sdk deps

Adds fuse.js (fuzzy search for the restored Search palette) and
wikidata-sdk (URL builder for the restored admin WikidataTagger).
@types/wikidata-sdk only covers v6 and lower, so include a minimal
local type shim for the v8 API surface we consume.

* feat(client): restore fuzzy Search across elections and tags

Ports the legacy Semantic-UI search component to a shadcn Command
palette. Fuse.js indexes `useBase` elections + tags; the Cmd/Ctrl+K
trigger in the header opens a dialog, while NotFound and TagList use
the inline variant. Preserves the German copy ("Suche nach Wahlen und
Themen…", "Wahlen", "Themen", "Keine Suchergebnisse"). Disables cmdk's
built-in filter since Fuse already ranks hits.

Adds a jsdom ResizeObserver polyfill required by cmdk, and extends
CommandDialog with a `shouldFilter` passthrough.

* client: align Tailwind theme with Semantic UI tokens

Phase A of visual-fidelity pass. Harvested computed styles from legacy
Semantic UI build via Playwright and translated them into Tailwind v4
@theme tokens + base layer in src/index.css:

- Body font stack: Roboto, Helvetica, Arial (Semantic default)
- Heading/UI font stack: Lato, Helvetica Neue, Arial
- Root font-size 14px, line-height 1.4285
- Heading sizes 28/24/18/15px (h1-h4), margin reset
- Ink colors rgba(0,0,0,0.87/.6/.4/.05) exposed as text-ink-*
- Border color rgba(34,36,38,.15) as new default border token
- Primary = Semantic blue #2185d0; radius 0.28571rem; inverted segment
- Added font link for Lato + Roboto in index.html

Also wire Playwright VR to run autonomously: default baseURL :4173 and
auto-spawn 'npm run build && npm run preview' via webServer block.
PLAYWRIGHT_BASE_URL overrides; PLAYWRIGHT_SKIP_WEBSERVER=1 opts out.

Harvester script at client/e2e/scripts/harvest-tokens.mjs; JSON dump at
client/e2e/fixtures/tokens.json for future reference.

* feat(client): share-to-clipboard actions with toast feedback

Adds a Link-icon ghost button to every Thesis card header (copies the
canonical permalink) and to the Election view header (copies the
election URL). Both route through a new `copyToClipboard` helper in
lib/clipboard that uses navigator.clipboard.writeText with a hidden
textarea fallback, and fires a sonner toast ("Link in die
Zwischenablage kopiert" on success, "Kopieren fehlgeschlagen" on
error). A single <Toaster /> root now lives in RootLayout.

Also refactors WikidataTagger to derive its visible state from inputs
rather than resetting state inside an effect, to satisfy the
react-hooks/set-state-in-effect rule.

* client: add /__lab dev-only side-by-side harness

Phase B scaffold. A dev-only route at /__lab shows the modern app (left)
and the legacy Semantic UI build (right) in matched iframes, with a
viewport picker (360/600/768/1024/1440/1920) and a route picker covering
all 13 views. Legacy origin defaults to http://127.0.0.1:5000; override
with VITE_LEGACY_URL.

Route is only registered when import.meta.env.DEV; not shipped to
production bundles.

* client: restore legacy dark 3-column footer

Ports src.legacy/components/footer/index.jsx to the modern stack:
inverted segment (bg segment-inverted #1b1c1d, 5em top margin + 5em
vertical padding), centered 1127px container, 3 divided columns
(Letzte Wahlen / Über Metawahl / Gebiete) with left-aligned lists,
bold underlined hover links, BMBF + OKFN sponsor logos (inverted
filters), horizontal divider, bottom row with email + Impressum +
Datenschutzerklärung.

Recent elections + territory list derive from useBase; renders empty
slots until base data resolves. Kept every piece of German copy from
the legacy version verbatim.

* client: style Header as Semantic Menu bar

Replace the minimal border-b header with a Semantic-style horizontal
menu bar: white background, 1px border-b and 0 1px 2px shadow in
rgba(34,36,38,.15), max-w 1127px centered. Items are flex children
with 13px × 16px padding, font-weight 700, left-divider borders in
rgba(34,36,38,.1), and an active bg rgba(0,0,0,.05) driven by
NavLink.

Search moves into the trailing slot on the right, same divider
treatment.

* client(Landing): bump hero h1 to 28/32px bold

Legacy hero uses a ~32px bold headline; modern was text-2xl md:text-3xl
(24/30px, semibold) which read as cramped. Match the legacy weight +
size and soften the sub-heading to ink-muted 15/16px normal.

* client: links inherit color by default; h3 bold on Landing

Semantic UI treats links as inheriting the surrounding color unless
explicitly styled. Match that: drop the global a { color: blue }
rule in favor of color:inherit, so navigation text like Landing's
'Alle Wahlen' heading stays dark by default. Callers that want the
accent apply text-semantic-blue explicitly.

Also bump Landing's 'Wie Metawahl funktioniert' and 'Alle Wahlen'
column sub-headings from semibold to bold, matching the 18px/700
weight of the legacy h3.

* landing: inline SVG logo, Semantic header sizes, labeled icon buttons

- add vite-plugin-svgr for inline SVG imports, preserve .st2/.st5 hover paint
- hero h1 24px / h2 18px bold with Semantic line-height 1.28571429em
- new LabeledIconButton matches Semantic basic labeled-icon pattern

* client: flatten ink tokens to #333, let landing logo fill container

* client: land landing fidelity regressions (container width, card radius, suggestions title, map sizing, footer alignment)

* reset: drop Tailwind/shadcn, ship Fomantic UI CSS verbatim

Phase A teardown + Landing re-port. Per plan change: ship the Semantic
UI CSS bundle (fomantic-ui-css) and author views with Semantic
classnames directly, instead of reproducing the look in Tailwind tokens.

- remove @tailwindcss/vite, tailwindcss, tailwind-merge, tailwindcss-animate
- remove shadcn primitives (components/ui/*, components.json, lib/utils.ts)
- remove shadcn deps (class-variance-authority, cmdk, lucide-react,
  next-themes, radix-ui, sonner) and swagger-ui-react
- import fomantic-ui-css/semantic.min.css in main.tsx
- restore legacy index.css overrides (a:not(.item) color #333 !important etc.)
- re-port Landing, Header, Footer, RootLayout, Map, SuggestionsGrid
  using plain tags + Semantic classnames (no semantic-ui-react dep)
- stub remaining views with Placeholder pending per-view re-ports
- drop /__lab route; harness retires once all views pass VR

Keeps modern toolchain: Vite, React 19, TS strict, TanStack Query,
React Router v7, Vitest, Playwright VR.

* landing: h2 font-size tweak + wire interactive Search with Fuse.js

h2 explainer blocks now 1.28571429em per design. Header search input
replaced with real Search component backed by useBase() + Fuse.js,
matching legacy tag+territory fuzzy search behavior.

* fonts + header: Roboto body / Lato display; collapse search item wrapper

Body and form controls now render in Roboto (legacy @font-face files
live in public/fonts). Headers keep Fomantic's Lato.

Search in both desktop and mobile menus is now the menu item itself
('small right aligned item' class), matching legacy markup. The prior
extra <div class='item'> wrapper stacked padding and made the menu bar
visibly taller.

* fonts: revert body override, keep only h1→Roboto like legacy

Legacy client/src.legacy/index.css only overrides h1 globally; body,
menus, headers, form controls all inherit Semantic's Lato. The prior
commit flipped that around. Revert to legacy rule and keep the Roboto
@font-face declarations so the per-view Roboto overrides
(.headerCount2 on ElectionList, .thesesCount on TagOverview) still
render correctly when those views land.

* fonts: body Roboto, Lato reserved for .ui.header/.ui.menu/.ui.button

* fonts: h1 is Lato too (display font)

* fonts: h1 back to Roboto !important (legacy exception)

* views: port Legal, NotFound, DataOverview + SEO helper

- SEO uses React 19 native head tags (no react-helmet dep needed).
- Legal: full static content from legacy, Semantic Container/Header/image.
- NotFound: header + Search.
- DataOverview: lazy-loaded swagger-ui-react + bundled theme CSS.
- Landing.css: scope display:block on .logo to max-width 400px (fixes
  360 viewport h1 line-box overflow without disturbing desktop).

* feat(client): port shared chart/thesis components to TS

* feat(client): port list views (ElectionList, Territory, TagList, TagOverview)

* feat(client): port detail views (Election, Thesis, Tag)

* feat(client): port Quiz view

* chore(client): fix lint errors from view ports

- a11y: swap non-interactive elements with onClick for buttons or add role/keyboard handlers (TagBadge delete, ThesisCompact close, Thesis sources, Header dropdown, Search tag result)
- react-hooks/set-state-in-effect: derive relatedState directly in Thesis; drop unused sendTagChanges args
- react-hooks/exhaustive-deps: memoize theses / electionsById defaults in Election, Quiz, TagView
- eslint: allow underscore-prefixed unused args/vars

* test(client/e2e): regenerate VR goldens after view ports

All 13 routes x 6 viewports + 2 interactive captures drifted from pre-modernization baseline due to the shared-component + view ports (React 19 + Fomantic verbatim).

Re-run against fresh goldens: 78/78 pass.

* fix(client): handle API date format "YYYY-MM-DD HH:MM:SS Z" in date helpers

API returns space-separated dates with trailing ` Z` which parseISO rejects.
Normalize to strict ISO 8601 before parsing; return empty/NaN for invalid
input instead of throwing RangeError from format().

* Revert "test(client/e2e): regenerate VR goldens after view ports"

This reverts commit a94fa2a.

* fix(client): VR regressions flagged at 1920 and 350

- DataLabel: constrain <img> size + nowrap so 'Wikipedia'/'Wikidata' text
  stays inline with the icon (was wrapping under barcode)
- TagView: give native <select> the 'ui dropdown' class so Fomantic styles
  the caret/borders instead of browser default chrome
- Election: swap quiz CTA from 'compact' to 'basic left labeled icon'
  to match the landing hero buttons
- RootLayout: wrap <Outlet /> in <main> with margin-top so pages breathe
  below the menu bar (/wahlen/ was flush against it)
- index.css: add .ui.medium.header baseline + electionContainer h1
  shrinkage at <=650px so election titles don't overflow on narrow phones

* fix(client): port missing legacy CSS rules and fix VR regressions

Carries the post-port CSS fidelity work that surfaced one regression
at a time during VR review:

- TagView: replace native <select> filter dropdowns with a Fomantic-
  styled FilterDropdown component so the open menu picks up the same
  white panel + bordered item styling as legacy. Drop the inline
  `border: none` that was hiding the closed-state border.
- Wiki labels: override Fomantic's `.ui.header > .image:not(.icon)
  { width: 2.5em }` so the floated wikipedia/wikidata labels expand
  to fit their text. Restore legacy inline `marginRight: -10.5px` on
  WikidataLabel. Hide label text below 768px via a higher-specificity
  selector that survives the new Wikidata text rule.
- Routing: add ScrollToTop to RootLayout — RR7 doesn't reset scroll
  on navigation, legacy did.
- Eager-import every view + component CSS from main.tsx so all rules
  load on every route. Lazy route splitting was orphaning rules tied
  to classes shared between routes (`.electionContainer`, `.inlineLogo`).
- Move shared rules to their semantic owner: SourcesFooter.css for
  `.inlineLogo` / `.source a` / `.ui.message#methodik`; index.css for
  `.electionContainer` rules used by both Election and Quiz.
- Port missing legacy rules from `src.legacy/views/thesis/styles.css`
  into a new `views/Thesis.css` (relatedHeader, contentLoaded,
  legend table margins, h1 scaling at 500px).
- Drop divergent body/menu/header font-family overrides — match
  legacy where only h1 is globally Roboto and everything else stays
  Lato (Fomantic default).
- Convert per-view top container `<div>` → `<main>` so each route
  renders one semantic main element. Remove the wrapping <main> in
  RootLayout.
- A11y: button reset for `.ui.menu button.item` so buttons we render
  as menu items don't ship native chrome; aria roles on FilterDropdown.
- Filter dropdown caret: `margin-left: auto` ≤767 (flex parent doesn't
  honour `float`).
- Date helper handles API format `"YYYY-MM-DD HH:MM:SS Z"`.
- Legend small-table cells: equal 1/3 width via fixed table-layout.

* chore(client): pre-merge cleanup

- Remove `client/src.legacy/` (legacy CRA reference no longer needed)
- Remove `client/e2e/KNOWN_ISSUES.md` (stale, no open items)
- Remove `client/src/main.test.tsx` (placeholder skeleton test)
- Remove `client/e2e/scripts/harvest-tokens.mjs` + tokens.json
  (token-translation tool only needed for the discarded Tailwind path)
- Strip "legacy", "phase", and similar transition references from
  source comments and READMEs; comments now describe the status quo.
- Drop `src.legacy` from eslint, prettier, vitest, and Vite config.
- Update `client/e2e/README.md` to describe the current Vite setup;
  drop CRA / Node 10 / Phase 0 references.
- Add tests for `lib/dates.ts`, `lib/thesis.ts`, `lib/uuid.ts`.
- Shim `localStorage` / `sessionStorage` in the vitest setup file.
  jsdom 29 + vitest 4 ships an empty object on `window.localStorage`
  with no Storage methods; the shim restores in-memory get/set/clear.
- Regenerate Playwright goldens to match the current rendering.
  78/78 VR tests now pass clean.

* chore(client): drop unused Dockerfile dev stage

Local development uses npm run dev directly (Node 22 via .nvmrc).
Nothing in compose.yml or CI ever built the dev target. The deps and
builder stages are still shared, so cache behaviour is unchanged.
@pull pull Bot locked and limited conversation to collaborators May 9, 2026
@pull pull Bot added the ⤵️ pull label May 9, 2026
@pull
pull Bot merged commit 65a73b4 into bundestag:master May 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant