Files
krowworkforce_controltower/README.md
2026-08-17 23:45:32 +05:30

55 lines
2.4 KiB
Markdown

# KROW Workforce Control Tower
A standalone frontend application. There is no backend, no external API and no
login: the app opens directly into the Control Tower UI, locally and when
deployed, and keeps working with no network at all.
```
Frontend → local data / React state / localStorage → KROW UI
```
## Running it
```bash
npm install
npm run dev # http://localhost:5174
npm run build # static bundle in dist/
npm run preview # serve the production build locally
```
Deployment is a static-file deploy: serve `dist/` with any web server, with a
SPA fallback so deep links (`/Events`, `/Schedule`, …) resolve to `index.html`.
The included `Dockerfile` + `nginx.conf` do exactly that.
## Where the data lives
Everything the UI reads and writes goes through one object — `krow`, exported
from [`src/api/client.js`](src/api/client.js):
| Area | Local implementation |
| --- | --- |
| `krow.entities.*` | [`src/api/local/store.js`](src/api/local/store.js) — collections held in memory and mirrored into `localStorage` |
| Starting data | [`src/api/local/seedData.js`](src/api/local/seedData.js) — the bundled demo dataset, copied in on first read |
| Data model | [`src/api/local/schemas.json`](src/api/local/schemas.json) — entity schemas, loaded on demand for `.schema()` |
| `krow.auth` | [`src/api/local/auth.js`](src/api/local/auth.js) — a single local operator profile; no sign-in |
| `krow.integrations.Core` | [`src/api/local/integrations.js`](src/api/local/integrations.js) — uploads become local data/object URLs; email/SMS are recorded locally |
| `krow.agents` | [`src/api/local/agents.js`](src/api/local/agents.js) — assistant threads stored locally, answered by [`src/lib/owliver/owliverEngine.js`](src/lib/owliver/owliverEngine.js) |
Edits persist per browser. `krow.resetLocalData()` (from the console, or any
code) clears local data and restores the bundled demo dataset.
Collections with no seed data start empty, which is the empty state the pages
already render — so adding an entity needs no wiring, only a key in
`seedData.js` if it should start with rows.
## Layout
```
src/
api/ the local client (client.js) and its implementation (local/)
pages/ one file per route, auto-registered via pages.config.js
components/ feature components and the ui/ primitives
lib/ shared helpers, the Owliver engine and page registry
Layout.jsx the Control Tower shell: header, sidebar, Owliver
```