feat(Navigation): Switch organisation and project from one popover

Approval required
TA
18h ago
+1140-41
  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Contributes to ENG-643.

Replaces the breadcrumb dropdowns with one switcher for organisations and projects: a popover on desktop, a bottom sheet on phones. The organisation and project names stay links; the chevron next to each opens the switcher.

Behind new_project_switcher (off by default). With the flag off, the old breadcrumb renders unchanged from LegacyOrgAndProjectLinks, which goes with BreadcrumbSeparator when the flag is removed.

Also moves DropdownMenu's focus helper to common/utils/listFocus so both menus share it.

Reviewing this

The switcher is behind new_project_switcher (off by default), in SelectOrgAndProject.tsx:

const newSwitcher = Utils.getFlagsmithHasFeature('new_project_switcher')

{!isAppLevelPage && !newSwitcher && <LegacyOrgAndProjectLinks … />}
{!isAppLevelPage && newSwitcher && ( /* OrganisationProjectSwitcher */ )}

Opening a project from another organisation selects that organisation (openProject in useSwitcher).

How did you test this code?

  • Unit tests for which organisation the switcher lists, when projects count as loading, the list states, and who can create a project.
  • Storybook: Components/Navigation/OrganisationProjectSwitcher covers loading, error, empty, no results, long names, no create permission and the phone sheet.
  • Manually, with the flag on: switched organisation and project on desktop and in the phone sheet, searched both lists, and checked Escape and outside click close it.
  • E2E not run yet; the organisation-link and project-link ids are kept on both paths.