Skip to content

feat(dashboard): tenant self-service branding editor#1329

Open
marcelo-maciel wants to merge 1 commit into
fullstackhero:mainfrom
marcelo-maciel:feat/dashboard-tenant-branding
Open

feat(dashboard): tenant self-service branding editor#1329
marcelo-maciel wants to merge 1 commit into
fullstackhero:mainfrom
marcelo-maciel:feat/dashboard-tenant-branding

Conversation

@marcelo-maciel

Copy link
Copy Markdown
Contributor

Problem

The backend already exposes current-tenant theme endpoints — GET/PUT /api/v1/tenants/theme, POST .../theme/reset — gated on Tenants.ViewTheme (IsBasic) and Tenants.UpdateTheme (a tenant-assignable permission, not IsRoot). In other words a tenant admin is meant to manage their own branding. But the only UI for it lives in the admin app, which targets other tenants via the tenant: header override (root-only). The dashboard (tenant app) had no way for a tenant to edit its own brand — the existing Settings › Appearance tab is per-user local preference (mode/accent/font), a different scope from the tenant-wide theme served on sign-in.

This closes that gap: a front-end-only feature that exposes an already-shipped backend capability.

What

A Settings › Branding tab in the dashboard, for the current tenant:

  • api/tenants.ts (new) — getTenantTheme / updateTenantTheme / resetTenantTheme scoped to 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).
  • pages/settings/branding.tsx (new) — light + dark palette editors (colour swatch + validated hex), 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 (route-mocked, dashboard convention) — 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 (the typography/layout fields on the DTO are intentionally omitted).

Verification

tsc -b 0 errors · eslint 0 errors · Playwright 5/5 (clients/dashboard).

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).
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant