feat(dashboard): tenant self-service branding editor#1329
Open
marcelo-maciel wants to merge 1 commit into
Open
feat(dashboard): tenant self-service branding editor#1329marcelo-maciel wants to merge 1 commit into
marcelo-maciel wants to merge 1 commit into
Conversation
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).
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The backend already exposes current-tenant theme endpoints —
GET/PUT /api/v1/tenants/theme,POST .../theme/reset— gated onTenants.ViewTheme(IsBasic) andTenants.UpdateTheme(a tenant-assignable permission, notIsRoot). 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 thetenant:header override (root-only). The dashboard (tenant app) had no way for a tenant to edit its own brand — the existingSettings › Appearancetab 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 › Brandingtab in the dashboard, for the current tenant:api/tenants.ts(new) —getTenantTheme/updateTenantTheme/resetTenantThemescoped to the signed-in tenant (notenant: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 ofTenants.UpdateTheme, mirroring the sidebar permission gate innav-data.ts.routes.tsx— lazy/settings/brandingroute.Scope matches the admin card's v1: palette + brand assets (the typography/layout fields on the DTO are intentionally omitted).
Verification
tsc -b0 errors ·eslint0 errors · Playwright 5/5 (clients/dashboard).