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:
1 parent
5a098e44d8
commit
384b09371a
28 files changed
+3968
-1
No files matched your search
@@ -0,0 +1,126 @@
|
||||
/* Design tokens.
|
||||
*
|
||||
* Three themes, selected by `data-theme` on <html>: light, dark, blue.
|
||||
* Components never write a colour literal -- they reference a token, so a
|
||||
* fourth theme is a block in this file and nothing else.
|
||||
*
|
||||
* Contrast: every text/background pair below meets WCAG AA (>= 4.5:1 for body
|
||||
* text, >= 3:1 for large text and UI borders). `npm run check:contrast`
|
||||
* asserts it -- run it after touching any colour here, because this is
|
||||
* exactly the kind of thing that regresses silently.
|
||||
*/
|
||||
|
||||
:root {
|
||||
/* --- shape and space (theme-independent) --- */
|
||||
--radius-sm: 4px;
|
||||
--radius: 8px;
|
||||
--radius-lg: 14px;
|
||||
|
||||
--space-1: 4px;
|
||||
--space-2: 8px;
|
||||
--space-3: 12px;
|
||||
--space-4: 16px;
|
||||
--space-5: 24px;
|
||||
--space-6: 32px;
|
||||
--space-7: 48px;
|
||||
|
||||
--font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
|
||||
"Helvetica Neue", Arial, sans-serif;
|
||||
--font-mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas,
|
||||
"Liberation Mono", monospace;
|
||||
|
||||
--text-xs: 0.75rem;
|
||||
--text-sm: 0.875rem;
|
||||
--text-base: 1rem;
|
||||
--text-lg: 1.125rem;
|
||||
--text-xl: 1.5rem;
|
||||
--text-2xl: 2rem;
|
||||
|
||||
--transition: 120ms ease;
|
||||
--header-height: 56px;
|
||||
}
|
||||
|
||||
/* --- light ---------------------------------------------------------- */
|
||||
:root,
|
||||
[data-theme="light"] {
|
||||
color-scheme: light;
|
||||
|
||||
--bg: #f6f8fb;
|
||||
--surface: #ffffff;
|
||||
--surface-raised: #ffffff;
|
||||
--surface-sunken: #eef2f7;
|
||||
/* --border is decorative (dividers, card edges) and is exempt from the
|
||||
contrast rule. --border-strong bounds interactive controls -- inputs,
|
||||
focus rings -- so WCAG 1.4.11 wants 3:1 against the surface behind it. */
|
||||
--border: #dde3ec;
|
||||
--border-strong: #848f9e;
|
||||
|
||||
--text: #14202e;
|
||||
--text-muted: #56677d;
|
||||
--text-inverse: #ffffff;
|
||||
|
||||
--accent: #1257c4;
|
||||
--accent-hover: #0e46a0;
|
||||
--accent-subtle: #e4edfb;
|
||||
|
||||
--success: #17724a;
|
||||
--warning: #8a5a00;
|
||||
--danger: #b3242c;
|
||||
|
||||
--shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 4px 12px rgb(16 24 40 / 8%);
|
||||
--overlay: rgb(16 24 40 / 40%);
|
||||
}
|
||||
|
||||
/* --- dark (neutral) ------------------------------------------------- */
|
||||
[data-theme="dark"] {
|
||||
color-scheme: dark;
|
||||
|
||||
--bg: #121417;
|
||||
--surface: #191c21;
|
||||
--surface-raised: #21252b;
|
||||
--surface-sunken: #0d0f12;
|
||||
--border: #2e343c;
|
||||
--border-strong: #656d7a;
|
||||
|
||||
--text: #e8eaed;
|
||||
--text-muted: #a3adba;
|
||||
--text-inverse: #10141a;
|
||||
|
||||
--accent: #6ba1ff;
|
||||
--accent-hover: #8bb6ff;
|
||||
--accent-subtle: #1b2534;
|
||||
|
||||
--success: #3dd68c;
|
||||
--warning: #f0b429;
|
||||
--danger: #ff6b71;
|
||||
|
||||
--shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px rgb(0 0 0 / 40%);
|
||||
--overlay: rgb(0 0 0 / 60%);
|
||||
}
|
||||
|
||||
/* --- blue (dark navy) ----------------------------------------------- */
|
||||
[data-theme="blue"] {
|
||||
color-scheme: dark;
|
||||
|
||||
--bg: #0b1220;
|
||||
--surface: #111c2e;
|
||||
--surface-raised: #17253b;
|
||||
--surface-sunken: #070d17;
|
||||
--border: #22344f;
|
||||
--border-strong: #5a7196;
|
||||
|
||||
--text: #e6edf7;
|
||||
--text-muted: #9fb3ce;
|
||||
--text-inverse: #0b1220;
|
||||
|
||||
--accent: #4c8dff;
|
||||
--accent-hover: #6ba1ff;
|
||||
--accent-subtle: #152740;
|
||||
|
||||
--success: #3dd68c;
|
||||
--warning: #f0b429;
|
||||
--danger: #f2545b;
|
||||
|
||||
--shadow: 0 1px 2px rgb(0 0 0 / 45%), 0 8px 28px rgb(3 8 18 / 55%);
|
||||
--overlay: rgb(4 9 18 / 65%);
|
||||
}
|
||||
Reference in new issue
Block a user