From 75869364b0881cd2ae5165253aeb5aa6d6d92c7a Mon Sep 17 00:00:00 2001 From: Julian Cuni Date: Sat, 11 Jul 2026 20:52:20 +0200 Subject: [PATCH] feat: React control panel; pending-card review workflow; auth-method audit 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. --- CLAUDE.md | 6 +- backend/config.py | 12 +- backend/csms.py | 39 +- backend/journal.py | 29 +- backend/main.py | 40 +- backend/routes.py | 99 +- backend/static/icon.svg | 4 - backend/static/index.html | 493 ------- backend/static/manifest.json | 12 - backend/static/sw.js | 6 - backend/store.py | 16 +- frontend/.gitignore | 2 + frontend/index.html | 15 + frontend/package-lock.json | 1958 ++++++++++++++++++++++++++++ frontend/package.json | 27 + frontend/public/icon.svg | 4 + frontend/public/manifest.json | 12 + frontend/src/App.tsx | 55 + frontend/src/api.ts | 52 + frontend/src/components/Lamp.tsx | 34 + frontend/src/components/Layout.tsx | 86 ++ frontend/src/main.tsx | 29 + frontend/src/pages/Cards.tsx | 318 +++++ frontend/src/pages/Dashboard.tsx | 199 +++ frontend/src/pages/History.tsx | 85 ++ frontend/src/pages/Login.tsx | 64 + frontend/src/pages/Users.tsx | 275 ++++ frontend/src/queries.ts | 95 ++ frontend/src/store.ts | 31 + frontend/src/styles.css | 368 ++++++ frontend/src/types.ts | 89 ++ frontend/tsconfig.json | 18 + frontend/tsconfig.tsbuildinfo | 1 + frontend/vite.config.ts | 13 + wiki/concepts/authorization.md | 14 +- wiki/entities/backend.md | 20 +- wiki/entities/frontend.md | 30 + wiki/index.md | 3 +- wiki/log.md | 4 + wiki/notes/architecture-plan.md | 4 +- wiki/overview.md | 6 +- 41 files changed, 4057 insertions(+), 610 deletions(-) delete mode 100644 backend/static/icon.svg delete mode 100644 backend/static/index.html delete mode 100644 backend/static/manifest.json delete mode 100644 backend/static/sw.js create mode 100644 frontend/.gitignore create mode 100644 frontend/index.html create mode 100644 frontend/package-lock.json create mode 100644 frontend/package.json create mode 100644 frontend/public/icon.svg create mode 100644 frontend/public/manifest.json create mode 100644 frontend/src/App.tsx create mode 100644 frontend/src/api.ts create mode 100644 frontend/src/components/Lamp.tsx create mode 100644 frontend/src/components/Layout.tsx create mode 100644 frontend/src/main.tsx create mode 100644 frontend/src/pages/Cards.tsx create mode 100644 frontend/src/pages/Dashboard.tsx create mode 100644 frontend/src/pages/History.tsx create mode 100644 frontend/src/pages/Login.tsx create mode 100644 frontend/src/pages/Users.tsx create mode 100644 frontend/src/queries.ts create mode 100644 frontend/src/store.ts create mode 100644 frontend/src/styles.css create mode 100644 frontend/src/types.ts create mode 100644 frontend/tsconfig.json create mode 100644 frontend/tsconfig.tsbuildinfo create mode 100644 frontend/vite.config.ts create mode 100644 wiki/entities/frontend.md diff --git a/CLAUDE.md b/CLAUDE.md index cc285bc..d5f9fb8 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,6 +1,8 @@ # Charging Station Project -Two parts: +Four parts: +- **`backend/`** — the production FastAPI backend: private OCPP 1.6J CSMS + REST API + Tuya relay control on port 9000. All state in `backend/backend.db` (SQLite, gitignored). Run from the repo root: `venv\Scripts\python -m backend.main`. Documented at `wiki/entities/backend.md`. +- **`frontend/`** — the React control panel (Vite + TypeScript + React Router + zustand + TanStack Query). Dev: `npm run dev` (proxies `/api` to :9000). Prod: `npm run build` → `frontend/dist/`, served statically by the backend. Documented at `wiki/entities/frontend.md`. - **`wiki/`** — an LLM-maintained knowledge base about the Anfu home charger OCPP integration. **Read `wiki/CLAUDE.md` before touching anything in it** — it defines the schema, conventions, and ingest/query/lint workflows. `wiki/raw/` is immutable source material; never edit it. -- **`discovering/`** — throwaway-ish Python scripts to test the charging station connection and watch WebSocket payloads in realtime (`csms.py`, `rawlisten.py`, `station.py`). Documented in the wiki at `wiki/entities/csms-toolkit.md`. +- **`discovering/`** — throwaway-ish Python scripts used during discovery (`csms.py`, `rawlisten.py`, `station.py`). Superseded by `backend/` for production; kept as diagnostics. Documented at `wiki/entities/csms-toolkit.md`. diff --git a/backend/config.py b/backend/config.py index ce04024..e672251 100644 --- a/backend/config.py +++ b/backend/config.py @@ -7,13 +7,19 @@ semantics. A legacy config.json (pre-2026-07-11 layout) is imported into the database once on startup and renamed to config.json.migrated. Sections: - learn_mode accept-and-record unknown idTags vs enforce the allowlist users name -> {"password": pbkdf2 hash, "scopes": [...], "id_tag"} authorized idTag -> {"name", "kind": "card|app|car", optional "user": owner, "guns": ["eu092025:2"]} + pending_cards unknown idTags tapped on a charger, awaiting the admin's + approve (-> authorized, linked to a user) or reject decision; + idTag -> {"first_seen", "last_seen", "count", "cp", "connector"} + denied_cards rejected idTags; silently refused, never re-pend relays name -> {"id", "key", "ip", "version", "switch", "label"} chargers cp_id -> {"label", "guns": {"1": "display name"}} (UI only) session_secret signs login sessions; auto-generated once + +There is no learn mode anymore: an unknown card is ALWAYS refused, but lands +in pending_cards for the admin to approve or reject from the panel. """ import json @@ -29,9 +35,10 @@ LEGACY_CONFIG = HERE / "config.json" log = logging.getLogger("config") DEFAULTS = { - "learn_mode": True, "users": {}, "authorized": {}, + "pending_cards": {}, + "denied_cards": {}, "relays": {}, "chargers": {}, } @@ -46,6 +53,7 @@ def _load() -> dict: "config.json.migrated)", store.DB_PATH.name) for key, default in DEFAULTS.items(): cfg.setdefault(key, default if not isinstance(default, dict) else dict(default)) + cfg.pop("learn_mode", None) # superseded by the pending-cards workflow if not cfg.get("session_secret"): cfg["session_secret"] = secrets.token_hex(32) return cfg diff --git a/backend/csms.py b/backend/csms.py index 5705152..b0779de 100644 --- a/backend/csms.py +++ b/backend/csms.py @@ -27,8 +27,8 @@ from ocpp.v16.enums import ( ) from . import store -from .config import CONFIG, HERE -from .journal import now, record_event, record_seen +from .config import CONFIG, HERE, save +from .journal import now, record_event log = logging.getLogger("csms") @@ -47,6 +47,16 @@ TRIGGERABLE = { } +def _record_pending(id_tag: str, cp: Optional[str], connector: Optional[int]) -> None: + """An unknown card was tapped: queue it for the admin to approve or reject.""" + entry = CONFIG["pending_cards"].get( + id_tag, {"first_seen": now(), "count": 0} + ) + entry.update(last_seen=now(), count=entry["count"] + 1, cp=cp, connector=connector) + CONFIG["pending_cards"][id_tag] = entry + save() + + def decide(id_tag: str, context: str, connector: Optional[int] = None, cp: Optional[str] = None) -> AuthorizationStatus: """The one gate every auth method flows through: is this idTag allowed? @@ -57,6 +67,9 @@ def decide(id_tag: str, context: str, connector: Optional[int] = None, fires there; a plain Authorize (card tap) still accepts a known card — which matches this charger, since AuthorizeRemoteTxRequests=false means StartTransaction is the decisive call anyway. + + Unknown idTags are always refused: silently if the admin already rejected + the card, otherwise they land in pending_cards for the admin to decide. """ entry = CONFIG["authorized"].get(id_tag) known = entry is not None @@ -70,13 +83,13 @@ def decide(id_tag: str, context: str, connector: Optional[int] = None, name = entry.get("name", "?") log.info("[OK] AUTHORIZED idTag=%r (%s) via %s", id_tag, name, context) status = AuthorizationStatus.accepted - elif CONFIG.get("learn_mode"): - log.warning("[LEARN] NEW idTag=%r via %s -> accepting & recording.", id_tag, context) - record_seen(id_tag, context) - status = AuthorizationStatus.accepted + elif id_tag in CONFIG["denied_cards"]: + log.warning("[NO] DENIED idTag=%r (admin-rejected card) via %s", id_tag, context) + status = AuthorizationStatus.invalid else: - log.warning("[NO] REJECTED unknown idTag=%r via %s", id_tag, context) - record_seen(id_tag, context) + log.warning("[??] UNKNOWN idTag=%r via %s -> refused, queued for admin approval", + id_tag, context) + _record_pending(id_tag, cp, connector) status = AuthorizationStatus.invalid AUTH_EVENTS.append( {"time": now(), "id_tag": id_tag, "context": context, @@ -126,7 +139,7 @@ class ChargePoint(OcppChargePoint): @on(Action.authorize) async def on_authorize(self, id_tag, **kwargs): - status = decide(id_tag, "Authorize (card/app)") + status = decide(id_tag, "Authorize (card/app)", cp=self.id) record_event("Authorize", self.id, id_tag=id_tag, result=status.value) return call_result.Authorize(id_tag_info={"status": status}) @@ -138,12 +151,16 @@ class ChargePoint(OcppChargePoint): _tx_counter["n"] += 1 tx = _tx_counter["n"] who = resolve_who(id_tag) + # audit: HOW was this session authorized? kind of the allowlist + # entry -> "card" (physical tap) or "app" (in-app button press) + method = CONFIG["authorized"].get(id_tag, {}).get("kind", "unknown") ACTIVE_TX[tx] = { "cp": self.id, "connector": connector_id, "id_tag": id_tag, - "who": who, "meter_start": meter_start, "started": now(), + "who": who, "method": method, + "meter_start": meter_start, "started": now(), } store.start_session(tx, self.id, connector_id, id_tag, who, - timestamp, meter_start) + timestamp, meter_start, method=method) log.info("Transaction %s STARTED on connector %s by %s (meter_start=%s)", tx, connector_id, who, meter_start) else: diff --git a/backend/journal.py b/backend/journal.py index 4abe8b0..f488ef5 100644 --- a/backend/journal.py +++ b/backend/journal.py @@ -1,8 +1,6 @@ -"""Durable journals: events.jsonl (everything the charger tells us) and -seen_tags.json (unknown idTags captured in learn mode). - -JSONL now, SQLite later — the append-only line format survives crashes and is -trivially greppable/ingestable, which is all the current phase needs. +"""Durable journal: events.jsonl — everything the charger tells us (and what +we told it), one JSON line per event. Append-only, crash-safe, greppable; the +raw ground truth behind the queryable store (store.py). """ import json @@ -13,7 +11,6 @@ from typing import Optional HERE = Path(__file__).resolve().parent EVENTS_PATH = HERE / "events.jsonl" -SEEN_PATH = HERE / "seen_tags.json" log = logging.getLogger("journal") @@ -39,23 +36,3 @@ def read_events(limit: int = 100, event: Optional[str] = None) -> list: if event is not None: entries = [e for e in entries if e.get("event") == event] return entries[-limit:] - - -def record_seen(id_tag: str, context: str) -> None: - try: - seen = json.loads(SEEN_PATH.read_text(encoding="utf-8")) if SEEN_PATH.exists() else {} - except Exception: - seen = {} - entry = seen.get(id_tag, {"count": 0, "first_seen": now(), "contexts": []}) - entry["count"] += 1 - entry["last_seen"] = now() - if context not in entry["contexts"]: - entry["contexts"].append(context) - seen[id_tag] = entry - SEEN_PATH.write_text(json.dumps(seen, indent=2), encoding="utf-8") - - -def read_seen() -> dict: - if not SEEN_PATH.exists(): - return {} - return json.loads(SEEN_PATH.read_text(encoding="utf-8")) diff --git a/backend/main.py b/backend/main.py index 96fa6a8..d6f743d 100644 --- a/backend/main.py +++ b/backend/main.py @@ -17,13 +17,13 @@ from pathlib import Path import uvicorn from fastapi import FastAPI, WebSocket -from fastapi.responses import FileResponse -from fastapi.staticfiles import StaticFiles +from fastapi.responses import FileResponse, JSONResponse from . import csms, routes from .config import CONFIG -STATIC = Path(__file__).resolve().parent / "static" +# the built React app (frontend/: `npm run build` -> dist/) +DIST = Path(__file__).resolve().parent.parent / "frontend" / "dist" logging.basicConfig( level=logging.INFO, @@ -37,18 +37,23 @@ app = FastAPI( "ws://:9000/; everything else lives under /api/*.", ) app.include_router(routes.router) -app.mount("/static", StaticFiles(directory=STATIC), name="static") -@app.get("/") -async def index_page(): - return FileResponse(STATIC / "index.html") - - -# the service worker must be served from / so its scope covers the whole app -@app.get("/sw.js") -async def service_worker(): - return FileResponse(STATIC / "sw.js", media_type="application/javascript") +# SPA serving: exact files from frontend/dist, anything else falls back to +# index.html so React Router owns the URL space. Registered after the API +# router, so /api/* and /docs keep winning. +@app.get("/{full_path:path}", include_in_schema=False) +async def spa(full_path: str): + if not DIST.exists(): + return JSONResponse( + {"detail": "frontend not built — run `npm run build` in frontend/ " + "(or use the Vite dev server, which proxies /api here)"}, + status_code=503, + ) + candidate = (DIST / full_path).resolve() if full_path else None + if candidate and candidate.is_file() and candidate.is_relative_to(DIST.resolve()): + return FileResponse(candidate) + return FileResponse(DIST / "index.html") # Catch-all WS route so the charger may dial any path (it uses /). @@ -59,11 +64,12 @@ async def ocpp_websocket(ws: WebSocket, cp_path: str): async def main(): - mode = "LEARN (accepting & recording new ids)" if CONFIG["learn_mode"] else "ENFORCING allowlist" log.info( - "CSMS ws://0.0.0.0:9000/ | API http://0.0.0.0:9000/docs | mode: %s | " - "%d authorized id(s) | %d user(s) | %d relay(s) configured", - mode, len(CONFIG["authorized"]), len(CONFIG["users"]), len(CONFIG["relays"]), + "CSMS ws://0.0.0.0:9000/ | API http://0.0.0.0:9000/docs | " + "%d authorized id(s) | %d pending card(s) | %d user(s) | %d relay(s) | panel %s", + len(CONFIG["authorized"]), len(CONFIG["pending_cards"]), + len(CONFIG["users"]), len(CONFIG["relays"]), + "ready" if DIST.exists() else "NOT BUILT (frontend/: npm run build)", ) if not CONFIG["users"]: log.warning( diff --git a/backend/routes.py b/backend/routes.py index ac72867..f1ba68e 100644 --- a/backend/routes.py +++ b/backend/routes.py @@ -17,7 +17,7 @@ from pydantic import BaseModel from . import csms, relays, store, users from .config import CONFIG, save -from .journal import read_events, read_seen +from .journal import now, read_events from ocpp.v16 import call log = logging.getLogger("api") @@ -110,16 +110,18 @@ async def me(user: dict = Depends(current_user)): # ---- status & journals ---- @router.get("/status") async def api_status(user: dict = Depends(current_user)): + is_admin = users.allowed(user["scopes"], "admin") return { - "mode": "learn" if CONFIG.get("learn_mode") else "enforce", "connected": { cp_id: getattr(cp, "boot_info", None) for cp_id, cp in csms.CONNECTED.items() }, "connectors": {f"{cp_id}/{conn}": s for (cp_id, conn), s in csms.CONNECTORS.items()}, "active_transactions": csms.ACTIVE_TX, - "recent_auth_events": list(csms.AUTH_EVENTS), + "recent_auth_events": list(csms.AUTH_EVENTS) if is_admin else [], "relays": _visible_relays(user), "chargers": CONFIG["chargers"], # display labels for the panel + # the admin's notification bell: unknown cards awaiting a decision + "pending_cards": len(CONFIG["pending_cards"]) if is_admin else 0, } @@ -238,11 +240,7 @@ class AllowlistEntry(BaseModel): @router.get("/allowlist") async def allowlist_get(user: dict = Depends(current_user)): need(user, "admin") - return { - "learn_mode": CONFIG["learn_mode"], - "authorized": CONFIG["authorized"], - "seen": read_seen(), - } + return {"authorized": CONFIG["authorized"]} @router.put("/allowlist/{id_tag}") @@ -267,14 +265,87 @@ async def allowlist_delete(id_tag: str, user: dict = Depends(current_user)): return {"authorized": CONFIG["authorized"]} -@router.post("/mode") -async def set_mode(learn: bool, user: dict = Depends(current_user)): - """Flip learn mode at runtime — no restart needed; decide() reads CONFIG live.""" +# ---- pending cards: unknown taps awaiting the admin's decision ---- +class ApproveBody(BaseModel): + name: str + user: Optional[str] = None # link the card to its owner right here + guns: Optional[list[str]] = None + kind: str = "card" + + +@router.get("/cards/pending") +async def pending_list(user: dict = Depends(current_user)): need(user, "admin") - CONFIG["learn_mode"] = learn + return CONFIG["pending_cards"] + + +@router.post("/cards/pending/{id_tag}/approve") +async def pending_approve(id_tag: str, body: ApproveBody, + user: dict = Depends(current_user)): + need(user, "admin") + if id_tag not in CONFIG["pending_cards"]: + raise HTTPException(404, f"{id_tag!r} is not pending") + if body.user is not None and body.user not in CONFIG["users"]: + raise HTTPException(400, f"cannot link card to unknown user {body.user!r}") + CONFIG["pending_cards"].pop(id_tag) + CONFIG["authorized"][id_tag] = body.model_dump(exclude_none=True) save() - log.warning("mode changed: %s", "LEARN" if learn else "ENFORCE") - return {"mode": "learn" if learn else "enforce"} + log.info("pending card %r APPROVED by %r as %r (user=%s)", + id_tag, user["name"], body.name, body.user) + return {"approved": id_tag, "authorized": CONFIG["authorized"]} + + +@router.post("/cards/pending/{id_tag}/reject") +async def pending_reject(id_tag: str, user: dict = Depends(current_user)): + need(user, "admin") + meta = CONFIG["pending_cards"].pop(id_tag, None) + if meta is None: + raise HTTPException(404, f"{id_tag!r} is not pending") + CONFIG["denied_cards"][id_tag] = { + "rejected_at": now(), "by": user["name"], + **{k: meta[k] for k in ("first_seen", "count") if k in meta}, + } + save() + log.warning("pending card %r REJECTED by %r", id_tag, user["name"]) + return {"rejected": id_tag} + + +@router.get("/cards/denied") +async def denied_list(user: dict = Depends(current_user)): + need(user, "admin") + return CONFIG["denied_cards"] + + +@router.delete("/cards/denied/{id_tag}") +async def denied_delete(id_tag: str, user: dict = Depends(current_user)): + """Un-reject: the card pends again on its next tap.""" + need(user, "admin") + if CONFIG["denied_cards"].pop(id_tag, None) is None: + raise HTTPException(404, f"{id_tag!r} is not denied") + save() + return {"undenied": id_tag} + + +# ---- permission catalog: what CAN be granted (drives the UI matrix) ---- +@router.get("/permissions") +async def permissions_catalog(user: dict = Depends(current_user)): + """Everything a scope could refer to, so the panel renders checkboxes + instead of asking admins to type raw scope strings.""" + need(user, "admin") + chargers = {} + for cp_id, meta in CONFIG["chargers"].items(): + chargers[cp_id] = {"label": meta.get("label", cp_id), + "guns": dict(meta.get("guns", {}))} + # chargers that connected but were never given display labels + for (cp_id, conn) in csms.CONNECTORS: + if conn > 0: + entry = chargers.setdefault(cp_id, {"label": cp_id, "guns": {}}) + entry["guns"].setdefault(str(conn), f"Gun {conn}") + return { + "chargers": chargers, # scope per gun: charger:: + "relays": relays.configured(), # scope per relay: relay: + "admin_scope": "admin", + } # ---- user management (admin) ---- diff --git a/backend/static/icon.svg b/backend/static/icon.svg deleted file mode 100644 index f5b044c..0000000 --- a/backend/static/icon.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/backend/static/index.html b/backend/static/index.html deleted file mode 100644 index aa43828..0000000 --- a/backend/static/index.html +++ /dev/null @@ -1,493 +0,0 @@ - - - - - - -Home Energy - - - - - - - - - - -
- - - - diff --git a/backend/static/manifest.json b/backend/static/manifest.json deleted file mode 100644 index 7783726..0000000 --- a/backend/static/manifest.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "Home Energy", - "short_name": "Energy", - "description": "Home EV charger and relay control", - "start_url": "/", - "display": "standalone", - "background_color": "#0f172a", - "theme_color": "#0f172a", - "icons": [ - { "src": "/static/icon.svg", "sizes": "any", "type": "image/svg+xml", "purpose": "any" } - ] -} diff --git a/backend/static/sw.js b/backend/static/sw.js deleted file mode 100644 index 517ea7b..0000000 --- a/backend/static/sw.js +++ /dev/null @@ -1,6 +0,0 @@ -// Minimal service worker: required for "add to home screen" installability. -// No caching — the panel is only reachable over NetBird/LAN anyway, and a -// stale cached UI causes more confusion than a brief offline error. -self.addEventListener("install", () => self.skipWaiting()); -self.addEventListener("activate", (e) => e.waitUntil(self.clients.claim())); -self.addEventListener("fetch", () => {}); diff --git a/backend/store.py b/backend/store.py index ec77bcc..517a110 100644 --- a/backend/store.py +++ b/backend/store.py @@ -43,7 +43,8 @@ CREATE TABLE IF NOT EXISTS sessions ( meter_start REAL NOT NULL, meter_stop REAL, wh REAL, - reason TEXT + reason TEXT, + method TEXT ); CREATE TABLE IF NOT EXISTS samples ( tx INTEGER NOT NULL, @@ -63,6 +64,10 @@ def _db(): con = sqlite3.connect(DB_PATH) con.row_factory = sqlite3.Row con.executescript(_SCHEMA) + # migration for dbs created before the audit column existed + cols = [row[1] for row in con.execute("PRAGMA table_info(sessions)")] + if "method" not in cols: + con.execute("ALTER TABLE sessions ADD COLUMN method TEXT") return closing(con) @@ -89,12 +94,13 @@ def max_tx() -> int: def start_session(tx: int, cp: str, connector: int, id_tag: str, who: str, - started: str, meter_start: float) -> None: + started: str, meter_start: float, method: str = "unknown") -> None: with _db() as con, con: con.execute( - "INSERT OR REPLACE INTO sessions (tx, cp, connector, id_tag, who, started, meter_start)" - " VALUES (?, ?, ?, ?, ?, ?, ?)", - (tx, cp, connector, id_tag, who, started, meter_start), + "INSERT OR REPLACE INTO sessions" + " (tx, cp, connector, id_tag, who, started, meter_start, method)" + " VALUES (?, ?, ?, ?, ?, ?, ?, ?)", + (tx, cp, connector, id_tag, who, started, meter_start, method), ) diff --git a/frontend/.gitignore b/frontend/.gitignore new file mode 100644 index 0000000..b947077 --- /dev/null +++ b/frontend/.gitignore @@ -0,0 +1,2 @@ +node_modules/ +dist/ diff --git a/frontend/index.html b/frontend/index.html new file mode 100644 index 0000000..43d23ca --- /dev/null +++ b/frontend/index.html @@ -0,0 +1,15 @@ + + + + + + + + + Charge Control + + +
+ + + diff --git a/frontend/package-lock.json b/frontend/package-lock.json new file mode 100644 index 0000000..5b9e91c --- /dev/null +++ b/frontend/package-lock.json @@ -0,0 +1,1958 @@ +{ + "name": "charging-station-panel", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "charging-station-panel", + "version": "1.0.0", + "dependencies": { + "@fontsource/archivo": "^5.1.0", + "@fontsource/ibm-plex-mono": "^5.1.0", + "@tanstack/react-query": "^5.62.0", + "react": "^19.0.0", + "react-dom": "^19.0.0", + "react-router-dom": "^7.1.0", + "zustand": "^5.0.2" + }, + "devDependencies": { + "@types/react": "^19.0.0", + "@types/react-dom": "^19.0.0", + "@vitejs/plugin-react": "^4.3.4", + "typescript": "^5.7.2", + "vite": "^6.0.5" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz", + "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.29.7", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.7.tgz", + "integrity": "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.7.tgz", + "integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.7", + "@babel/helper-compilation-targets": "^7.29.7", + "@babel/helper-module-transforms": "^7.29.7", + "@babel/helpers": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/template": "^7.29.7", + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7", + "@jridgewell/remapping": "^2.3.5", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.7.tgz", + "integrity": "sha512-DkXD5OJQaAQIdZ1bt3UZdEnHAn9Imd3IVBdX03UFe+ony9Ojw5pzr9YVKGDY1jt+Gcn/FnGkNf8r+Vj5NOJWtQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.29.7", + "@babel/types": "^7.29.7", + "@jridgewell/gen-mapping": "^0.3.12", + "@jridgewell/trace-mapping": "^0.3.28", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.7.tgz", + "integrity": "sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.29.7", + "@babel/helper-validator-option": "^7.29.7", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-globals": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.29.7.tgz", + "integrity": "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz", + "integrity": "sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.29.7.tgz", + "integrity": "sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7", + "@babel/traverse": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.29.7.tgz", + "integrity": "sha512-G7sHYigPY17oO5SYWnfD/0MTBwVR781S/JI643e/JhUYgVgWE/61SoW3NH9KWUKyKq5LVh3npif99Wkt6j86Jw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz", + "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz", + "integrity": "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.7.tgz", + "integrity": "sha512-1k2lAGRMfHTcwuNYcCNUmaUffmQv8KWMfh2iJUUeRlwlwH4FdNG7mfPI10NPfLHJFThE4Tyr4mv7kTNZOiPuBg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.7.tgz", + "integrity": "sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.29.7" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-self": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.29.7.tgz", + "integrity": "sha512-TL0hMc9xzy86VD31nUiwzd5otRAcyEPcsegCxolO0PvcXuH1v0kECe/UIznYFihpkvU5wg/jk4v0TTEFfm53fw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-source": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.29.7.tgz", + "integrity": "sha512-06IyK09H3wi4cGbhDBwp5gUGo0IKtnYa8tyTiephirPCK6fbobVGiXMMI5zLQ4aKEYP3wZ3ArU44o+8KMrSG/Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/template": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.29.7.tgz", + "integrity": "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.7.tgz", + "integrity": "sha512-EhlfNQtZ+NK22w5BM61ciuiq1m58ed33Wr1Xan//ZRTy6hgjnwyCffRYwzsGXdASJSUJ1guZILsErh1eQcl+zw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.7", + "@babel/helper-globals": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.7", + "debug": "^4.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.7.tgz", + "integrity": "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", + "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz", + "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz", + "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz", + "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz", + "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz", + "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz", + "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz", + "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz", + "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz", + "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz", + "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz", + "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz", + "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz", + "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz", + "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz", + "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz", + "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz", + "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz", + "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz", + "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz", + "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz", + "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz", + "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz", + "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz", + "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz", + "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@fontsource/archivo": { + "version": "5.2.8", + "resolved": "https://registry.npmjs.org/@fontsource/archivo/-/archivo-5.2.8.tgz", + "integrity": "sha512-Fc4yuMt85MmcYooUVpYHAJRJTymPv2+J9HsMP2f5mxR/0pIWgE2V5XfgNTavPpklX2rJFprdT36iE6Rr8ds9MA==", + "license": "OFL-1.1", + "funding": { + "url": "https://github.com/sponsors/ayuhito" + } + }, + "node_modules/@fontsource/ibm-plex-mono": { + "version": "5.2.7", + "resolved": "https://registry.npmjs.org/@fontsource/ibm-plex-mono/-/ibm-plex-mono-5.2.7.tgz", + "integrity": "sha512-MKAb8qV+CaiMQn2B0dIi1OV3565NYzp3WN5b4oT6LTkk+F0jR6j0ZN+5BKJiIhffDC3rtBULsYZE65+0018z9w==", + "license": "OFL-1.1", + "funding": { + "url": "https://github.com/sponsors/ayuhito" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", + "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.0-beta.27", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz", + "integrity": "sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.62.2.tgz", + "integrity": "sha512-6o7ZLZK+BeenkZCFNDXqpbjw9bD6nuWonvS/lwQJp7NoVVxm6p3qE7qQ5jGuBjiFsgvqjD8mZAU5oWxTmbOeOg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.62.2.tgz", + "integrity": "sha512-BaH7BllCACHoH1LguOU56UItGfUWjujlO65kS9LAodViaN4bwIKd7oeW/ZHJ/4ljr/7MIiENnNy3HJ0zXv8Zkw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.62.2.tgz", + "integrity": "sha512-v39RCCvj4He82I9sFmk+M1VZ0PLM9sfsLVikjfx2hYBNALhrrOR2D3JjQA6AhlaSOgcR+RzrKY7e1+bT6SUO/A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.62.2.tgz", + "integrity": "sha512-yl0y2vq3S3lHeuXhEdss6TWfKW8vkujImO12tn4ZkG/4oghr09LvdYm2RElVjokTQiUvDUGXLGsYeLqUMCKpGA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.62.2.tgz", + "integrity": "sha512-tT4pvt4qXD+vEoezupCWi+a1F0vvDiksiHc+PxRlYTOH1I6/X4id9jPxTP+Fg+545euaFT1jJVs4CEdHZAU1vw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.62.2.tgz", + "integrity": "sha512-6nU5F2wCW+qvCBhTn1pdIU3bzsIoF7EUwsCDRxilWGprQR6yd508YnH9+OKFCwpfS8pjZqDUmnCAr7exax0XCg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.62.2.tgz", + "integrity": "sha512-n1GJHPOvpIfhi3TmrCeh6S6URt9BFCt0KQE3qvexyGCTAKpR4Lg+eWvNZEqu7epxwus/8ElT3hacYEucm49SZg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.62.2.tgz", + "integrity": "sha512-JqgflS8wEB+UXV/vS1RpRbifGBeN4D5lz8D8oOFbFZw4vedvdOgCFAjfBmIMdW3yL10XpQQ0Ambepw6MXrhOnA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.62.2.tgz", + "integrity": "sha512-wnFJkogWvN4jm/hQRF2UBaeUmk20j5+DmHvoyWii2b8HJDyvz1MF2OU/6ynXt2KR63rbZLWkFpoytpdc/yBuSA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.62.2.tgz", + "integrity": "sha512-HVu2bp0zhvJ8xHEV9+UUs7S90VadmBSY3LcIMvozbPo4AuMGDWlz3ymHLHZPX4hR67TKTt8Qp5PJ5RBg/i+RMQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.62.2.tgz", + "integrity": "sha512-mQqqAV8QaoSgr9I2fKDLY2BAVvmKjWoGiu/cSYQonsLvtqwEn1E4QYfnCOcp5zoEqNhsDYin1s6jx/VJmrxlZg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.62.2.tgz", + "integrity": "sha512-IxKLoxCQ2IWi6bT2akyDUBGsOImDKB+sPp4EsTmwFQ/fMwpCKm8uLSSgP/Kx/QYUgKis6SEZ5/Nlhup0DIA0PQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.62.2.tgz", + "integrity": "sha512-Mk5ha2RQSgyFfmYYLkBpPnUk8D8FriBxesO1u9O75X0mHgXL1UQcH5Itl2lurWL2tj0RxV9b9tJgipac0hRY9A==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.62.2.tgz", + "integrity": "sha512-CjvEnqJL/0/TQ3TXX3OPIJ/kmBellrWd4heXUmHeJlTnmwjKpSJzoehLaL6Xk0ZnMHBu9dZuFADNOrtjF4v+2w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.62.2.tgz", + "integrity": "sha512-1SiZbzwdkaDURsew/tSOrooKiYy7EQGT6m8ufavAi9NEyQb/6VuIxFXAL1fqa4iZe3g4NbNk4P7J32z2tw5Mgg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.62.2.tgz", + "integrity": "sha512-nQts12zJ3NQRoE6uYljOH89v7szzLDvG2JD/vsX+vGXU8w/At1GowTZ5/7qeFQ8m7L55rpR8Okugnuo5bgjy2Q==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.62.2.tgz", + "integrity": "sha512-E9/ll019jhPIJgpzfZoIkBGhcz+kKNgVWYRY0zr9srBdPPFVpvOKW8VaJKUbeK+eZXyQF9ltME+Kk6affeaPgg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.62.2.tgz", + "integrity": "sha512-5BqxR/pshjey51iliyzTD5Xi3EN0aLmQ2lZ3lvefVV9c82BvrLo2/6OT55iifpWBufs6kdwWbuOKS841DrmK9A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.62.2.tgz", + "integrity": "sha512-uNN83XxQrRAh/w0/pmAfibcwyb6YWt4gP+dpnQKPVJshAloQ785ii8CT8ZCIxkGg9opVsvAlGhFitSm6D1Jjpg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.62.2.tgz", + "integrity": "sha512-srjEIxSH3LRnJN6THczDHWQplqEMFiAJrTab0msUryh9kwNpkICf3Ea6q6MN/2cZwRFUNx5w+h6Hpi4QuHS6Zg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.62.2.tgz", + "integrity": "sha512-8hOJnxgbyObnCm5AlRA3A931xX19xq80RjVTKgJOvEKWqJruP/Uf12IbAOaDjjEXYRewwHLfmF0YRIdK3OwKWA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.62.2.tgz", + "integrity": "sha512-mmF4AY1i0hG/bLWUctUq59gtmgaSIRa3cu/A3JFRp/sCNEme2bgDEiDS22P9FbnJB8NJNF4jPJiSP5RHQpUTDg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.62.2.tgz", + "integrity": "sha512-DZgkknc6jhHrk46V25vbAM0zZkyP0nSDkJB8/dRkLTxv470dOmWDqGoEJl/9A0dFfS7yE3REOwNDxpHwSLSt0Q==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.62.2.tgz", + "integrity": "sha512-T6xr6ucWSFto+VGajA8YH26LdpHRuP4YLHEKAtCWvJDOlnmWcDZVCI2Jmjr+IFHDlt2zRaTAKE4tfjTaWLgJBg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.62.2.tgz", + "integrity": "sha512-BfzEnDJOt9T8M989/lA37EcJgat01wLRnoi5dQf3QzOH7jzpqTAzdDbVfRljVr5r+jzKqpbHeyOfAaXxAd0PAA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@tanstack/query-core": { + "version": "5.101.2", + "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.101.2.tgz", + "integrity": "sha512-hH5MLoJhF7KaIGd7q3xTXGXvslI+GYlM1Z/35aSHHWaCJWB7XvTSHYuV3eM7tw+aE0mT/xMro4M4Q9rCGHT0lw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@tanstack/react-query": { + "version": "5.101.2", + "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.101.2.tgz", + "integrity": "sha512-seDkr6kzGzX1okaaTtZPtgA688CDPlXUz1C6xSg0ESqn04Vuc8tlrYms1s3de+znBqhPVxFRfpAfUf+6XvfPWg==", + "license": "MIT", + "dependencies": { + "@tanstack/query-core": "5.101.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "react": "^18 || ^19" + } + }, + "node_modules/@types/babel__core": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz", + "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz", + "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.28.2" + } + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/react": { + "version": "19.2.17", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.17.tgz", + "integrity": "sha512-MXfmqaVPEVgkBT/aY0aGCkRWWtByiYQXo3xdQ8r5RzuFrPiRn8Gar2tQdXSUQ2GKV3bkXckek89V8wQBY2Q/Aw==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "csstype": "^3.2.2" + } + }, + "node_modules/@types/react-dom": { + "version": "19.2.3", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.3.tgz", + "integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@types/react": "^19.2.0" + } + }, + "node_modules/@vitejs/plugin-react": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.7.0.tgz", + "integrity": "sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.28.0", + "@babel/plugin-transform-react-jsx-self": "^7.27.1", + "@babel/plugin-transform-react-jsx-source": "^7.27.1", + "@rolldown/pluginutils": "1.0.0-beta.27", + "@types/babel__core": "^7.20.5", + "react-refresh": "^0.17.0" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "peerDependencies": { + "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" + } + }, + "node_modules/baseline-browser-mapping": { + "version": "2.10.43", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.43.tgz", + "integrity": "sha512-AjYpR78kDWAY3Efj+cDTFH9t9SCoL7OoTp1BOb0mQV7S+6CiLwnWM3FyxhJtdPufDFKzmCSFoUncKjWgJEZTCQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "baseline-browser-mapping": "dist/cli.cjs" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/browserslist": { + "version": "4.28.6", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.6.tgz", + "integrity": "sha512-FQBYNK15VMslhLHpA7+n+n1GOlF1kId2xcCg7/j95f24AOF6VDYMNH4mFxF7KuaTdv627faazpOAjFzMrfJOUw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "baseline-browser-mapping": "^2.10.42", + "caniuse-lite": "^1.0.30001803", + "electron-to-chromium": "^1.5.389", + "node-releases": "^2.0.51", + "update-browserslist-db": "^1.2.3" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001805", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001805.tgz", + "integrity": "sha512-52noaS3DubycKSXaU30TwPGIp+POyQSUVa5jBEq3vkRkY0kjyb3LQgvhU6WGyCcyXqVLWO0Cw0Q6BSdD0kUfVA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, + "node_modules/cookie": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.1.1.tgz", + "integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "devOptional": true, + "license": "MIT" + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/electron-to-chromium": { + "version": "1.5.389", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.389.tgz", + "integrity": "sha512-cEto7aeOqBfU1D+c5py5pE+ooscKE75JifxLBdFUZsqAxRS6y7kebtxAZvICszSl05gPjYHDTjY+lXpyGvpJbg==", + "dev": true, + "license": "ISC" + }, + "node_modules/esbuild": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", + "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.12", + "@esbuild/android-arm": "0.25.12", + "@esbuild/android-arm64": "0.25.12", + "@esbuild/android-x64": "0.25.12", + "@esbuild/darwin-arm64": "0.25.12", + "@esbuild/darwin-x64": "0.25.12", + "@esbuild/freebsd-arm64": "0.25.12", + "@esbuild/freebsd-x64": "0.25.12", + "@esbuild/linux-arm": "0.25.12", + "@esbuild/linux-arm64": "0.25.12", + "@esbuild/linux-ia32": "0.25.12", + "@esbuild/linux-loong64": "0.25.12", + "@esbuild/linux-mips64el": "0.25.12", + "@esbuild/linux-ppc64": "0.25.12", + "@esbuild/linux-riscv64": "0.25.12", + "@esbuild/linux-s390x": "0.25.12", + "@esbuild/linux-x64": "0.25.12", + "@esbuild/netbsd-arm64": "0.25.12", + "@esbuild/netbsd-x64": "0.25.12", + "@esbuild/openbsd-arm64": "0.25.12", + "@esbuild/openbsd-x64": "0.25.12", + "@esbuild/openharmony-arm64": "0.25.12", + "@esbuild/sunos-x64": "0.25.12", + "@esbuild/win32-arm64": "0.25.12", + "@esbuild/win32-ia32": "0.25.12", + "@esbuild/win32-x64": "0.25.12" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.15", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.15.tgz", + "integrity": "sha512-y7Wygv/7mEOvxTuEQDB8StXdMRBWf1kR/tlhAzBRUFkB2jfcLOAxO/SHmOO2zgz1pVgK29/kyupn059/bCHdjA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/node-releases": { + "version": "2.0.51", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.51.tgz", + "integrity": "sha512-wRNIrw4DmVLKQlbgOMdkMx27Wrpzes2hh5Jtbi2bjPd+4wJstWIqP5A+lscnqbm0xxmT5Bpg8Lec5ItEBwx6BQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz", + "integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.16", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.16.tgz", + "integrity": "sha512-vuwillviilfKZsg0VGj5R/YwwcHx4SLsIOI/7K6mQkWx+l5cUHTjj5g0AasTBcyXsbfTgrwsUNmVUb5xVwyPwg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.12", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/react": { + "version": "19.2.7", + "resolved": "https://registry.npmjs.org/react/-/react-19.2.7.tgz", + "integrity": "sha512-HNe9WslTbXmFK8o8cmwgAeJFSBvt1bPdHCVKtaaV+WlAN36mpT4hcRpwbf3fY56ar2oIXzsBpOAiIRHAdY0OlQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "19.2.7", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.7.tgz", + "integrity": "sha512-t0BRVXvbiE/o20Hfw669rLbMCDWtYZLvmJigy2f0MxsXF+71pxhR3xOkspmsO8h3ZlNzyibAmtCa3l4lYKk6gQ==", + "license": "MIT", + "dependencies": { + "scheduler": "^0.27.0" + }, + "peerDependencies": { + "react": "^19.2.7" + } + }, + "node_modules/react-refresh": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz", + "integrity": "sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-router": { + "version": "7.18.1", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.18.1.tgz", + "integrity": "sha512-GDLgg3i3uM0aeJO3Fm+TCS+sDQ7gu12T6x0qdTEzcwqEfleci7JwugVNIF3U//0FWKnJT7ptG+20B2jfDqnZAg==", + "license": "MIT", + "dependencies": { + "cookie": "^1.0.1", + "set-cookie-parser": "^2.6.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "react": ">=18", + "react-dom": ">=18" + }, + "peerDependenciesMeta": { + "react-dom": { + "optional": true + } + } + }, + "node_modules/react-router-dom": { + "version": "7.18.1", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.18.1.tgz", + "integrity": "sha512-KaZh+X/6UtEp28x51AUYZDMg9NGoz2ja3dNHa+ta/tk40vCzKhQ/RypCWBMLbmDr6//E24Vv5uPsrqXFozdkAg==", + "license": "MIT", + "dependencies": { + "react-router": "7.18.1" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "react": ">=18", + "react-dom": ">=18" + } + }, + "node_modules/rollup": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.62.2.tgz", + "integrity": "sha512-RFnrW4lhXA3s3eqHDZvN654g8OTjzRfqpIRJYczCGB6HzphckVAi/Qh4tbPUbRuDi7s1Llv8g/NspLkttY3gTA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.9" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.62.2", + "@rollup/rollup-android-arm64": "4.62.2", + "@rollup/rollup-darwin-arm64": "4.62.2", + "@rollup/rollup-darwin-x64": "4.62.2", + "@rollup/rollup-freebsd-arm64": "4.62.2", + "@rollup/rollup-freebsd-x64": "4.62.2", + "@rollup/rollup-linux-arm-gnueabihf": "4.62.2", + "@rollup/rollup-linux-arm-musleabihf": "4.62.2", + "@rollup/rollup-linux-arm64-gnu": "4.62.2", + "@rollup/rollup-linux-arm64-musl": "4.62.2", + "@rollup/rollup-linux-loong64-gnu": "4.62.2", + "@rollup/rollup-linux-loong64-musl": "4.62.2", + "@rollup/rollup-linux-ppc64-gnu": "4.62.2", + "@rollup/rollup-linux-ppc64-musl": "4.62.2", + "@rollup/rollup-linux-riscv64-gnu": "4.62.2", + "@rollup/rollup-linux-riscv64-musl": "4.62.2", + "@rollup/rollup-linux-s390x-gnu": "4.62.2", + "@rollup/rollup-linux-x64-gnu": "4.62.2", + "@rollup/rollup-linux-x64-musl": "4.62.2", + "@rollup/rollup-openbsd-x64": "4.62.2", + "@rollup/rollup-openharmony-arm64": "4.62.2", + "@rollup/rollup-win32-arm64-msvc": "4.62.2", + "@rollup/rollup-win32-ia32-msvc": "4.62.2", + "@rollup/rollup-win32-x64-gnu": "4.62.2", + "@rollup/rollup-win32-x64-msvc": "4.62.2", + "fsevents": "~2.3.2" + } + }, + "node_modules/scheduler": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", + "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/set-cookie-parser": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.2.tgz", + "integrity": "sha512-oeM1lpU/UvhTxw+g3cIfxXHyJRc/uidd3yK1P242gzHds0udQBYzs3y8j4gCCW+ZJ7ad0yctld8RYO+bdurlvw==", + "license": "MIT" + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", + "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/vite": { + "version": "6.4.3", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.3.tgz", + "integrity": "sha512-NTKlcQjlAK7MlQoyb6LgaqHc8sso/pVyUJYWMws3jg21uTJw/LddqIFPcPqP6PzpgbIcZyKI85sFE4HBrQDA8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.25.0", + "fdir": "^6.4.4", + "picomatch": "^4.0.2", + "postcss": "^8.5.3", + "rollup": "^4.34.9", + "tinyglobby": "^0.2.13" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "jiti": ">=1.21.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "sass-embedded": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true, + "license": "ISC" + }, + "node_modules/zustand": { + "version": "5.0.14", + "resolved": "https://registry.npmjs.org/zustand/-/zustand-5.0.14.tgz", + "integrity": "sha512-/8tAspM5LMPr28b3fwLYrtdj77ECpfZviaP75CMTnwO8ISyaE4GDIG/9rDDYq/cH9D2Xw2A2RXglLInmVBQB/g==", + "license": "MIT", + "engines": { + "node": ">=12.20.0" + }, + "peerDependencies": { + "@types/react": ">=18.0.0", + "immer": ">=9.0.6", + "react": ">=18.0.0", + "use-sync-external-store": ">=1.2.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "immer": { + "optional": true + }, + "react": { + "optional": true + }, + "use-sync-external-store": { + "optional": true + } + } + } + } +} diff --git a/frontend/package.json b/frontend/package.json new file mode 100644 index 0000000..d577e36 --- /dev/null +++ b/frontend/package.json @@ -0,0 +1,27 @@ +{ + "name": "charging-station-panel", + "private": true, + "version": "1.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc -b && vite build", + "preview": "vite preview" + }, + "dependencies": { + "@fontsource/archivo": "^5.1.0", + "@fontsource/ibm-plex-mono": "^5.1.0", + "@tanstack/react-query": "^5.62.0", + "react": "^19.0.0", + "react-dom": "^19.0.0", + "react-router-dom": "^7.1.0", + "zustand": "^5.0.2" + }, + "devDependencies": { + "@types/react": "^19.0.0", + "@types/react-dom": "^19.0.0", + "@vitejs/plugin-react": "^4.3.4", + "typescript": "^5.7.2", + "vite": "^6.0.5" + } +} diff --git a/frontend/public/icon.svg b/frontend/public/icon.svg new file mode 100644 index 0000000..ca37ba7 --- /dev/null +++ b/frontend/public/icon.svg @@ -0,0 +1,4 @@ + + + + diff --git a/frontend/public/manifest.json b/frontend/public/manifest.json new file mode 100644 index 0000000..9d5e3e9 --- /dev/null +++ b/frontend/public/manifest.json @@ -0,0 +1,12 @@ +{ + "name": "Charge Control", + "short_name": "Charge", + "description": "Home EV charger and relay control", + "start_url": "/", + "display": "standalone", + "background_color": "#171d1b", + "theme_color": "#171d1b", + "icons": [ + { "src": "/icon.svg", "sizes": "any", "type": "image/svg+xml", "purpose": "any" } + ] +} diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx new file mode 100644 index 0000000..495b191 --- /dev/null +++ b/frontend/src/App.tsx @@ -0,0 +1,55 @@ +import { useEffect } from "react"; +import { Navigate, Route, Routes, useLocation } from "react-router-dom"; +import { api, ApiError, isAdmin } from "./api"; +import { useApp } from "./store"; +import type { Me } from "./types"; +import Layout from "./components/Layout"; +import Login from "./pages/Login"; +import Dashboard from "./pages/Dashboard"; +import History from "./pages/History"; +import Cards from "./pages/Cards"; +import Users from "./pages/Users"; + +export default function App() { + const { me, authChecked, setMe } = useApp(); + const location = useLocation(); + + useEffect(() => { + api + .get("/me") + .then(setMe) + .catch((e) => { + if (e instanceof ApiError && e.status === 401) setMe(null); + else setMe(null); + }); + }, [setMe]); + + if (!authChecked) { + return ( +
+ Connecting… +
+ ); + } + + if (!me) { + return ( + + } /> + + ); + } + + const admin = isAdmin(me.scopes); + return ( + + }> + } /> + } /> + {admin && } />} + {admin && } />} + } /> + + + ); +} diff --git a/frontend/src/api.ts b/frontend/src/api.ts new file mode 100644 index 0000000..cb65f65 --- /dev/null +++ b/frontend/src/api.ts @@ -0,0 +1,52 @@ +export class ApiError extends Error { + status: number; + constructor(status: number, detail: string) { + super(detail); + this.status = status; + } +} + +async function request(path: string, init?: RequestInit): Promise { + const res = await fetch(`/api${path}`, { + headers: init?.body ? { "Content-Type": "application/json" } : undefined, + ...init, + }); + if (!res.ok) { + let detail = res.statusText; + try { + detail = (await res.json()).detail ?? detail; + } catch { + /* non-JSON error body */ + } + throw new ApiError(res.status, detail); + } + return res.json() as Promise; +} + +export const api = { + get: (path: string) => request(path), + post: (path: string, body?: unknown) => + request(path, { method: "POST", body: body ? JSON.stringify(body) : undefined }), + put: (path: string, body: unknown) => + request(path, { method: "PUT", body: JSON.stringify(body) }), + delete: (path: string) => request(path, { method: "DELETE" }), +}; + +/** Mirrors backend/users.py `allowed()` — fnmatch-lite scope check. */ +export function scopeAllowed(scopes: string[], needed: string): boolean { + return scopes.some((grant) => { + if (grant === "*" || grant === "admin") return true; + const re = new RegExp( + "^" + + grant + .split("*") + .map((p) => p.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")) + .join(".*") + + "$", + ); + return re.test(needed); + }); +} + +export const isAdmin = (scopes: string[]) => + scopes.some((s) => s === "admin" || s === "*"); diff --git a/frontend/src/components/Lamp.tsx b/frontend/src/components/Lamp.tsx new file mode 100644 index 0000000..82f6d69 --- /dev/null +++ b/frontend/src/components/Lamp.tsx @@ -0,0 +1,34 @@ +/** The signature element: a physical indicator lamp, like the ones on the + * charger cabinet itself. Tone encodes state everywhere in the app. */ +export type LampTone = "off" | "green" | "amber" | "red" | "pulse"; + +const TONE_CLASS: Record = { + off: "lamp", + green: "lamp lamp--green", + amber: "lamp lamp--amber", + red: "lamp lamp--red", + pulse: "lamp lamp--green lamp--pulse", +}; + +export function Lamp({ tone, title }: { tone: LampTone; title?: string }) { + return ; +} + +export function statusTone(ocppStatus: string, charging: boolean): LampTone { + if (charging) return "pulse"; + switch (ocppStatus) { + case "Charging": + return "pulse"; + case "Preparing": + case "Finishing": + case "Reserved": + return "amber"; + case "Available": + return "green"; + case "Faulted": + case "Unavailable": + return "red"; + default: + return "off"; + } +} diff --git a/frontend/src/components/Layout.tsx b/frontend/src/components/Layout.tsx new file mode 100644 index 0000000..eda7cc9 --- /dev/null +++ b/frontend/src/components/Layout.tsx @@ -0,0 +1,86 @@ +import { NavLink, Outlet } from "react-router-dom"; +import { api, isAdmin } from "../api"; +import { useApp } from "../store"; +import { useStatus } from "../queries"; + +const NAV = [ + { to: "/", label: "Control", exact: true }, + { to: "/history", label: "History" }, +]; + +const ADMIN_NAV = [ + { to: "/cards", label: "Cards" }, + { to: "/users", label: "Users" }, +]; + +export default function Layout() { + const { me, setMe, toasts } = useApp(); + const { data: status } = useStatus(); + const admin = me ? isAdmin(me.scopes) : false; + const pending = status?.pending_cards ?? 0; + + async function logout() { + await api.post("/logout").catch(() => undefined); + setMe(null); + } + + return ( +
+
+
+ + + +
+ Charge Control + private CSMS +
+
+ +
+ {me?.name} + +
+
+ + {admin && pending > 0 && ( + + + {pending === 1 ? "An unknown card was presented" : `${pending} unknown cards were presented`} +  — review and approve or reject. + + )} + +
+ +
+ +
+ {toasts.map((t) => ( +
+ {t.text} +
+ ))} +
+
+ ); +} diff --git a/frontend/src/main.tsx b/frontend/src/main.tsx new file mode 100644 index 0000000..b82f8f9 --- /dev/null +++ b/frontend/src/main.tsx @@ -0,0 +1,29 @@ +import React from "react"; +import ReactDOM from "react-dom/client"; +import { BrowserRouter } from "react-router-dom"; +import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; +import App from "./App"; +import "@fontsource/archivo/400.css"; +import "@fontsource/archivo/500.css"; +import "@fontsource/archivo/600.css"; +import "@fontsource/archivo/700.css"; +import "@fontsource/ibm-plex-mono/400.css"; +import "@fontsource/ibm-plex-mono/500.css"; +import "@fontsource/ibm-plex-mono/600.css"; +import "./styles.css"; + +const queryClient = new QueryClient({ + defaultOptions: { + queries: { staleTime: 3000, refetchOnWindowFocus: true }, + }, +}); + +ReactDOM.createRoot(document.getElementById("root")!).render( + + + + + + + , +); diff --git a/frontend/src/pages/Cards.tsx b/frontend/src/pages/Cards.tsx new file mode 100644 index 0000000..0dfd631 --- /dev/null +++ b/frontend/src/pages/Cards.tsx @@ -0,0 +1,318 @@ +import { useState } from "react"; +import { api } from "../api"; +import { Lamp } from "../components/Lamp"; +import { + useAction, + useAllowlist, + useDenied, + usePending, + usePermissions, + useUsers, +} from "../queries"; +import { useApp } from "../store"; +import type { CardEntry, PermissionCatalog } from "../types"; + +const fmtTime = (iso?: string | null) => + iso ? new Date(iso).toLocaleString([], { dateStyle: "medium", timeStyle: "short" }) : "—"; + +/** Checkbox list of every gun in the system -> ["eu092025:2", ...]; empty = all guns. */ +function GunPicker({ + catalog, + value, + onChange, +}: { + catalog: PermissionCatalog | undefined; + value: string[]; + onChange: (guns: string[]) => void; +}) { + if (!catalog) return null; + const toggle = (gun: string) => + onChange(value.includes(gun) ? value.filter((g) => g !== gun) : [...value, gun]); + return ( +
+ Allowed guns (none checked = all) + {Object.entries(catalog.chargers).map(([cp, meta]) => ( +
+ {Object.entries(meta.guns).map(([conn, label]) => { + const gun = `${cp}:${conn}`; + return ( + + ); + })} +
+ ))} +
+ ); +} + +function CardForm({ + initial, + submitLabel, + busy, + onSubmit, + onCancel, +}: { + initial: CardEntry; + submitLabel: string; + busy: boolean; + onSubmit: (entry: CardEntry) => void; + onCancel?: () => void; +}) { + const { data: users } = useUsers(); + const { data: catalog } = usePermissions(); + const [name, setName] = useState(initial.name); + const [owner, setOwner] = useState(initial.user ?? ""); + const [guns, setGuns] = useState(initial.guns ?? []); + + return ( +
{ + e.preventDefault(); + onSubmit({ + name: name.trim(), + kind: initial.kind || "card", + ...(owner ? { user: owner } : {}), + ...(guns.length ? { guns } : {}), + }); + }} + > + + + +
+ + {onCancel && ( + + )} +
+ + ); +} + +function PendingSection() { + const toast = useApp((s) => s.toast); + const { data: pending } = usePending(); + const [open, setOpen] = useState(null); + + const approve = useAction( + ({ tag, entry }: { tag: string; entry: CardEntry }) => + api.post(`/cards/pending/${encodeURIComponent(tag)}/approve`, entry), + [["pending"], ["allowlist"], ["status"]], + () => { + toast("Card approved and enrolled"); + setOpen(null); + }, + ); + const reject = useAction( + (tag: string) => api.post(`/cards/pending/${encodeURIComponent(tag)}/reject`), + [["pending"], ["denied"], ["status"]], + () => toast("Card rejected — it will be silently refused from now on"), + ); + + const entries = Object.entries(pending ?? {}); + if (!entries.length) return null; + + return ( +
+
+

+ Awaiting review +

+ + unknown cards presented at a charger — approve to enroll, reject to silence + +
+
    + {entries.map(([tag, meta]) => ( +
  • +
    +
    + {tag} + + tapped ×{meta.count} · last {fmtTime(meta.last_seen)} + {meta.cp ? ` · at ${meta.cp}${meta.connector ? ` gun ${meta.connector}` : ""}` : ""} + +
    +
    + + +
    +
    + {open === tag && ( + approve.mutate({ tag, entry })} + onCancel={() => setOpen(null)} + /> + )} +
  • + ))} +
+
+ ); +} + +function AuthorizedSection() { + const toast = useApp((s) => s.toast); + const { data } = useAllowlist(); + const [editing, setEditing] = useState(null); + + const save = useAction( + ({ tag, entry }: { tag: string; entry: CardEntry }) => + api.put(`/allowlist/${encodeURIComponent(tag)}`, entry), + [["allowlist"]], + () => { + toast("Card updated"); + setEditing(null); + }, + ); + const remove = useAction( + (tag: string) => api.delete(`/allowlist/${encodeURIComponent(tag)}`), + [["allowlist"]], + () => toast("Card removed"), + ); + + const entries = Object.entries(data?.authorized ?? {}); + + return ( +
+
+

Enrolled cards & tokens

+ what may authorize a charge, and who it belongs to +
+ {!entries.length &&

Nothing enrolled yet.

} +
+ + + {entries.map(([tag, entry]) => ( + + + + + + + + + ))} + +
{tag}{entry.name} + + {entry.kind} + + {entry.user ?? unassigned}{entry.guns?.join(", ") ?? "all guns"} + + +
+
+ {editing && data?.authorized[editing] && ( +
+

{editing}

+ + save.mutate({ tag: editing, entry: { ...entry, kind: data.authorized[editing].kind } }) + } + onCancel={() => setEditing(null)} + /> +
+ )} +
+ ); +} + +function DeniedSection() { + const toast = useApp((s) => s.toast); + const { data: denied } = useDenied(); + const undeny = useAction( + (tag: string) => api.delete(`/cards/denied/${encodeURIComponent(tag)}`), + [["denied"]], + () => toast("Card un-rejected — it pends again on its next tap"), + ); + + const entries = Object.entries(denied ?? {}); + if (!entries.length) return null; + + return ( +
+
+

Rejected cards

+ silently refused; un-reject to reconsider +
+
    + {entries.map(([tag, meta]) => ( +
  • + + {tag} + + by {meta.by} · {fmtTime(meta.rejected_at)} + + +
  • + ))} +
+
+ ); +} + +export default function Cards() { + return ( + <> + + + + + ); +} diff --git a/frontend/src/pages/Dashboard.tsx b/frontend/src/pages/Dashboard.tsx new file mode 100644 index 0000000..453555a --- /dev/null +++ b/frontend/src/pages/Dashboard.tsx @@ -0,0 +1,199 @@ +import { api, scopeAllowed } from "../api"; +import { Lamp, statusTone } from "../components/Lamp"; +import { useAction, useLiveRelays, useStatus } from "../queries"; +import { useApp } from "../store"; +import type { ActiveTx, Status } from "../types"; + +function fmtSince(iso: string): string { + const mins = Math.max(0, Math.round((Date.now() - new Date(iso).getTime()) / 60000)); + return mins >= 60 ? `${Math.floor(mins / 60)} h ${mins % 60} min` : `${mins} min`; +} + +interface Gun { + cp: string; + connector: number; + label: string; + chargerLabel: string; + ocppStatus: string; + tx: (ActiveTx & { txId: string }) | null; +} + +function gunsFrom(status: Status): Gun[] { + const txByGun = new Map(); + for (const [txId, tx] of Object.entries(status.active_transactions)) + txByGun.set(`${tx.cp}/${tx.connector}`, { ...tx, txId }); + + return Object.entries(status.connectors) + .map(([key, ocppStatus]) => { + const [cp, conn] = [key.slice(0, key.lastIndexOf("/")), key.slice(key.lastIndexOf("/") + 1)]; + return { cp, connector: Number(conn), ocppStatus }; + }) + .filter((g) => g.connector > 0) + .sort((a, b) => a.cp.localeCompare(b.cp) || a.connector - b.connector) + .map((g) => { + const meta = status.chargers[g.cp] ?? {}; + return { + ...g, + label: meta.guns?.[String(g.connector)] ?? `Gun ${g.connector}`, + chargerLabel: meta.label ?? g.cp, + tx: txByGun.get(`${g.cp}/${g.connector}`) ?? null, + }; + }); +} + +function GunBay({ gun, scopes }: { gun: Gun; scopes: string[] }) { + const toast = useApp((s) => s.toast); + const may = scopeAllowed(scopes, `charger:${gun.cp}:${gun.connector}`); + const ready = !gun.tx && (gun.ocppStatus === "Preparing" || gun.ocppStatus === "Available"); + + const start = useAction( + () => + api.post<{ remote_start: string }>( + `/charger/start?connector=${gun.connector}&cp=${encodeURIComponent(gun.cp)}`, + ), + [["status"], ["sessions"]], + (r) => toast(`Start command: ${r.remote_start}`), + ); + const stop = useAction( + () => api.post<{ remote_stop: string }>(`/charger/stop/${gun.tx!.txId}`), + [["status"], ["sessions"]], + (r) => toast(`Stop command: ${r.remote_stop}`), + ); + + return ( +
+
+ {gun.chargerLabel} + +
+

{gun.label}

+
+ + {gun.tx ? "Charging" : gun.ocppStatus} + + {gun.ocppStatus === "Preparing" && !gun.tx && ( + cable plugged — ready to start + )} +
+ + {gun.tx && ( +
+
+
By
+
{gun.tx.who || gun.tx.id_tag}
+
+
+
Via
+
{gun.tx.method === "app" ? "In-app" : gun.tx.method === "card" ? "Card" : gun.tx.method}
+
+
+
Running
+
{fmtSince(gun.tx.started)}
+
+
+ )} + +
+ {gun.tx ? ( + + ) : ( + + )} + {!may && no permission for this gun} +
+
+ ); +} + +function Relays({ status, scopes }: { status: Status; scopes: string[] }) { + const toast = useApp((s) => s.toast); + const live = useLiveRelays(); + const names = Object.keys(status.relays); + + const toggle = useAction( + (name: string) => api.post<{ relay: string; on: boolean }>(`/relays/${encodeURIComponent(name)}/toggle`), + [["relays-live"]], + (r) => toast(`${r.relay}: ${r.on ? "on" : "off"}`), + ); + + if (!names.length) return null; + return ( +
+
+

Relays

+ +
+
    + {names.map((name) => { + const state = live.data?.[name]; + const on = state && "on" in state ? state.on : undefined; + return ( +
  • + + {status.relays[name].label} + + {state?.error ? "unreachable" : on === undefined ? "—" : on ? "on" : "off"} + + +
  • + ); + })} +
+
+ ); +} + +export default function Dashboard() { + const me = useApp((s) => s.me)!; + const { data: status, isLoading, error } = useStatus(); + + if (isLoading) return

Reading charger status…

; + if (error || !status) return

Status unavailable: {(error as Error)?.message}

; + + const guns = gunsFrom(status); + const offline = Object.keys(status.connected).length === 0; + + return ( + <> + {offline && ( +
+ +
+

Charger offline

+

Waiting for the charge point to dial in. Guns appear here as soon as it connects.

+
+
+ )} +
+ {guns.map((g) => ( + + ))} +
+ + + ); +} diff --git a/frontend/src/pages/History.tsx b/frontend/src/pages/History.tsx new file mode 100644 index 0000000..499e3dc --- /dev/null +++ b/frontend/src/pages/History.tsx @@ -0,0 +1,85 @@ +import { useSessions, useStatus } from "../queries"; +import type { Session } from "../types"; + +const fmtKwh = (wh: number | null) => (wh == null ? "—" : (wh / 1000).toFixed(2)); +const fmtTime = (iso: string | null) => + iso ? new Date(iso).toLocaleString([], { dateStyle: "medium", timeStyle: "short" }) : "—"; + +function fmtDuration(a: string, b: string | null): string { + if (!b) return ""; + const mins = Math.max(0, Math.round((new Date(b).getTime() - new Date(a).getTime()) / 60000)); + return mins >= 60 ? `${Math.floor(mins / 60)} h ${String(mins % 60).padStart(2, "0")} min` : `${mins} min`; +} + +function MethodChip({ method }: { method: string | null }) { + if (method === "card") return Card; + if (method === "app") return In-app; + return {method ?? "—"}; +} + +function gunLabel(s: Session, chargers: Record }>) { + const meta = chargers[s.cp]; + return meta?.guns?.[String(s.connector)] ?? `${s.cp} · gun ${s.connector}`; +} + +export default function History() { + const { data: sessions, isLoading } = useSessions(); + const { data: status } = useStatus(); + + if (isLoading) return

Loading history…

; + if (!sessions?.length) + return ( +

+ No charging sessions yet. The first card tap or in-app start will appear here with who, + when, how, and how many kWh. +

+ ); + + const totalKwh = sessions.reduce((acc, s) => acc + (s.wh ?? 0), 0) / 1000; + + return ( +
+
+

Charging sessions

+ + {sessions.length} session{sessions.length === 1 ? "" : "s"} ·{" "} + {totalKwh.toFixed(1)} kWh total + +
+
+ + + + + + + + + + + + + {sessions.map((s) => ( + + + + + + + + + ))} + +
WhoViaGunStartedDurationkWh
{s.who || s.id_tag} + + {gunLabel(s, status?.chargers ?? {})}{fmtTime(s.started)} + {s.ended ? ( + fmtDuration(s.started, s.ended) + ) : ( + charging + )} + {fmtKwh(s.wh)}
+
+
+ ); +} diff --git a/frontend/src/pages/Login.tsx b/frontend/src/pages/Login.tsx new file mode 100644 index 0000000..6cd1f5d --- /dev/null +++ b/frontend/src/pages/Login.tsx @@ -0,0 +1,64 @@ +import { FormEvent, useState } from "react"; +import { api } from "../api"; +import { useApp } from "../store"; +import type { Me } from "../types"; + +export default function Login() { + const setMe = useApp((s) => s.setMe); + const [username, setUsername] = useState(""); + const [password, setPassword] = useState(""); + const [error, setError] = useState(null); + const [busy, setBusy] = useState(false); + + async function submit(e: FormEvent) { + e.preventDefault(); + setBusy(true); + setError(null); + try { + const r = await api.post<{ user: Me }>("/login", { username, password }); + setMe(r.user); + } catch (err) { + setError((err as Error).message); + } finally { + setBusy(false); + } + } + + return ( +
+
+
+ + + +

Charge Control

+

Private charging backend — sign in to operate.

+
+ + + {error &&

{error}

} + +
+
+ ); +} diff --git a/frontend/src/pages/Users.tsx b/frontend/src/pages/Users.tsx new file mode 100644 index 0000000..27ebd95 --- /dev/null +++ b/frontend/src/pages/Users.tsx @@ -0,0 +1,275 @@ +import { useMemo, useState } from "react"; +import { api, isAdmin, scopeAllowed } from "../api"; +import { useAction, usePermissions, useUsers } from "../queries"; +import { useApp } from "../store"; +import type { Me, PermissionCatalog } from "../types"; + +/** The permission matrix: scopes rendered as checkboxes instead of raw strings. */ +interface Matrix { + admin: boolean; + guns: string[]; // "cp:conn" + allRelays: boolean; + relays: string[]; +} + +function toMatrix(scopes: string[], catalog: PermissionCatalog): Matrix { + const nonAdmin = scopes.filter((s) => s !== "admin" && s !== "*"); + const guns: string[] = []; + for (const [cp, meta] of Object.entries(catalog.chargers)) + for (const conn of Object.keys(meta.guns)) + if (scopeAllowed(nonAdmin, `charger:${cp}:${conn}`)) guns.push(`${cp}:${conn}`); + const allRelays = nonAdmin.includes("relay:*"); + const relays = allRelays + ? [] + : Object.keys(catalog.relays).filter((r) => scopeAllowed(nonAdmin, `relay:${r}`)); + return { admin: isAdmin(scopes), guns, allRelays, relays }; +} + +function toScopes(m: Matrix): string[] { + if (m.admin) return ["admin"]; + return [ + ...m.guns.map((g) => `charger:${g}`), + ...(m.allRelays ? ["relay:*"] : m.relays.map((r) => `relay:${r}`)), + ]; +} + +function MatrixEditor({ + catalog, + value, + onChange, +}: { + catalog: PermissionCatalog; + value: Matrix; + onChange: (m: Matrix) => void; +}) { + const toggleList = (list: string[], item: string) => + list.includes(item) ? list.filter((x) => x !== item) : [...list, item]; + + return ( +
+ + + {!value.admin && ( + <> +
+ Charging guns + {Object.entries(catalog.chargers).map(([cp, meta]) => + Object.entries(meta.guns).map(([conn, label]) => { + const gun = `${cp}:${conn}`; + return ( + + ); + }), + )} + {!Object.keys(catalog.chargers).length && ( + no chargers known yet + )} +
+ +
+ Relays + + {!value.allRelays && + Object.entries(catalog.relays).map(([name, meta]) => ( + + ))} + {!value.allRelays && !Object.keys(catalog.relays).length && ( + no relays registered yet + )} +
+ + )} +
+ ); +} + +function UserEditor({ + user, + catalog, + onClose, +}: { + user: Me | null; // null = create new + catalog: PermissionCatalog; + onClose: () => void; +}) { + const toast = useApp((s) => s.toast); + const [name, setName] = useState(user?.name ?? ""); + const [password, setPassword] = useState(""); + const [matrix, setMatrix] = useState(() => + user ? toMatrix(user.scopes, catalog) : { admin: false, guns: [], allRelays: false, relays: [] }, + ); + + const save = useAction( + () => + api.put(`/users/${encodeURIComponent(name.trim())}`, { + ...(password ? { password } : {}), + scopes: toScopes(matrix), + }), + [["users"]], + () => { + toast(user ? "User updated" : "User created"); + onClose(); + }, + ); + + return ( +
{ + e.preventDefault(); + save.mutate(); + }} + > +

{user ? `Edit ${user.name}` : "New user"}

+
+ + +
+ +
+ + +
+ + ); +} + +function describeScopes(scopes: string[], catalog: PermissionCatalog): string { + if (isAdmin(scopes)) return "Administrator"; + const m = toMatrix(scopes, catalog); + const parts: string[] = []; + for (const gun of m.guns) { + const [cp, conn] = gun.split(":"); + const meta = catalog.chargers[cp]; + parts.push(meta ? `${meta.label} ${meta.guns[conn] ?? `gun ${conn}`}` : gun); + } + if (m.allRelays) parts.push("all relays"); + else parts.push(...m.relays.map((r) => catalog.relays[r]?.label ?? r)); + return parts.length ? parts.join(" · ") : "No permissions"; +} + +export default function Users() { + const me = useApp((s) => s.me)!; + const toast = useApp((s) => s.toast); + const { data: users } = useUsers(); + const { data: catalog } = usePermissions(); + const [editing, setEditing] = useState(null); + + const remove = useAction( + (name: string) => api.delete(`/users/${encodeURIComponent(name)}`), + [["users"]], + () => toast("User deleted (their sessions are now invalid)"), + ); + + const sorted = useMemo( + () => [...(users ?? [])].sort((a, b) => a.name.localeCompare(b.name)), + [users], + ); + + if (!catalog) return

Loading permission catalog…

; + + return ( +
+
+

Users

+ +
+ {!sorted.length && ( +

+ No users yet — the API is open until the first account exists. Create the admin account + now. +

+ )} +
+ + + {sorted.map((u) => ( + + + + + + ))} + +
{u.name}{describeScopes(u.scopes, catalog)} + + +
+
+ {editing !== null && ( + setEditing(null)} + /> + )} +
+ ); +} diff --git a/frontend/src/queries.ts b/frontend/src/queries.ts new file mode 100644 index 0000000..43370bd --- /dev/null +++ b/frontend/src/queries.ts @@ -0,0 +1,95 @@ +import { + useMutation, + useQuery, + useQueryClient, +} from "@tanstack/react-query"; +import { api, ApiError } from "./api"; +import { useApp } from "./store"; +import type { + CardEntry, + DeniedCard, + Me, + PendingCard, + PermissionCatalog, + RelayState, + Session, + Status, +} from "./types"; + +export function useStatus() { + const setMe = useApp((s) => s.setMe); + return useQuery({ + queryKey: ["status"], + queryFn: async () => { + try { + return await api.get("/status"); + } catch (e) { + if (e instanceof ApiError && e.status === 401) setMe(null); + throw e; + } + }, + refetchInterval: 5000, + retry: false, + }); +} + +export const useSessions = () => + useQuery({ + queryKey: ["sessions"], + queryFn: () => api.get("/sessions?limit=200"), + refetchInterval: 15000, + }); + +export const usePending = () => + useQuery({ + queryKey: ["pending"], + queryFn: () => api.get>("/cards/pending"), + refetchInterval: 10000, + }); + +export const useDenied = () => + useQuery({ + queryKey: ["denied"], + queryFn: () => api.get>("/cards/denied"), + }); + +export const useAllowlist = () => + useQuery({ + queryKey: ["allowlist"], + queryFn: () => api.get<{ authorized: Record }>("/allowlist"), + }); + +export const useUsers = () => + useQuery({ queryKey: ["users"], queryFn: () => api.get("/users") }); + +export const usePermissions = () => + useQuery({ + queryKey: ["permissions"], + queryFn: () => api.get("/permissions"), + }); + +export const useLiveRelays = () => + useQuery({ + queryKey: ["relays-live"], + queryFn: () => api.get>("/relays?live=true"), + enabled: false, // fetched on demand (each poll talks to real hardware) + retry: false, + }); + +/** Mutation wrapper: toast on error, invalidate the given query keys on success. */ +export function useAction( + fn: (args: TArgs) => Promise, + invalidate: string[][], + onDone?: (result: TResult) => void, +) { + const qc = useQueryClient(); + const toast = useApp((s) => s.toast); + return useMutation({ + mutationFn: fn, + onSuccess: (result) => { + for (const key of invalidate) qc.invalidateQueries({ queryKey: key }); + onDone?.(result); + }, + onError: (e: Error) => toast(e.message, "error"), + }); +} diff --git a/frontend/src/store.ts b/frontend/src/store.ts new file mode 100644 index 0000000..7d6d277 --- /dev/null +++ b/frontend/src/store.ts @@ -0,0 +1,31 @@ +import { create } from "zustand"; +import type { Me } from "./types"; + +/** Auth + app-shell state (zustand). Server data lives in TanStack Query. */ +interface AppState { + me: Me | null; + authChecked: boolean; // finished the initial /api/me probe + setMe: (me: Me | null) => void; + toasts: { id: number; text: string; tone: "info" | "error" }[]; + toast: (text: string, tone?: "info" | "error") => void; + dismissToast: (id: number) => void; +} + +let toastId = 0; + +export const useApp = create((set) => ({ + me: null, + authChecked: false, + setMe: (me) => set({ me, authChecked: true }), + toasts: [], + toast: (text, tone = "info") => { + const id = ++toastId; + set((s) => ({ toasts: [...s.toasts, { id, text, tone }] })); + setTimeout( + () => set((s) => ({ toasts: s.toasts.filter((t) => t.id !== id) })), + 4000, + ); + }, + dismissToast: (id) => + set((s) => ({ toasts: s.toasts.filter((t) => t.id !== id) })), +})); diff --git a/frontend/src/styles.css b/frontend/src/styles.css new file mode 100644 index 0000000..be474b8 --- /dev/null +++ b/frontend/src/styles.css @@ -0,0 +1,368 @@ +/* ============================================================ + Charge Control — instrument-panel design system + Surfaces like enameled switchgear, copper-busbar accent, + indicator lamps as the signature element. + Type: Archivo (UI) + IBM Plex Mono (telemetry & identifiers). + ============================================================ */ + +:root { + --paper: #eef0ef; /* porcelain enamel */ + --panel: #f9faf9; + --panel-inset: #f1f3f2; + --ink: #1d2523; /* deep green-black, like cabinet paint */ + --ink-dim: #5d6b67; + --line: #d8ddda; + --copper: #b25c28; /* busbar copper — the accent */ + --copper-deep: #8f4a20; + --live: #178a5c; /* DC-on green */ + --amber: #c07f00; + --red: #bf3527; + --lamp-off: #c4ccc8; + --shadow: 0 1px 2px rgb(29 37 35 / 0.06), 0 4px 16px rgb(29 37 35 / 0.05); + --radius: 10px; + --font-ui: "Archivo", "Segoe UI", system-ui, sans-serif; + --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace; +} + +@media (prefers-color-scheme: dark) { + :root { + --paper: #131816; + --panel: #1b211f; + --panel-inset: #161c1a; + --ink: #e4e9e7; + --ink-dim: #93a09b; + --line: #2c3531; + --copper: #d07a3e; + --copper-deep: #b25c28; + --live: #2fae7c; + --amber: #d99a1b; + --red: #d8503f; + --lamp-off: #39433f; + --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 4px 18px rgb(0 0 0 / 0.35); + } +} + +* { box-sizing: border-box; margin: 0; } + +html { color-scheme: light dark; } + +body { + background: var(--paper); + color: var(--ink); + font-family: var(--font-ui); + font-size: 15.5px; + line-height: 1.5; + -webkit-font-smoothing: antialiased; +} + +button, input, select { font: inherit; color: inherit; } + +:focus-visible { + outline: 2px solid var(--copper); + outline-offset: 2px; + border-radius: 4px; +} + +.mono { font-family: var(--font-mono); font-size: 0.92em; } +.strong { font-weight: 600; } +.dim { color: var(--ink-dim); } +.num { text-align: right; } + +/* ---------- indicator lamp (signature element) ---------- */ +.lamp { + display: inline-block; + width: 11px; height: 11px; + border-radius: 50%; + background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--lamp-off) 60%, white 25%), var(--lamp-off) 70%); + box-shadow: inset 0 0 2px rgb(0 0 0 / 0.35); + vertical-align: baseline; + flex: none; +} +.lamp--green { + background: radial-gradient(circle at 35% 30%, #8fe8c2, var(--live) 70%); + box-shadow: inset 0 0 2px rgb(0 0 0 / 0.25), 0 0 8px color-mix(in srgb, var(--live) 55%, transparent); +} +.lamp--amber { + background: radial-gradient(circle at 35% 30%, #ffd98a, var(--amber) 70%); + box-shadow: inset 0 0 2px rgb(0 0 0 / 0.25), 0 0 8px color-mix(in srgb, var(--amber) 55%, transparent); +} +.lamp--red { + background: radial-gradient(circle at 35% 30%, #ff9d8f, var(--red) 70%); + box-shadow: inset 0 0 2px rgb(0 0 0 / 0.25), 0 0 8px color-mix(in srgb, var(--red) 55%, transparent); +} +.lamp--pulse { animation: lamp-pulse 1.6s ease-in-out infinite; } +@keyframes lamp-pulse { + 0%, 100% { box-shadow: inset 0 0 2px rgb(0 0 0 / 0.25), 0 0 4px color-mix(in srgb, var(--live) 40%, transparent); } + 50% { box-shadow: inset 0 0 2px rgb(0 0 0 / 0.25), 0 0 14px color-mix(in srgb, var(--live) 85%, transparent); } +} +@media (prefers-reduced-motion: reduce) { + .lamp--pulse { animation: none; } + * { transition: none !important; } +} + +/* ---------- app shell ---------- */ +.shell { min-height: 100dvh; display: flex; flex-direction: column; } + +.topbar { + display: flex; align-items: center; gap: 20px; + padding: 10px clamp(14px, 4vw, 32px); + background: var(--panel); + border-bottom: 1px solid var(--line); + position: sticky; top: 0; z-index: 10; +} + +.brand { display: flex; align-items: center; gap: 10px; } +.brand__mark { width: 30px; height: 30px; } +.brand__mark path { fill: var(--copper); } +.brand__name { display: block; font-weight: 700; letter-spacing: 0.01em; line-height: 1.15; } +.brand__sub { + display: block; font-family: var(--font-mono); font-size: 10.5px; + text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-dim); +} + +.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; } +.nav__link { + display: inline-flex; align-items: center; gap: 7px; + padding: 7px 13px; + border-radius: 8px; + color: var(--ink-dim); + text-decoration: none; + font-weight: 500; + white-space: nowrap; +} +.nav__link:hover { color: var(--ink); background: var(--panel-inset); } +.nav__link.active { color: var(--copper-deep); background: color-mix(in srgb, var(--copper) 12%, transparent); font-weight: 600; } + +.badge { + background: var(--amber); color: #fff; + font-family: var(--font-mono); font-size: 11px; font-weight: 600; + border-radius: 999px; padding: 1px 7px; +} + +.topbar__user { display: flex; align-items: center; gap: 10px; } +.topbar__who { font-family: var(--font-mono); font-size: 13px; color: var(--ink-dim); } + +.alert { + display: flex; align-items: center; gap: 10px; + margin: 14px clamp(14px, 4vw, 32px) 0; + padding: 11px 16px; + border: 1px solid color-mix(in srgb, var(--amber) 45%, var(--line)); + background: color-mix(in srgb, var(--amber) 9%, var(--panel)); + border-radius: var(--radius); + color: var(--ink); + text-decoration: none; + font-weight: 500; +} +.alert:hover { border-color: var(--amber); } + +.content { + width: min(1060px, 100%); + margin: 0 auto; + padding: 22px clamp(14px, 4vw, 32px) 60px; + display: flex; flex-direction: column; gap: 18px; +} + +.boot, .empty { + display: flex; align-items: center; justify-content: center; gap: 10px; + padding: 48px 20px; color: var(--ink-dim); text-align: center; +} + +/* ---------- login ---------- */ +.login { + min-height: 100dvh; display: grid; place-items: center; + padding: 20px; + background: + radial-gradient(800px 400px at 80% -10%, color-mix(in srgb, var(--copper) 9%, transparent), transparent), + var(--paper); +} +.login__panel { + width: min(380px, 100%); + background: var(--panel); + border: 1px solid var(--line); + border-radius: 14px; + box-shadow: var(--shadow); + padding: 30px 28px; + display: flex; flex-direction: column; gap: 14px; +} +.login__head { text-align: center; margin-bottom: 6px; } +.login__mark { width: 44px; height: 44px; margin-bottom: 10px; } +.login__mark path { fill: var(--copper); } +.login__head h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; } +.login__head p { color: var(--ink-dim); font-size: 13.5px; margin-top: 4px; } + +/* ---------- panels & bays ---------- */ +.panel { + background: var(--panel); + border: 1px solid var(--line); + border-radius: var(--radius); + box-shadow: var(--shadow); + padding: 18px 20px; +} +.panel--attention { border-color: color-mix(in srgb, var(--amber) 50%, var(--line)); } +.panel--offline { display: flex; gap: 14px; align-items: center; } +.panel--offline p { color: var(--ink-dim); font-size: 14px; } + +.panel__head { + display: flex; align-items: baseline; justify-content: space-between; gap: 12px; + margin-bottom: 12px; flex-wrap: wrap; +} +.panel__head h2 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 9px; } +.panel__meta { color: var(--ink-dim); font-size: 13px; } +.panel__inset { + margin-top: 14px; padding: 16px; + background: var(--panel-inset); + border: 1px solid var(--line); + border-radius: 8px; +} +.panel__inset h3 { font-size: 14px; margin-bottom: 10px; } + +.bays { + display: grid; gap: 18px; + grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); +} + +.bay { + background: var(--panel); + border: 1px solid var(--line); + border-radius: var(--radius); + box-shadow: var(--shadow); + padding: 18px 20px; + display: flex; flex-direction: column; gap: 10px; + border-top: 3px solid var(--copper); +} +.bay__head { display: flex; justify-content: space-between; align-items: center; } +.bay__eyebrow { + font-family: var(--font-mono); font-size: 11px; + text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-dim); +} +.bay__title { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; } +.bay__status { display: flex; align-items: center; gap: 10px; min-height: 26px; } +.bay__hint { color: var(--ink-dim); font-size: 13px; } + +.bay__telemetry { + display: flex; gap: 22px; + padding: 10px 12px; + background: var(--panel-inset); + border-radius: 8px; +} +.bay__telemetry dt { + font-family: var(--font-mono); font-size: 10.5px; + text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-dim); +} +.bay__telemetry dd { font-weight: 600; font-size: 14px; } + +.bay__actions { display: flex; align-items: center; gap: 12px; margin-top: 2px; } + +/* ---------- chips ---------- */ +.chip { + display: inline-block; + font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; + text-transform: uppercase; letter-spacing: 0.07em; + padding: 3px 9px; border-radius: 999px; + background: var(--panel-inset); color: var(--ink-dim); + border: 1px solid var(--line); +} +.chip--live, .chip--charging { background: color-mix(in srgb, var(--live) 14%, transparent); color: var(--live); border-color: color-mix(in srgb, var(--live) 40%, transparent); } +.chip--preparing, .chip--finishing { background: color-mix(in srgb, var(--amber) 14%, transparent); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 40%, transparent); } +.chip--faulted, .chip--unavailable { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); } +.chip--card { background: color-mix(in srgb, var(--copper) 13%, transparent); color: var(--copper-deep); border-color: color-mix(in srgb, var(--copper) 40%, transparent); } +.chip--app { background: color-mix(in srgb, var(--live) 12%, transparent); color: var(--live); border-color: color-mix(in srgb, var(--live) 35%, transparent); } + +/* ---------- buttons ---------- */ +.btn { + border: 1px solid transparent; + border-radius: 8px; + padding: 9px 18px; + font-weight: 600; + cursor: pointer; + background: var(--panel-inset); + transition: background 0.15s, border-color 0.15s, transform 0.05s; +} +.btn:active:not(:disabled) { transform: translateY(1px); } +.btn:disabled { opacity: 0.45; cursor: default; } +.btn--primary { background: var(--copper); color: #fff; } +.btn--primary:hover:not(:disabled) { background: var(--copper-deep); } +.btn--danger { background: var(--red); color: #fff; } +.btn--danger:hover:not(:disabled) { background: color-mix(in srgb, var(--red) 85%, black); } +.btn--ghost { background: transparent; border-color: var(--line); color: var(--ink); } +.btn--ghost:hover:not(:disabled) { background: var(--panel-inset); } +.btn--sm { padding: 5px 12px; font-size: 13.5px; } +.btn--block { width: 100%; } +.btn--dangertext { color: var(--red); } + +/* ---------- forms ---------- */ +.field { display: flex; flex-direction: column; gap: 5px; } +.field > span, .field__label { + font-family: var(--font-mono); font-size: 11px; + text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-dim); +} +.field input, .field select { + background: var(--paper); + border: 1px solid var(--line); + border-radius: 8px; + padding: 9px 12px; + width: 100%; +} +.field input:focus, .field select:focus { border-color: var(--copper); outline: none; } +.field-error { color: var(--red); font-size: 13.5px; } + +.formrow { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 12px; } + +.check { display: flex; align-items: center; gap: 9px; padding: 4px 0; cursor: pointer; } +.check input { accent-color: var(--copper); width: 16px; height: 16px; } +.check--strong { font-weight: 600; } + +.cardform { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; } +.cardform__actions { display: flex; gap: 10px; } + +.gunpicker, .matrix { display: flex; flex-direction: column; gap: 6px; } +.matrix__group { margin-top: 8px; } + +/* ---------- tables & lists ---------- */ +.table-wrap { overflow-x: auto; } +.table { width: 100%; border-collapse: collapse; font-size: 14px; } +.table th { + text-align: left; padding: 8px 10px; + font-family: var(--font-mono); font-size: 10.5px; + text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-dim); + border-bottom: 1px solid var(--line); +} +.table th.num { text-align: right; } +.table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; } +.table tr:last-child td { border-bottom: none; } + +.relay-list, .pending-list { list-style: none; padding: 0; display: flex; flex-direction: column; } +.relay { + display: flex; align-items: center; gap: 12px; + padding: 10px 2px; border-bottom: 1px solid var(--line); +} +.relay:last-child { border-bottom: none; } +.relay__label { font-weight: 600; flex: 1; min-width: 0; } +.relay__state { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-dim); } + +.pending { padding: 12px 2px; border-bottom: 1px solid var(--line); } +.pending:last-child { border-bottom: none; } +.pending__row { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; } +.pending__meta { display: block; color: var(--ink-dim); font-size: 13px; } +.pending__actions { display: flex; gap: 8px; } + +/* ---------- toasts ---------- */ +.toasts { + position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); + display: flex; flex-direction: column; gap: 8px; z-index: 50; + width: min(480px, calc(100vw - 28px)); +} +.toast { + background: var(--ink); color: var(--paper); + border-radius: 9px; padding: 11px 16px; + font-size: 14px; box-shadow: var(--shadow); +} +.toast--error { background: var(--red); color: #fff; } + +/* ---------- responsive ---------- */ +@media (max-width: 640px) { + .topbar { flex-wrap: wrap; row-gap: 6px; } + .nav { order: 3; width: 100%; } + .bay__telemetry { flex-wrap: wrap; gap: 12px 20px; } + .content { padding-top: 14px; } +} diff --git a/frontend/src/types.ts b/frontend/src/types.ts new file mode 100644 index 0000000..73da87b --- /dev/null +++ b/frontend/src/types.ts @@ -0,0 +1,89 @@ +export interface Me { + name: string; + scopes: string[]; + id_tag: string | null; +} + +export interface ActiveTx { + cp: string; + connector: number; + id_tag: string; + who: string; + method: string; + meter_start: number; + started: string; +} + +export interface ChargerMeta { + label?: string; + guns?: Record; +} + +export interface Status { + connected: Record | null>; + connectors: Record; // "cpId/connector" -> OCPP status + active_transactions: Record; + recent_auth_events: AuthEvent[]; + relays: Record; + chargers: Record; + pending_cards: number; +} + +export interface AuthEvent { + time: string; + id_tag: string; + context: string; + connector: number | null; + result: string; + known: boolean; +} + +export interface Session { + tx: number; + cp: string; + connector: number; + id_tag: string; + who: string | null; + started: string; + ended: string | null; + meter_start: number; + meter_stop: number | null; + wh: number | null; + reason: string | null; + method: string | null; +} + +export interface CardEntry { + name: string; + kind: string; + user?: string; + guns?: string[]; +} + +export interface PendingCard { + first_seen: string; + last_seen: string; + count: number; + cp: string | null; + connector: number | null; +} + +export interface DeniedCard { + rejected_at: string; + by: string; + first_seen?: string; + count?: number; +} + +export interface PermissionCatalog { + chargers: Record }>; + relays: Record; + admin_scope: string; +} + +export interface RelayState { + relay: string; + on?: boolean; + error?: string; + label?: string; +} diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json new file mode 100644 index 0000000..e8a0160 --- /dev/null +++ b/frontend/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "target": "ES2022", + "lib": ["ES2022", "DOM", "DOM.Iterable"], + "module": "ESNext", + "moduleResolution": "bundler", + "jsx": "react-jsx", + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "skipLibCheck": true, + "isolatedModules": true, + "noEmit": true, + "useDefineForClassFields": true + }, + "include": ["src"] +} diff --git a/frontend/tsconfig.tsbuildinfo b/frontend/tsconfig.tsbuildinfo new file mode 100644 index 0000000..483f449 --- /dev/null +++ b/frontend/tsconfig.tsbuildinfo @@ -0,0 +1 @@ +{"root":["./src/app.tsx","./src/api.ts","./src/main.tsx","./src/queries.ts","./src/store.ts","./src/types.ts","./src/components/lamp.tsx","./src/components/layout.tsx","./src/pages/cards.tsx","./src/pages/dashboard.tsx","./src/pages/history.tsx","./src/pages/login.tsx","./src/pages/users.tsx"],"version":"5.9.3"} \ No newline at end of file diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts new file mode 100644 index 0000000..729f880 --- /dev/null +++ b/frontend/vite.config.ts @@ -0,0 +1,13 @@ +import { defineConfig } from "vite"; +import react from "@vitejs/plugin-react"; + +// Dev: `npm run dev` serves on :5173 and proxies /api to the running backend. +// Prod: `npm run build` -> dist/, served as static files by the backend on :9000. +export default defineConfig({ + plugins: [react()], + server: { + proxy: { + "/api": "http://localhost:9000", + }, + }, +}); diff --git a/wiki/concepts/authorization.md b/wiki/concepts/authorization.md index 35ecc35..6918dad 100644 --- a/wiki/concepts/authorization.md +++ b/wiki/concepts/authorization.md @@ -10,12 +10,13 @@ The three planned ways to authorize a charging session. Architecturally they all ## 1. RFID cards — ✅ verified live (2026-07-09) -First card tapped on the real charger: idTag `1000000000000393` → Authorize → StartTransaction on gun 2 → **actual charging session started** (tx 1, meter_start 3,513.857 kWh). Enrolled as "RFID card A". Second card captured the same session: `1000000000000395` → "RFID card B". The ids are sequential — the cards ship as a numbered batch. Remaining: tap any further cards, then set `learn_mode=false` to enforce. +First card tapped on the real charger: idTag `1000000000000393` → Authorize → StartTransaction on gun 2 → **actual charging session started** (tx 1, meter_start 3,513.857 kWh). Enrolled as "RFID card A". Second card captured the same session: `1000000000000395` → "RFID card B". The ids are sequential — the cards ship as a numbered batch. > [!warning] Session restarted after remote stop (❓ verify mechanism) > ~65 s after a RemoteStop on gun 2 (cable left plugged), a **new** transaction began with the same card id. Either the owner re-tapped, or the charger auto-restarts from its authorization cache (`AuthorizationCacheEnabled=true`). Matters for app UX: "stop" may not stick while the cable stays in. Test: remote-stop and touch nothing for 5 min. -Flow for each new card: tap once in learn mode → harvest its idTag from `seen_tags.json` / `GET /api/allowlist` → add to `authorized` with a name (`kind: "card"`). +> [!warning] Superseded (2026-07-11): learn mode removed — replaced by the **pending-card review workflow** +> An unknown card is now ALWAYS refused, but lands in `pending_cards`. The admin gets a notification (banner + badge in the [[frontend|panel]]) and decides: **approve** (name it, link it to a user, optionally restrict guns — one step) or **reject** (goes to `denied_cards`, silently refused, never re-pends; un-rejectable). New-card flow: tap once on the charger → review in the panel’s Cards page. ✅ smoke-verified: unknown tap → Invalid + pending; approved card authorizes on next tap; rejected card stays silent. Since 2026-07-11 a card can be **linked to a user and restricted per gun**: @@ -64,13 +65,18 @@ The [[backend]] now has real multi-user authorization on top of the three method | `charger:eu092025:1` | start/stop/unlock gun 1 | | `charger:eu092025:2` | same for gun 2 | | `relay:` / `relay:*` | switch those relays (others are invisible to the user) | - | `admin` | everything, incl. allowlist/user CRUD, learn-mode flip, setconfig, events | + | `admin` | everything, incl. cards (pending review, allowlist), user CRUD, relay/charger registry, setconfig, events | - **Bootstrap**: zero users = open API (startup warns loudly). First user: `venv\Scripts\python -m backend.users add --scopes admin`. -- ✅ Verified by the 45-check smoke test (login, wrong password, cookie + bearer, per-scope 403s, relay visibility filtering, user CRUD, session invalidation on delete). ⚠️ Not yet exercised from a real phone browser. +- Admins grant permissions in the panel’s Users page as a **checkbox matrix** (per gun, per relay, admin) rendered from `GET /api/permissions` — nobody types raw scope strings. +- ✅ Verified by the 54-check smoke test (login, wrong password, cookie + bearer, per-scope 403s, relay visibility filtering, user CRUD, session invalidation on delete). ⚠️ Not yet exercised from a real phone browser. This resolves the ❓ "web app auth" open decision in [[overview]]: username+password with per-resource scopes, chosen over plain tokens by the owner. +## Audit: who charged, and how + +Every session row records the **method**: `card` (physical RFID tap) or `app` (in-app button press), derived from the allowlist entry’s kind at StartTransaction, plus the resolved **who** (card owner / username). The panel’s History tab shows Who · Via · Gun · When · Duration · kWh. (2026-07-11, owner requirement.) + ## Facts from the live probe that shape this design Per [[2026-07-09-discovery-eu092025]]: `AuthorizeRemoteTxRequests=false`, so remote starts don't trigger a separate Authorize — the `decide()` gate fires when the charger sends `StartTransaction`. The on-charger offline allowlist (`LocalAuthList`) holds max **6 idTags** and is currently disabled; enough for a household if we ever want tap-to-charge to survive CSMS downtime. diff --git a/wiki/entities/backend.md b/wiki/entities/backend.md index 95b4c0e..1f30615 100644 --- a/wiki/entities/backend.md +++ b/wiki/entities/backend.md @@ -17,8 +17,7 @@ backend/ (run: venv\Scripts\python -m backend.main, from the repo root) ├── users.py passwords (PBKDF2), sessions (HMAC), scope matcher, user CLI ├── store.py SQLite session store: who charged, when, how many kWh + meter samples ├── config.py app-state sections (users/allowlist/relays/chargers), db-backed -├── journal.py events.jsonl + seen_tags.json (raw ground truth) -├── static/ the web panel PWA (index.html, manifest, service worker, icon) +├── journal.py events.jsonl (raw ground truth) └── backend.db THE one store (SQLite, gitignored): sessions + samples + settings (users, allowlist, relays, chargers, session secret) ``` @@ -26,32 +25,35 @@ backend/ (run: venv\Scripts\python -m backend.main, from the repo root) ## Surfaces (all on :9000 — the touchscreen URL never changes) - `ws://:9000/` — OCPP WebSocket (catch-all path, the JC-6620 dials in) -- `GET /` — **the web panel** (mobile-first PWA, vanilla JS, self-contained; login → tabs Control / History / Admin, buttons filtered by the user's scopes; polls `/api/status` every 5 s) +- `GET /` — **the [[frontend|React panel]]** served from `../frontend/dist/` with SPA fallback (deep links land on index.html; `/api/*` + `/docs` excluded; 503 with instructions if not built) - `POST /api/login|logout`, `GET /api/me` — username/password → 30-day session (cookie + bearer) - `GET /api/sessions?limit&cp&connector` — **charging history: who / when / kWh** (visibility: own sessions + guns within scope; admin sees all); `GET /api/sessions/{tx}/samples` — per-minute energy/power/SoC for charts -- `GET /api/status` — mode, connected chargers, gun states, active transactions, auth events, relays (filtered to what the caller may control) +- `GET /api/status` — connected chargers, gun states, active transactions, auth events + pending-card count (admin), relays (filtered to what the caller may control) - `GET /api/events?limit&event=` — tail the journal (admin) - `POST /api/charger/start|stop[/{tx}]|unlock/{n}` — gun-scoped; `trigger/{...}|setconfig|probe` — admin -- `GET/PUT/DELETE /api/allowlist[/{idTag}]` + `POST /api/mode?learn=` — admin; **learn mode flips at runtime, no restart** +- `GET/PUT/DELETE /api/allowlist[/{idTag}]` — enrolled cards/tokens (admin) +- `GET /api/cards/pending` + `POST /api/cards/pending/{id}/approve|reject`, `GET/DELETE /api/cards/denied[/{id}]` — the **unknown-card review workflow** (admin); pending count rides `/api/status` as the notification signal +- `GET /api/permissions` — the grantable-permission catalog (chargers/guns/relays) that drives the panel's checkbox matrix (admin) - `GET/PUT/DELETE /api/users[/{name}]` — user CRUD (admin), enables a PWA admin page later - `GET /api/relays[?live=true]`, `GET /api/relays/{name}`, `POST /api/relays/{name}/on|off|toggle` — relay-scoped - `/docs` — interactive OpenAPI docs ## Design facts -- Carried over from the proven discovery code: the `decide()` gate ([[authorization]]) — now with card→user linking (`"user"`) and charger-qualified gun restriction (`"guns": ["eu092025:2"]`, fnmatch) — the `_WSAdapter` WebSocket bridge, learn mode, the JSONL event journal. `DataTransfer` frames are journaled too (the VIN long-shot lead in [[authorization]]). +- Carried over from the proven discovery code: the `decide()` gate ([[authorization]]) — now with card→user linking (`"user"`) and charger-qualified gun restriction (`"guns": ["eu092025:2"]`, fnmatch) — the `_WSAdapter` WebSocket bridge, and the JSONL event journal. `DataTransfer` frames are journaled too (the VIN long-shot lead in [[authorization]]). - **Multi-charger by design**: a second charger only needs the same URL with a unique ChargerID; scopes, sessions, card restrictions, and the panel are all keyed by charger id. Gun display names come from the `"chargers"` config section (not hardcoded). - **Multi-user auth** (2026-07-11, replaced the interim `api_token`): username/password users with permission scopes — `charger::`, `relay:`, `admin` — full model in [[authorization]]. Stdlib crypto only (PBKDF2 + HMAC sessions). Zero users = open API (startup warns); bootstrap via `python -m backend.users add --scopes admin`. - Remote starts run under the calling user's own idTag (`app-`, auto-enrolled) → per-person session attribution. - **Consumption tracking** (`store.py`, 2026-07-11): every `StartTransaction` opens a row in `backend.db` with a resolved "who" (allowlist name or username); `StopTransaction` closes it and computes Wh from the meter diff; `MeterValues` rows land in a `samples` table (energy/power/SoC, kW→W normalized). Transaction ids continue from `MAX(tx)` across restarts, and stop-by-tx falls back to the store so sessions running through a backend restart stay stoppable. - Relay calls are blocking tinytuya I/O, run via `asyncio.to_thread` so the OCPP socket never stalls. - Venv at repo root (`../venv/`, Python 3.13); deps pinned in `backend/requirements.txt` (fastapi, uvicorn, websockets, ocpp, tinytuya) — the auth system added none. -- ✅ Smoke-tested 2026-07-11 (45 checks, isolated temp db via the `BACKEND_DB` env override): REST surface, allowlist CRUD incl. gun-restricted cards, login/sessions/scopes, user/relay/charger CRUD, the full consumption pipeline (start → meter sample → stop → kWh → visibility filtering), static panel serving, and a fake charge point over the real WS route. +- Sessions record the **auth method** (`card` vs `app`) for the audit trail; unknown cards NEVER charge — they queue in `pending_cards` for admin approve/reject (learn mode is gone). +- ✅ Smoke-tested 2026-07-11 (54 checks, isolated temp db via the `BACKEND_DB` env override): REST surface, allowlist CRUD incl. gun-restricted cards, login/sessions/scopes, user/relay/charger CRUD, the full consumption pipeline (start → meter sample → stop → kWh → visibility filtering), static panel serving, and a fake charge point over the real WS route. - ✅ **Live charger connected** (2026-07-11 evening): `eu092025` dials the backend (events.jsonl). ⚠️ Panel not yet exercised from a real phone; relays unconfigured until the [[wifi-relays|key extraction]] is done. -## Web panel notes +## Web panel -Vanilla JS on purpose (no framework, no CDN — the panel must work with NetBird-only reachability). Start button enables only when the gun reports `Preparing`/`Available` **and** the user holds that gun's scope. Gun cards show who is charging and since when; History tab lists who/when/kWh; Admin tab (admin scope only) manages allowlist (incl. per-gun cards + "seen but not enrolled" quick-enroll), users, and the learn/enforce toggle. Trivial service worker = installable ("add to home screen") without cache-staleness risk. +See [[frontend]] — React/Vite app, built to `frontend/dist/` and served by this process. ## Deliberately deferred diff --git a/wiki/entities/frontend.md b/wiki/entities/frontend.md new file mode 100644 index 0000000..7f8dea1 --- /dev/null +++ b/wiki/entities/frontend.md @@ -0,0 +1,30 @@ +--- +type: entity +updated: 2026-07-11 +tags: [software, frontend, react] +--- + +# 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 dev` in `frontend/` → Vite on `:5173`, **proxies `/api` to 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 gets `index.html`, `/api/*` and `/docs` excluded). 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|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. diff --git a/wiki/index.md b/wiki/index.md index 6cbc1ee..afc591f 100644 --- a/wiki/index.md +++ b/wiki/index.md @@ -16,7 +16,8 @@ Catalog of every wiki page. Updated on every ingest. (Schema/conventions live in - [[anfu-charger]] — the charging pile: its three internal devices + working touchscreen config - [[jc-6620]] — the OCPP communication controller / client; its IPs and shipped-gateway gotcha -- [[backend]] — the production backend in `../backend/`: CSMS + REST API + relay control + user auth + consumption store + web panel, all on :9000 +- [[backend]] — the production backend in `../backend/`: CSMS + REST API + relay control + user auth + consumption store, all on :9000 +- [[frontend]] — the React control panel in `../frontend/`: Vite/TS, React Router, zustand, TanStack Query; served by the backend - [[csms-toolkit]] — the Python CSMS scripts in `../discovering/`; discovery/diagnostic tooling (production role superseded by [[backend]]) - [[wifi-relays]] — the Tuya/SmartLife WiFi relays; local tinytuya control path + key-extraction steps - [[netbird]] — the private overlay network; security boundary for the future web panel diff --git a/wiki/log.md b/wiki/log.md index 1fc45b6..8647061 100644 --- a/wiki/log.md +++ b/wiki/log.md @@ -79,3 +79,7 @@ Owner requirements: cards must belong to a person (not float around as "RFID car ## [2026-07-11] meta | config.json eliminated — one SQLite store (backend.db) Owner pushback: two persistence stores (sessions.db + a config.json that doubled as a mutable datastore) was one too many, with confusing hand-edit-needs-restart semantics. Now everything lives in backend.db (renamed from sessions.db): sessions + samples tables plus a settings table holding the app-state sections (users, allowlist, relays, chargers, learn_mode, session_secret) as JSON blobs. All changes go through the API/panel and apply immediately; nothing to hand-edit. Legacy config.json auto-imports on first start (kept as config.json.migrated) — julian + cards + charger labels migrated. New admin endpoints PUT/DELETE /api/relays/{name} and PUT /api/chargers/{id} replace file editing (tinytuya wizard results now enter via /docs). Smoke test isolated via BACKEND_DB env override; 45 checks. Also: live cutover confirmed — eu092025 connected to the backend this evening. Updated [[backend]], [[authorization]], [[wifi-relays]], [[overview]]. + +## [2026-07-11] meta | React frontend; pending-card review workflow; auth-method audit + +Owner: full frontend revision (React + routing + zustand + TanStack Query, Vite proxy in dev, static build served by backend, professional look) and backend fixes: permissions must be understandable, cards must connect to users, unknown card taps must notify the admin for approve/reject, and sessions must audit HOW authorization happened. Backend: learn mode REMOVED -> pending_cards/denied_cards workflow (unknown taps always refused, queued for review; pending count on /api/status as notification); sessions.method column (card|app); GET /api/permissions catalog. Frontend: new ../frontend/ (React 19, instrument-panel design, copper accent, indicator-lamp signature, bundled fonts); pages Control/History/Cards/Users; permission checkbox matrix; approve-with-owner-link in one step. Old backend/static vanilla panel deleted; seen_tags.json gone. Smoke: 54 checks. Created [[frontend]]; updated [[backend]], [[authorization]], [[overview]], [[architecture-plan]], [[index]], root CLAUDE.md. diff --git a/wiki/notes/architecture-plan.md b/wiki/notes/architecture-plan.md index 35ea312..8873006 100644 --- a/wiki/notes/architecture-plan.md +++ b/wiki/notes/architecture-plan.md @@ -30,6 +30,8 @@ FastAPI app (uvicorn, :9000, on the always-on host) **Web frontend: mobile-first PWA, no build pipeline — decided.** Plain HTML/JS (Alpine.js or htmx + SSE), served by FastAPI. Features: status card, start/stop, allowlist management, session history. PWA manifest → "add to home screen". Reached only over [[netbird|NetBird]]. +> [!warning] Superseded (2026-07-11): owner opted for a real build pipeline after seeing v1 — React/Vite stack, see [[frontend]]. "Served by FastAPI on :9000" and "NetBird-only" still hold. + **Flutter mobile app: phase 2, optional.** The PWA covers ~95% of the value. Flutter earns its keep only for push notifications ("charging complete") or as a learning project. It would consume the same REST API (FastAPI's OpenAPI spec → typed Dart client codegen), so nothing built now is wasted. Phone needs the NetBird client either way. @@ -39,7 +41,7 @@ The PWA covers ~95% of the value. Flutter earns its keep only for push notificat 1. **Productionize the CSMS** — ✅ done 2026-07-11 as the [[backend]] package (`../backend/`); SQLite session store added same day (JSONL journal stays as raw ground truth). 2. **REST API** — ✅ done 2026-07-11: status, remote start/stop, allowlist CRUD, runtime learn-mode flip, **relay on/off/toggle**, multi-user login with permission scopes, **session history (who/when/kWh)**. ⚠️ Relay half awaits the [[wifi-relays|local-key extraction]]. -3. **Web panel (PWA)** — ✅ built 2026-07-11 (`backend/static/`, vanilla JS instead of Alpine — zero dependencies): login, per-gun status + start/stop gated by scopes and gun readiness, relay toggles, consumption history, admin tab. ⚠️ Untested on a real phone. +3. **Web panel** — ✅ built 2026-07-11, then **rebuilt the same day as a React app at the owner's request** ([[frontend]]: Vite + TS + React Router + zustand + TanStack Query; dev proxy to :9000, prod build served by the backend). The interim vanilla-JS panel is gone. ⚠️ Untested on a real phone. 4. **Deploy** — pick the always-on host (❓ open, [[overview]]), run as a service (systemd or NSSM on Windows), static IP / DHCP reservation, firewall rule for :9000, joined to NetBird. 5. **Hardware tasks** — RFID enrollment via learn mode; the Autocharge plug-in test ([[authorization]]) to settle "by vehicle". 6. **(Optional) Flutter app** — consumes the same API; adds push notifications. diff --git a/wiki/overview.md b/wiki/overview.md index 910d7ea..a498067 100644 --- a/wiki/overview.md +++ b/wiki/overview.md @@ -12,7 +12,7 @@ tags: [synthesis] **Connectivity: ✅ solved.** The [[jc-6620|JC-6620]] controller inside the [[anfu-charger|charging pile]] reliably dials out to the CSMS — verified both on the charger's own LAN (`192.168.2.114:9000`) and across the NAT boundary on the WAN subnet (`10.0.10.203:9000`). Getting here required the fixes catalogued in [[troubleshooting]]; the network layout is in [[network-topology]]. -**Software: production [[backend]] built (2026-07-11), including the web panel.** `station.py` was ported into the `../backend/` package: one FastAPI process on port 9000 = CSMS WebSocket + `/api/*` (charger control, allowlist CRUD, runtime learn-mode flip) + [[wifi-relays|Tuya relay]] on/off/toggle + **multi-user auth** (username/password, per-resource scopes: gun 1 / gun 2 / per-relay / admin, per-gun-restrictable RFID cards — [[authorization]]) + **consumption tracking** (SQLite: who charged, when, how many kWh, per-minute meter samples) + the **PWA control panel** at `/` (login, scope-filtered start/stop buttons, relay toggles, history, admin). Smoke-tested (45 checks incl. a fake charge point over the real WS route); ✅ live charger connects to it since 2026-07-11 evening; ⚠️ panel untested from a real phone. All state lives in one SQLite file (`backend.db`) — no config file, every change via API/panel takes effect immediately. The [[csms-toolkit]] (`../discovering/`) remains as diagnostic tooling. +**Software: production [[backend]] built (2026-07-11), including the web panel.** `station.py` was ported into the `../backend/` package: one FastAPI process on port 9000 = CSMS WebSocket + `/api/*` (charger control, allowlist CRUD, runtime learn-mode flip) + [[wifi-relays|Tuya relay]] on/off/toggle + **multi-user auth** (username/password, per-resource scopes: gun 1 / gun 2 / per-relay / admin, per-gun-restrictable RFID cards — [[authorization]]) + **consumption tracking** (SQLite: who charged, when, how many kWh, per-minute meter samples) + the **PWA control panel** at `/` (login, scope-filtered start/stop buttons, relay toggles, history, admin). Smoke-tested (54 checks incl. a fake charge point over the real WS route); ✅ live charger connects to it since 2026-07-11 evening; ⚠️ panel untested from a real phone. All state lives in one SQLite file (`backend.db`) — no config file, every change via API/panel takes effect immediately. **Late 2026-07-11:** learn mode replaced by the **pending-card review workflow** (unknown taps refused + queued for admin approve/reject), sessions audit the **auth method** (card vs in-app), and the panel was rebuilt as a **React app** ([[frontend]]). The [[csms-toolkit]] (`../discovering/`) remains as diagnostic tooling. **Capabilities: ✅ known.** The live probe ([[2026-07-09-discovery-eu092025]]) identified the pile as SimpleCharge "MultiSocketCharger" (fw 1.24.0620.1, OCPP ID `eu092025`) with **two guns**, RemoteTrigger (verified), SmartCharging, Reservation, a 6-entry local auth list, and per-minute meter data including SoC. Only Autocharge remains unknown (physical test pending; `MacEnabled` is a lead — [[authorization]]). @@ -28,8 +28,8 @@ Hardware surprise: this is a **DC-capable multi-standard charger** (gun 1 EU, gu 1. ~~Cut the live charger over to the backend~~ — ✅ done 2026-07-11 evening: `eu092025` connects to `python -m backend.main` (verified in events.jsonl). Remaining: a card tap + a panel button-push on the live charger. 2. **Create the real users** — `python -m backend.users add --scopes ...` for each household member (the API stays open until the first user exists). 3. **Extract the Tuya local keys** (`tinytuya wizard` — steps in [[wifi-relays]]) and register them via `PUT /api/relays/` → relays become controllable. -4. **Flip learn mode off** — both cards + the app token are enrolled; switchable from the panel's Admin tab or `POST /api/mode?learn=false`, no restart. (Only wait if more cards need tapping.) -5. **Test the panel from a phone** — it's built and serving at `http://:9000/`; verify login, a real button-push start on a ready gun, and add-to-home-screen over [[netbird|NetBird]]. +4. **Restart the backend once** to pick up the React panel + pending-card workflow (state changes never need restarts; code updates do). +5. **Test the panel from a phone** — `http://:9000/`; verify login, a real button-push start on a ready gun, the pending-card banner (tap an unenrolled card), and add-to-home-screen over [[netbird|NetBird]]. 6. **Resolve the ❓ remote-stop restart question** — did the gun-2 session auto-restart from auth cache after RemoteStop, or was the card re-tapped? Affects the app's Stop button UX ([[authorization]]). ## Open decisions ❓