Files
dawnline/rules/frontend.md
T
Aemeath 29b1d7dfd7
Build packages / Version (push) Waiting to run
Dawnline 0.4.2
- Connections show up at once: the agent looks at the tunnels every
  second and, the moment a device connects or roams, writes it to the
  activity log, updates traffic and the map, and locates the new address
- A device counts as gone when its WireGuard session expires (1-3 min
  after it leaves), so a phone asleep no longer flaps between
  disconnect and connect
- The admin pages follow along within seconds: Overview, People, the
  person page and the device panel refresh when something happens, with
  a light check every 2 s instead of reloading everything every 10 s
- The personal portal no longer refreshes itself in the background:
  every request costs the router a CGI process, so it loads once and
  after the visitor's own changes
- Agent guidance and code standards (backend, frontend, shell, UI) now
  live in the repository: AGENTS.md and rules/
2026-10-16 03:52:21 +03:00

1.7 KiB

Frontend (TypeScript: admin UI and portal)

Read with code-standards.md and, for anything visible, ui-design.md.

Code

  • Strict TS, no any without a comment; types for RPC answers live in shared/types.ts / admin/api.ts and mirror the backend's shapes.
  • Layout of web/src/admin: ui/ generic components (button, menu, modal, drawer, tooltip, toast, controls), widgets/ composite house widgets, state/ polling and scoping, events/ the activity vocabulary (model without DOM, render separate), updater/ the Components data layer, cores/ per-protocol bits, pages/<page>/ one folder per page split by section, styles/*.css one file per feature joined in styles/index.ts. Shared with the portal: src/shared/.
  • Pages build from ui/ and widgets/; a page never defines a generic component. Logic that does not touch the DOM (formatting, models, CSV, sorting) lives outside the render code and gets tests.

Live data

  • Admin pages use createPoller (state/poller.ts): newest answer wins, no repaint of a region that holds focus, every RPC failure shows a toast or an inline error, never a blank section.
  • Changes reach open pages through the revision (state/live.ts): one small rev call every 2 s while the page is visible; pollers that opt in (live: true) refresh when it moves. Their own every stays as a slow fallback.
  • The portal does not poll (each request is a CGI process on the router, see backend.md): it loads once, after the visitor's own changes, and while it waits for a new device's first connection.

Checks

  • In web/: npm run format:check, npm run typecheck, npm test, npm run build; the rebuilt bundles under package/ are committed (CI fails otherwise).