diff --git a/CLAUDE.md b/CLAUDE.md index 32b993f..182bcab 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -7,13 +7,24 @@ A distributed smart home system with three layers: - **ESP8266/ESP32 firmware** (`devices/`) — IoT devices exposing a REST API - **PHP server** (`server/`) — central backend that manages devices, events, and automation scripts -- **Web client** (`webclient/`) — JavaScript/SCSS frontend bundled with Gulp/esbuild +- **Vue web client** (`webclient-vue/`) — Vue 3 + Pinia + Vite frontend using `gnexus-ui-kit` +- **Legacy web client** (`webclient/`) — old vanilla JS frontend (kept as fallback) --- ## Build & Dev Commands -### Web Client +### Vue Web Client (webclient-vue/) +```bash +cd webclient-vue +npm install # install dependencies (Vue 3, Pinia, Vite, gnexus-ui-kit, Phosphor icons) +npm run dev # starts Vite dev server with proxy to PHP backend +npm run build # production build → dist/ +npm test # runs Vitest unit/component/integration tests +npm run test:coverage # tests with coverage report +``` + +### Legacy Web Client (webclient/) ```bash cd webclient npm install # install dependencies (esbuild, sass, gulp, browser-sync, etc.) @@ -60,7 +71,22 @@ ### Automation Scripts PHP classes in `server/ControlScripts/Scopes/`, extending `ControlScripts` base class. Each Scope class implements four methods: `register_sync_map`, `register_events_handlers`, `register_actions_scripts`, `register_regular_scripts`. All Scopes are auto-loaded at startup. See `docs/control-scripts-guide.md`. -### Web Client Structure +### Vue Web Client Structure (webclient-vue/) +- `src/app/main.js` — Vue app entry (createApp + Pinia + router) +- `src/router/routes.js` — hash-router routes +- `src/api/` — HTTP client: `client.js`, `http.js`, `mappers.js`, `modules/{areas,devices,scripts,scanning}.js` +- `src/stores/` — Pinia stores: `areas.js`, `devices.js`, `scripts.js`, `scanning.js`, `favorites.js` +- `src/components/` — thin UI adapters (`AppShell`, `AppEmptyState`, `AppErrorState`, `AppLoadingState`) +- `src/features/{areas,devices,scripts}/pages/` — page components using `gnexus-ui-kit` components +- `src/test/mocks/handlers.js` — MSW mock handlers for integration tests +- `vitest.setup.js` — test setup (jsdom, localStorage mock, router stubs, MSW server) + +### Styling Rules (Vue Client) +- **Always use `gnexus-ui-kit` semantic color classes** (`.text-success`, `.text-danger`, `.bg-primary`, `.badge-warning`, etc.) instead of project-specific CSS custom properties (`--color-accent`, `--color-danger`). +- The kit does not expose CSS variables, so prefer composing with its utility classes or `currentColor` rather than hard-coding hex values. +- This keeps the UI consistent with the design system and avoids drift when the kit's palette evolves. + +### Legacy Web Client Structure (webclient/) - `webclient/src/js/index.js` — app entry point - `webclient/src/js/sh/SmartHomeApi.js` — all server API calls - `webclient/src/js/components/` — UI components (hud, modals, toasts, etc.) @@ -85,10 +111,14 @@ | `server/SHServ/Controllers/` | Request handler logic | | `server/SHServ/Models/` | DB query layer | | `server/console.php` | CLI entry point for server-side scripts | -| `webclient/src/js/sh/SmartHomeApi.js` | JS API client (the contract between frontend and backend) | +| `webclient/src/js/sh/SmartHomeApi.js` | Legacy JS API client | +| `webclient-vue/src/api/client.js` | Vue API client wrapper | +| `webclient-vue/src/app/main.js` | Vue app entry point | | `devices/sh_core_esp8266/src/sh_core.h` | EEPROM layout and all device-side constants | | `docs/device-spec.md` | Device REST API contract (endpoints on the device itself) | | `docs/server-api.md` | **Server REST API** — full reference of all implemented endpoints | | `docs/architecture.md` | Full architecture: firmware contract, events routing, sync map, Fury framework | | `docs/firmware-dev-guide.md` | How to write firmware for a new device type | | `docs/control-scripts-guide.md` | How to write automation scripts (Scope classes) | +| `webclient-vue/docs/migration-plan.md` | Vue client migration plan (Phases 1–6) | +| `webclient-vue/docs/smoke-checklist.md` | UI smoke checklist for releases | diff --git a/webclient-vue/src/components/device/DeviceTable.vue b/webclient-vue/src/components/device/DeviceTable.vue index 2ff6b44..8213308 100644 --- a/webclient-vue/src/components/device/DeviceTable.vue +++ b/webclient-vue/src/components/device/DeviceTable.vue @@ -14,7 +14,14 @@
{{ jsonPreview }}
+
+