Skip to content

[feat] Consolidate project + org into one bottom-docked sidebar switcher - #5738

Merged
bekossy merged 8 commits into
release/v0.109.1from
feat/organized-project-org-side-bar
Aug 5, 2026
Merged

[feat] Consolidate project + org into one bottom-docked sidebar switcher#5738
bekossy merged 8 commits into
release/v0.109.1from
feat/organized-project-org-side-bar

Conversation

@ashrafchowdury

Copy link
Copy Markdown
Contributor

Context

Switching organizations lived in a dropdown at the top of the sidebar (ListOfOrgs), project switching lived separately, and the auth-upgrade modal was buried inside that sidebar selector. There was also no way to copy an org or project ID from the UI. This reorganizes the sidebar so project and org live in a single switcher docked at the bottom of the rail, puts the brand logo at the top, and surfaces the IDs in Settings.

Implements the proposal in #5730. Design: https://claude.ai/code/artifact/35620381-537c-4969-b89e-e15bd67b86d7

Changes

One switcher, docked at the bottom. New ProjectOrgSwitcher shows the current project over its org, like a workspace switcher. Clicking it opens a projects panel (projects in the current org, active one checked); "Switch organization" slides to an orgs panel; both panels also host create-project / create-org / org-settings / logout. It renders through a new afterBottom sidebar slot so it pins below everything else in both the main and settings scopes. The old top-of-sidebar ListOfOrgs dropdown is no longer used by these scopes (it stays in the repo because EE's post-signup header still imports it).

Before: org dropdown at the top of the rail; project switching elsewhere.
After: [avatar] Project / Org ⌄ pinned at the bottom, expanding into projects ↔ orgs panels.

Auth-upgrade flow lifted out of the sidebar. The switch/create/logout logic is consolidated into a new useProjectOrgSwitcher hook. When switching an org returns AUTH_UPGRADE_REQUIRED / AUTH_SSO_DENIED, the hook now only sets a new app-level authUpgradeAtom; a single AuthUpgradeHost mounted in Layout owns rendering and teardown of the modal.

Before: the modal and its success-detection effect lived inside the sidebar selector component.
After: any entry point sets authUpgradeAtom; AuthUpgradeHost renders it once at the app level and clears it (plus its localStorage keys) when the target org becomes active or the user cancels.

Brand logo header. New SidebarLogo sits at the top: full wordmark when expanded, symbol when collapsed. Dark mode uses the yellow accent variant.

Copy IDs in Settings. Organization → General gains an "Organization ID" field with a Copy button. The Projects table gains a per-row copy button next to the project ID.

Bottom-section cleanup. Removed the standalone "Invite Teammate" row and moved "Live Chat Support" into the Help submenu (its divider now only renders when the row actually shows).

Tests / notes

  • pnpm lint on @agenta/oss passes (only pre-existing unrelated warnings in Drives/useDriveTreeViewport).
  • The auth-upgrade localStorage keys (authUpgradeOrgId, authUpgradeSessionIdentities) are still read by the auth-redirect flow (state/url/auth.ts, fetchClient.ts, axiosConfig.ts); shared constants now live in state/org/authUpgrade.ts.
  • ListOfOrgs / ListOfProjects are intentionally left in place for EE's PostSignupHeader; retiring them is a follow-up.

What to QA

  • Open the sidebar. The bottom shows the project/org switcher; the top shows the Agenta logo. Click the switcher: it lists projects in the current org with the active one checked. Pick another project and it navigates.
  • Hit "Switch organization". The panel shows your orgs (3 visible, the rest scroll). Selecting one switches org; the back arrow returns to projects and X closes.
  • Try "New project" and "Create organization" (both open a modal and, on success, switch to the new item), and "Logout" (confirms first).
  • Collapse the rail. The switcher shows just the avatar and still opens.
  • Dark mode: the top logo is the yellow variant.
  • Settings → Organization → General: the Organization ID field copies. Settings → Projects: the per-row copy button copies that project's ID.
  • Regression: switch to an org that requires SSO/auth upgrade. The upgrade modal still appears (now app-level) and clears once you're in; a domain-denied org still shows the error toast.

Preview

Click to expand image image image

References

- Implemented AuthUpgradeHost to manage organization authentication upgrades.
- Integrated AuthUpgradeHost into the main layout for rendering.
- Created ProjectOrgSwitcher component for switching between projects and organizations.
- Added SidebarLogo component for branding in the sidebar.
- Updated SidebarShell to render additional components in the sidebar.
- Enhanced sidebar scopes to include new components and functionality.
- Introduced hooks for managing project and organization switching logic.
- Added functionality to copy organization and project IDs in settings.
- Established state management for authentication upgrade prompts.
@dosubot dosubot Bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Aug 5, 2026
@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview Aug 5, 2026 11:19am

Request Review

@dosubot dosubot Bot added Feature Request New feature or request Frontend labels Aug 5, 2026
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1f568fc9-8fba-4ca5-8477-6d2d73c0bda0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added a streamlined project and organization switcher with project and organization creation, settings access, and logout.
    • Added authentication upgrade prompts when switching organizations requires additional access.
    • Added responsive sidebar branding for expanded and collapsed views.
    • Added copy buttons for organization and project IDs with success and error feedback.
    • Moved support chat into the Help & Docs menu.
  • Improvements

    • Improved sidebar navigation and project and organization selection across main and settings areas.
    • Improved authentication upgrade flow completion and organization-switching feedback.

Walkthrough

The change adds a shared project and organization switcher, integrates it into both sidebar scopes, adds app-level authentication-upgrade handling, moves live chat into Help & Docs, and adds organization and project ID copy controls.

Changes

Sidebar and auth-upgrade integration

Layer / File(s) Summary
Auth-upgrade state and host wiring
web/oss/src/state/org/authUpgrade.ts, web/oss/src/components/Sidebar/components/AuthUpgradeModal.tsx, web/oss/src/components/Layout/AuthUpgradeHost.tsx, web/oss/src/components/Layout/Layout.tsx
The app stores authentication-upgrade state in a Jotai atom. The layout renders AuthUpgradeHost, which displays and closes the upgrade modal and clears related state.
Project and organization switcher behavior
web/oss/src/components/Sidebar/hooks/useProjectOrgSwitcher.ts, web/oss/src/components/Sidebar/components/ProjectOrgSwitcher/index.tsx
The switcher derives projects and organizations, supports selection and creation, handles guarded organization access, navigates to settings, confirms logout, and manages upgrade and error responses.
Sidebar scope integration
web/oss/src/components/Sidebar/engine/*, web/oss/src/components/Sidebar/components/SidebarLogo.tsx, web/oss/src/components/Sidebar/scopes/*
The sidebar engine adds an afterBottom slot. Main and settings scopes render the switcher through that slot and use the theme-aware logo. Live Chat Support moves into Help & Docs, and invite-teammate entries remain available through the bottom section.
Organization and project ID copying
web/oss/src/components/pages/settings/Organization/General.tsx, web/oss/src/components/pages/settings/Projects/index.tsx
Settings pages add clipboard actions for organization and project identifiers, with availability checks and success or error feedback.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant ProjectOrgSwitcher
  participant useProjectOrgSwitcher
  participant authUpgradeAtom
  participant AuthUpgradeHost
  participant AuthUpgradeModal
  User->>ProjectOrgSwitcher: select organization
  ProjectOrgSwitcher->>useProjectOrgSwitcher: request organization switch
  useProjectOrgSwitcher->>authUpgradeAtom: store upgrade context
  AuthUpgradeHost->>AuthUpgradeModal: render upgrade prompt
  AuthUpgradeModal->>AuthUpgradeHost: complete or cancel upgrade
  AuthUpgradeHost->>authUpgradeAtom: reset upgrade state
Loading

Possibly related PRs

  • Agenta-AI/agenta#4987: Changes the same sidebar and layout architecture, including organization and project switching.
  • Agenta-AI/agenta#5730: Covers the related sidebar selector consolidation and auth-upgrade changes.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: consolidating project and organization switching into a bottom-docked sidebar switcher.
Description check ✅ Passed The description directly explains the sidebar switcher, authentication-upgrade changes, logo, ID copying, and related UI updates.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/organized-project-org-side-bar

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (3)
web/oss/src/state/org/authUpgrade.ts (1)

3-3: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Move AuthUpgradeDetail out of the component module.

The state module imports a type from a Sidebar component. This inverts the dependency direction: state now depends on a UI component file. Any consumer of authUpgradeAtom pulls the component module path into its type graph.

Declare AuthUpgradeDetail in web/oss/src/state/org/authUpgrade.ts (or a shared types module) and let AuthUpgradeModal import it from there.

web/oss/src/components/Sidebar/hooks/useProjectOrgSwitcher.ts (1)

65-72: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

safeOrganizationList defeats the currentOrg memo.

Line 65 builds a new array on every render when organizationList is an array. The useMemo on line 66 lists it as a dependency, so the memo recomputes on every render.

Memoize the normalization.

♻️ Proposed refactor
-    const safeOrganizationList = Array.isArray(organizationList) ? organizationList : []
+    const safeOrganizationList = useMemo(
+        () => (Array.isArray(organizationList) ? organizationList : []),
+        [organizationList],
+    )

As per coding guidelines: "Minimize React re-renders with useMemo, useCallback, and React.memo where appropriate; avoid unstable inline functions and objects".

Source: Coding guidelines

web/oss/src/components/Sidebar/components/ProjectOrgSwitcher/index.tsx (1)

166-173: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add an accessible name to the icon-only close button.

The button contains only an X icon. title supplies an accessible name only as a last-resort fallback, and screen reader support for it is inconsistent. Add aria-label.

♿ Proposed fix
                     <button
                         type="button"
+                        aria-label="Close"
                         title="Close"
                         onClick={close}

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f81e7971-dd2b-453a-b54c-82d421fde7e9

📥 Commits

Reviewing files that changed from the base of the PR and between b8712ed and c69038c.

📒 Files selected for processing (13)
  • web/oss/src/components/Layout/AuthUpgradeHost.tsx
  • web/oss/src/components/Layout/Layout.tsx
  • web/oss/src/components/Sidebar/components/ProjectOrgSwitcher/index.tsx
  • web/oss/src/components/Sidebar/components/SidebarLogo.tsx
  • web/oss/src/components/Sidebar/engine/SidebarShell.tsx
  • web/oss/src/components/Sidebar/engine/types.ts
  • web/oss/src/components/Sidebar/hooks/useProjectOrgSwitcher.ts
  • web/oss/src/components/Sidebar/scopes/bottomSection.tsx
  • web/oss/src/components/Sidebar/scopes/mainScope.tsx
  • web/oss/src/components/Sidebar/scopes/settingsScope.tsx
  • web/oss/src/components/pages/settings/Organization/General.tsx
  • web/oss/src/components/pages/settings/Projects/index.tsx
  • web/oss/src/state/org/authUpgrade.ts

Comment thread web/oss/src/components/Sidebar/components/ProjectOrgSwitcher/index.tsx Outdated
Comment thread web/oss/src/components/Sidebar/components/SidebarLogo.tsx
Comment thread web/oss/src/components/Sidebar/hooks/useProjectOrgSwitcher.ts Outdated
Comment thread web/oss/src/components/Sidebar/hooks/useProjectOrgSwitcher.ts
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Status Destroyed (PR closed)

Updated at 2026-08-05T11:46:54.319Z

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
web/oss/src/components/Sidebar/scopes/bottomSection.tsx (1)

7-7: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Remove the standalone Invite Teammate row.

The PR objective removes this row. inviteItem is still included in both branches at Line [149] and Line [150]. Eligible users will still see it. Remove it from both arrays, then remove its unused definition and related references.

Proposed fix
             items: includeSettingsLink
-                ? [settingsLink, inviteItem, ...sharedItems]
-                : [inviteItem, ...sharedItems],
+                ? [settingsLink, ...sharedItems]
+                : sharedItems,

As per PR objectives, the standalone “Invite Teammate” row is removed.

Also applies to: 19-22, 37-38, 72-83, 145-154


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c0aae551-fe11-456f-9dd0-f72c3c6ed0e9

📥 Commits

Reviewing files that changed from the base of the PR and between d8ca493 and dfe367d.

📒 Files selected for processing (1)
  • web/oss/src/components/Sidebar/scopes/bottomSection.tsx

@bekossy
bekossy changed the base branch from main to release/v0.109.1 August 5, 2026 11:16
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Aug 5, 2026
@bekossy
bekossy merged commit 3d0a232 into release/v0.109.1 Aug 5, 2026
60 of 61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Request New feature or request Frontend lgtm This PR has been approved by a maintainer size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants