fix: make navigation more user-friendly#7599
Conversation
…lti-organization support and new modals - Added props for multi-organization features in EnvironmentLayout. - Updated MainNavigation to include organization and project management modals. - Introduced new translations for organization and workspace changes.
WalkthroughThe PR modifies the environment layout and navigation components to support multi-organization features and access control. License-related and access-control flags are propagated from the environment layout server component to the main navigation. The navigation component is significantly refactored to add organization and project switcher dropdowns that replace the previous user switch section, with async data loading and project creation limit enforcement. Additionally, an icon in the project breadcrumb is updated from 🚥 Pre-merge checks | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@apps/web/app/`(app)/environments/[environmentId]/components/MainNavigation.tsx:
- Around line 297-309: The loadProjects and loadOrganizations callbacks
currently only handle the resolved result path and never clear the loading flags
if the fetch promise rejects; wrap the async work in a try/catch/finally (or
append .catch/.finally) inside the useCallback for loadProjects and mirror the
same pattern in loadOrganizations so that setIsLoadingProjects(false) and
setIsLoadingOrganizations(false) always run in finally, and in catch set the
appropriate error state (e.g., setWorkspaceLoadError using
getFormattedErrorMessage(result/error) or a fallback) after calling
getProjectsForSwitcherAction/getOrganizationsForSwitcherAction; keep the
existing sorting and setProjects/setOrganizations logic in the try block.
- Around line 75-92: Duplicate route-matching logic and workspace settings
metadata used in isActiveProjectSetting and isActiveOrganizationSetting (and the
corresponding list/matcher in project-breadcrumb.tsx) should be extracted into a
single shared helper/config module; create a new helper (e.g., export functions
or constants like isActiveProjectSettingMatcher,
isActiveOrganizationSettingMatcher, and WORKSPACE_SETTINGS or
ACCOUNT_SETTINGS_PATTERN) and replace the local implementations in
MainNavigation.tsx and project-breadcrumb.tsx with imports from that module so
both files call the same matcher/constants.
- Around line 442-445: The dropdown trigger elements used with
DropdownMenuTrigger asChild (the workspace switcher, organization switcher and
user trigger) currently render as <div> and use switcherTriggerClasses which
includes focus:outline-none; replace each <div> child with a <button
type="button"> element, add an appropriate aria-label when isCollapsed (e.g.,
"Open workspace menu", "Open organization menu", "Open user menu") so icon-only
buttons are accessible, and remove focus:outline-none from
switcherTriggerClasses in favor of visible focus styles (e.g.,
focus-visible:ring or similar) so keyboard focus is apparent; update the
components that use switcherTriggerClasses and the three DropdownMenuTrigger
asChild usages to use the new button + aria-label pattern.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: fd36da16-23b0-4116-b197-719a8f055035
⛔ Files ignored due to path filters (1)
apps/web/locales/en-US.jsonis excluded by!apps/web/locales/**
📒 Files selected for processing (3)
apps/web/app/(app)/environments/[environmentId]/components/EnvironmentLayout.tsxapps/web/app/(app)/environments/[environmentId]/components/MainNavigation.tsxapps/web/app/(app)/environments/[environmentId]/components/project-breadcrumb.tsx
mattinannt
left a comment
There was a problem hiding this comment.
@jobenjada please fix failing checks and coderabbit comments.
after that you can re-request a review from Anshuman :-)
|



fixes https://github.com/formbricks/internal/issues/1490