Commit d7e1887
committed
feat(dashboard): tenant self-service branding editor
The backend already exposes current-tenant theme endpoints
(GET/PUT /api/v1/tenants/theme, POST .../theme/reset) gated on
Tenants.ViewTheme (IsBasic) + Tenants.UpdateTheme (tenant-assignable, not
root-only) — so a tenant admin is meant to manage their own branding — but the
only UI lived in the admin app, targeting other tenants via the `tenant:`
header override. The dashboard had no way for a tenant to edit its own brand.
Adds a Settings > Branding tab (dashboard) for the current tenant:
- New api/tenants.ts: getTenantTheme/updateTenantTheme/resetTenantTheme for the
signed-in tenant (no `tenant:` header — the server resolves it from the token).
Types + default palettes mirror the admin client (the two Vite apps duplicate
by design; no cross-app import).
- New pages/settings/branding.tsx: light + dark palette editors (swatch + hex,
validated), brand-asset URL editors with inline preview, a live theme preview,
and save/reset with a dirty indicator. Ported from the admin branding card,
adapted to the current tenant and the dashboard's design language.
- settings-layout.tsx: the Branding tab renders only for holders of
Tenants.UpdateTheme, mirroring the sidebar permission gate in nav-data.ts.
- routes.tsx: lazy /settings/branding route.
- Playwright coverage (route-mocked): renders + saves via PUT, reset via POST,
tab hidden without the permission, PUT 403 keeps the draft, GET 500 shows an
error band.
Scope matches the admin card's v1: palette + brand assets (typography/layout on
the DTO are intentionally omitted).1 parent 71a1c47 commit d7e1887
5 files changed
Lines changed: 747 additions & 4 deletions
File tree
- clients/dashboard
- src
- api
- pages/settings
- tests/settings
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
0 commit comments