Frontend rewrite (frontend/, replacing backend/static/): - Vite + TypeScript + React 19, React Router 7, zustand, TanStack Query 5 - dev: vite proxy /api -> :9000; prod: npm run build -> dist/, served by the backend with SPA fallback - pages: Control (gun bays w/ scope+readiness-gated start/stop, relays), History (who/via/gun/when/duration/kWh audit), Cards (pending review, enrolled, rejected), Users (permission checkbox matrix) - self-contained: fonts bundled, no CDN; light/dark; reduced-motion safe Backend: - learn mode removed: unknown cards are always refused and queued in pending_cards; admin approves (name + owner + gun restrictions in one step) or rejects (denied_cards, silent, un-rejectable); pending count rides /api/status as the notification signal - sessions record the auth method (card tap vs in-app button) for audit - GET /api/permissions: grantable-permission catalog driving the UI matrix - SPA static serving with path-traversal guard; 503 hint when not built Smoke test: 54 checks incl. approve/reject round-trips over a fake charge point and method audit assertions.
2.3 KiB
type, updated, tags
| type | updated | tags | |||
|---|---|---|---|---|---|
| entity | 2026-07-11 |
|
Frontend (../frontend/)
The React control panel (built 2026-07-11, replacing the single-file vanilla-JS panel at the owner's request). Stack per the owner's spec: Vite + TypeScript + React 19, React Router 7 (routing), zustand (auth/UI state), TanStack Query 5 (server state, polling).
Dev / prod workflow
- Dev:
npm run devinfrontend/→ Vite on:5173, proxies/apito the backend on:9000(vite.config.ts), so the session cookie flows normally. - Prod:
npm run build→frontend/dist/; the backend serves it statically with an SPA fallback (exact files win, everything else getsindex.html,/api/*and/docsexcluded). No separate web server. - Fully self-contained: fonts (Archivo + IBM Plex Mono via Fontsource) are bundled into
dist/— nothing loads from a CDN, so it works over netbird without internet. ~94 kB gzipped JS.
Pages
| Route | Who | What |
|---|---|---|
/ (Control) |
all | one "bay" card per gun (labels from the chargers registry): status lamp, Start/Stop gated by scope and gun readiness; live session shows who/via/duration; relay toggles with on-demand live read |
/history |
all (filtered by scope) | the audit table: who charged, via Card or In-app, which gun, when, duration, kWh; total kWh; live sessions flagged |
/cards |
admin | pending cards awaiting review (approve → name + owner + gun restrictions in one step; reject → silenced), enrolled cards with owner/guns editing, rejected list with un-reject |
/users |
admin | user CRUD with the permission matrix — admin toggle, per-gun and per-relay checkboxes rendered from GET /api/permissions (no raw scope strings in the UI) |
An amber notification banner + nav badge appears for admins whenever unknown cards are pending (count polled via /api/status every 5 s).
Design
Instrument-panel direction grounded in the hardware: porcelain/graphite surfaces (light + dark via prefers-color-scheme), copper-busbar accent, IBM Plex Mono for telemetry/identifiers, Archivo for UI. Signature element: the indicator lamp (radial LED with glow) encoding state everywhere — green=available, pulsing green=charging, amber=preparing/pending, red=fault/denied. Reduced motion respected; keyboard focus visible.