UI: scaffold the web app - shell, themes, i18n, auth plumbing

React 19 + TypeScript + Vite + TanStack Query/Router in web/, built on the
dev machine and shipped as static files (SPEC section 6). Typechecks and
builds clean; the System page reads live /health through the Vite proxy,
which proves browser -> proxy -> FastAPI -> PostgreSQL end to end.

Themes: light, dark and blue (dark navy), as design tokens on data-theme.
An inline script applies the stored theme before first paint. No colour
literal lives outside tokens.css.

check-contrast.mjs asserts WCAG AA for every text/background pair in every
theme, with no dependencies. It failed on its first run and found three
--border-strong values below the 3:1 that WCAG 1.4.11 wants for interactive
boundaries; all three are fixed and 36 pairs now pass. Colour contrast is
the classic silently-regressing property, so it gets a test rather than a
promise.

i18n is hand-written and typed rather than react-i18next: en.ts defines the
key set, de.ts is typed against it, so a missing German string fails the
build instead of quietly showing English to a German user.

Authentication is built but NOT enforced, deliberately. /auth/session,
/auth/login and /auth/logout do not exist yet, so router.tsx does not wrap
routes in RequireAuth and a banner says so plainly. There is no development
bypass: a bypass that works is the kind of code that survives into
production, and an auth bypass that works is the worst possible bug.

Gallery and Devices render honest empty states rather than mock rows. Fake
data hides the layout problems real data exposes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Thomas KarnerandClaude Opus 5 committed 2026-09-21 01:17:07 +02:00
1 parent 5a098e44d8
commit 384b09371a
28 files changed
+3968 -1

No files matched your search

+11 -1
View File
@@ -140,7 +140,17 @@ bird photo appears in a browser.
## Phase 3 — WebUI
- [ ] React + TS + Vite + TanStack Query/Router, built on the dev machine, served as static files by Caddy
Scaffolding done — see [`web/README.md`](web/README.md). Typechecks, builds,
and the System page reads live data through the Vite proxy.
- [x] React 19 + TS + Vite + TanStack Query/Router, built on the dev machine, served as static files by Caddy
- [x] Three themes as design tokens, `data-theme` on `<html>`, no flash of the wrong theme
- [x] `npm run check:contrast` — asserts WCAG AA across all three themes; caught three failing `--border-strong` values on its first run
- [x] i18n de/en with a build-time-complete catalogue
- [x] Auth shell: provider, login form with TOTP field, `RequireAuth` — **written, deliberately not enforcing** (no endpoints yet, and no dev bypass on purpose)
- [x] System page on live `/health` — the end-to-end proof browser → proxy → FastAPI → Postgres
- [ ] Wire `RequireAuth` into `router.tsx` and delete the "not enforced" banner, once `/auth/*` exists
- [ ] ESLint (skipped during scaffolding; `tsc --noEmit` covers the important cases for now)
- [ ] Virtualised gallery grid; filters for date range, taxon, device, tag, reviewed, kept
- [ ] Observation editor — `captures` 1—n `observations`, so a photo can hold two species or none
- [ ] Taxon autocomplete; seed `taxa` with 60–80 Central European garden species incl. GBIF keys, `name_de` + `name_en`, `is_local_common` ranking first