Skip to content

feat(brands): switch brands from the brand page's header - #1340

Merged
gkhngyk merged 5 commits into
ansvisor:mainfrom
cihan-gyk:feature/brand-page-switch
Oct 22, 2026
Merged

gkhngyk merged 5 commits into
ansvisor:mainfrom
cihan-gyk:feature/brand-page-switch

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

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.

  • Arrows beside the brand's name in the brand page's header (/dashboard/brands/<id>/…). They open a "Switch brand" list of the brands, the current one ticked.
  • Picking another brand:
    • opens the same page of that brand: from the settings, its settings; from Topics or Prompts, its Topics or Prompts;
    • makes it the brand the app shows (setActiveBrand), so the sidebar switches too.
    • Picking the current brand does nothing.
  • The sidebar switcher does the same while you're on a brand's page: it used to change the selected brand but leave you on the old brand's settings. Elsewhere it still switches in place.
  • Shared code:
    • lib/brand-path.ts (brandPagePath) gives the same page of another brand (/dashboard/brands/new isn't a brand's page);
    • the brand rows are a BrandSwitchItems component, 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 feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. With two brands, open a brand's settings (/dashboard/brands/<id>/settings).
  2. Click the arrows beside the brand's name and pick the other brand: that brand's settings open, and the sidebar shows it.
  3. Open its Prompts tab and switch again: the other brand's Prompts open.
  4. Switch from the sidebar while on a brand's page: you stay on the brand page, now for the new brand.
  5. On any other page (e.g. Content), the sidebar switcher still switches in place.

Checked in light and dark, and at 1024 px.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

yarn test: 284 files, 2,493 tests pass. yarn build passes with CI's placeholders.

🤖 Generated with Claude Code

cihan-gyk and others added 2 commits October 22, 2026 11:11
… 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]>
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

@gkhngyk A small follow-up to #1339 (stacked on it; this PR's own commit is 7781364e): arrows beside the brand's name on a brand's page switch to the same page of another brand, and the sidebar switcher keeps you on the brand page too. Web only, no migration.

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

cihan-gyk and others added 2 commits October 22, 2026 14:58
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 gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@gkhngyk
gkhngyk merged commit 855482b into ansvisor:main Oct 22, 2026
1 check passed
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.

2 participants