Repository navigation
feat(layout): reach the brands page and the brand's settings from the brand switcher - #1339
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]>
|
@gkhngyk This one is the user's sidebar change: the Brands item is gone, and the brand switcher now leads to the brands page ("Show My All Brands") and, through a ⚙ next to the selected brand, to that brand's settings. Heads-up: because the Brands item was the mobile menu's only way to the brands page, the mobile sheet now gets the same switcher at the top. It's web only; tests (2,487) and the build pass. A follow-up stacked on this adds a brand switch on the settings page itself. |
gkhngyk
left a comment
There was a problem hiding this comment.
One fix before merge, one small one:
-
The settings icon opens edit controls the server refuses.
web/src/components/layout/brand-switcher.tsx:160The icon shows for every role, which is fine: analysts need the brand's Tracking tab too. But on
brands/[id]/settings/page.tsxonly Shopping mode and Pause check the role. These still offer a write:- General → Save (
:346) - Domains → add/remove/Save (
:625,:666) - Competitors → add/delete (
:784,:841) - Danger → Delete (
:1042)
For analysts and agency partners, RLS refuses the General and Domains writes (
brandsandbrand_domainsupdate are admin/manager only).updateBrandthen throws, and in production the toast shows the masked server-action message. The server deletes a brand for admins only, so managers get a 403 on Delete too.This was already true from the brand cards. The icon puts the page one click away from every screen, though, so please gate it here:
- General, Domains and Competitors on
canManage; - Danger on
canAdmin; - a short read-only note, the way
ShoppingModeCardandPauseBrandCarddo it; - role cases in
settings/page.test.tsx, next to the existing ones.
- General → Save (
-
"Add Brand" for roles that can't add one.
brand-switcher.tsx:149(and the empty state at:48)brands: admin/manager insertrefuses analysts and agency partners. The item now jumps straight into the wizard, which fails on its first Continue with the masked error. Show it only whenuseUserRole().canManageis true, as #1341 does for Workspace Settings.Also, at the plan's brand limit the item used to go through the brands page's upgrade button. Now it reaches the wizard and fails on its first step (the
plan_limittoast). Fine as a follow-up, e.g. the wizard checking the limit when it loads.
The rest looks right. The sidebar group is gone with nothing indexing it. getDashboardNavLabel has no other callers. The mobile sheet closes on navigation. Colors stay on --primary.
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]>
|
@gkhngyk Thanks, both are in
Tried in the browser with the demo user temporarily set to analyst, then set back to admin. Web: 2,491 tests and the build pass. The plan-limit check in the wizard stays a follow-up, as you said. |
gkhngyk
left a comment
There was a problem hiding this comment.
Looks good. Both items from the last review are done:
- General, Domains and Competitors are in a fieldset that is disabled unless
canManage. Danger is disabled unlesscanAdmin. Each has a read-only note, and the role cases are insettings/page.test.tsx. - The switcher's Add Brand, and its empty state, show only with
canManage, with a test.
Two small follow-ups, fine after merge:
- The Competitors tab here is now manager-only, but the Competitors page and the citations Add competitor button still offer adding and removing to every role. We'll decide which way to align them and follow up separately.
- At the plan's brand limit, the switcher's Add Brand goes straight to the wizard, which fails on its first step.
Tested on top of main together with #1340, #1341, #1352 and #1337: web and server tests, tsc, lint and Prettier pass.
Summary
From the user: the brands page and a brand's settings are reached from the brand switcher at the top of the menu, not from a sidebar item.
/dashboard/brands) sits just above "Add Brand"./dashboard/brands/newdirectly, as the empty-state button already did. Before, it opened the brands list, which "Show My All Brands" now does./dashboard/brands/<id>/settings;onNavigate).getDashboardNavLabeldrops itsbrandsnamespace branch and thetBrandsargument, which only "Brands" used (sidebar, mobile menu, onboarding preview).Web only.
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
Checked in light and dark, at 1024 px, collapsed, 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: 282 files, 2,487 tests pass.yarn buildpasses with CI's placeholders.🤖 Generated with Claude Code