Repository navigation
feat(brands): open the workspace's settings from the brand pages - #1341
Conversation
… brand switcher From the user's request: - The sidebar's Brands item is gone. Its group only held that item, so the menu now starts at Execution. - In the brand switcher's list, "Show My All Brands" (the brands page) sits above "Add Brand", which now opens the new-brand page directly. - A settings icon beside the selected brand opens that brand's settings, with a "Visit Brand Setting" tooltip. It is a sibling of the switcher's trigger, so the name and the chevron still open the menu. It is hidden in the collapsed sidebar, where only the logo fits. - The mobile menu had no brand switcher, and the Brands item was its only way to the brands page. It now has the switcher at the top. - getDashboardNavLabel loses the brands namespace, which only Brands used. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Arrows beside the brand's name list the brands; picking another opens the same page of that brand (its settings, from the settings) and makes it the brand the app shows. The sidebar switcher keeps the brand page too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A Workspace Settings menu at the top right of the brands page and a brand's page opens Account, Organization, Team and Billing (cloud only) at their own addresses. Admins and managers only. The headers wrap on a phone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
gkhngyk
left a comment
There was a problem hiding this comment.
Looks good. One small follow-up:
-
"Add Brand" beside it isn't role-gated.
web/src/app/[locale]/(dashboard)/dashboard/brands/page.tsx:28Workspace Settings is hidden from analysts and agency partners. The Add Brand button next to it still shows to them, and RLS refuses the insert (
brands: admin/manager insert). Please give it the samecanManagegate as the switcher's item in #1339. The page is a server component, so either readprofiles.rolethere or move the button into a small client component.
The rest checks out against the server:
- Organization: edit is admin-only in the UI and in RLS (
organizations: admin update). - Team: admin-only in the UI and in the server actions.
- Billing: shown only where the settings page has it.
The canManage gate matches the request and has tests for each role. Stacked on #1340 and #1339, so it should merge after them.
The settings icon puts a brand's settings one click from every page, so its writes now follow the server's rules: General, Domains and Competitors are a disabled fieldset for anyone but admins and managers (brands and brand_domains update, competitors writes), and Danger's delete for anyone but admins, each with a read-only note. The switcher's Add Brand, and its empty state, show only to admins and managers (brands: admin/manager insert), so no one lands in a wizard that fails on its first step. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-switch # Conflicts: # web/src/components/layout/brand-switcher.test.tsx
…only Workspace Settings beside it was already hidden from analysts and agency partners; Add Brand (and the plan limit's upgrade button) now follows, read from the profile's role on the server, as does the empty state's button. brands: admin/manager insert would refuse the others on the wizard's first step. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@gkhngyk Your follow-up is in |
gkhngyk
left a comment
There was a problem hiding this comment.
Looks good. Add Brand is gated as asked:
brands/page.tsx:54-60reads the signed-in user's ownprofiles.role, so.single()is safe. The page hides both Add Brand and the plan-limit upgrade button from anyone who isn't an admin or manager.- The empty state's button (
_brands-client.tsx:48) followsuseUserRole().canManage. brands/page.test.tsxcovers each role and the upgrade case.
Two small follow-ups, neither blocking:
- The empty state's gate in
_brands-client.tsx:48has no test. One case besidepage.test.tsx's would cover it. components/providers/brand-guard.tsx:84, the dashboard's no-brands state, still shows "Create Brand" to every role. That code is already on main, but it is the last Add Brand entry point without the gate.
This PR is stacked on #1340 and #1339, so merge it after them.
Tested on top of main together with #1339–#1341, #1352 and #1337: web and server tests, tsc, lint and Prettier pass.
Summary
From the user: the brands page and a brand's page should have a "Workspace Settings" button at the top right, opening Account, Organization, Team and Billing. Each should open its settings section. Admins and managers only.
/dashboard/brands, just left of "Add Brand";/dashboard/brands/<id>/…), right side. The header is shared, so it shows on Topics, Prompts and Settings./dashboard/settings/<section>(e.g./dashboard/settings/team).useUserRole().canManage). Analysts and agency partners don't see the button at all;hasSettingsSection: Ansvisor Cloud), so self-host lists three.flex-wrap), since the new button pushed them past the screen.brands.workspaceSettings. The section names reusesettings.*.Web only.
Stacked on #1340 (and #1339 below it), which changes the same brand page header. This PR's own commit is
7b9e7f32.Related issue
None. Product feedback from the user.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
/dashboard/brands: "Workspace Settings" sits top right, left of "Add Brand"./dashboard/brands/<id>/settings): the same button, top right.Checked in light and dark, at 1024 px, and at phone width.
Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)yarn test: 285 files, 2,499 tests pass.yarn buildpasses with CI's placeholders.🤖 Generated with Claude Code