Repository navigation
feat(brands): switch brands from the brand page's header - #1340
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]>
gkhngyk
left a comment
There was a problem hiding this comment.
Looks good. brandPagePath keeps the sub-page and skips /dashboard/brands/new. The header switch does nothing for the current brand. The sidebar switcher only navigates on a brand's pages. BrandSwitchItems is shared without changing the rows. Switching brands writes nothing, so no role check is needed. Stacked on #1339, so it should merge after it.
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
gkhngyk
left a comment
There was a problem hiding this comment.
Looks good. The new merge of #1339 (1cf817ac) had one conflict, in brand-switcher.test.tsx. It was resolved by keeping both sides of the beforeEach reset, and the merge carries nothing else. This PR is still stacked on #1339, so merge it after #1339.
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: a brand's page should have the same switch-brand arrows beside the brand's name, and picking another brand should open that brand's settings.
/dashboard/brands/<id>/…). They open a "Switch brand" list of the brands, the current one ticked.setActiveBrand), so the sidebar switches too.lib/brand-path.ts(brandPagePath) gives the same page of another brand (/dashboard/brands/newisn't a brand's page);BrandSwitchItemscomponent, used by both lists.Web only.
Stacked on #1339, whose brand switcher this reuses. This PR's own commit is
7781364e.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/<id>/settings).Checked in light and dark, and at 1024 px.
Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)yarn test: 284 files, 2,493 tests pass.yarn buildpasses with CI's placeholders.🤖 Generated with Claude Code