Skip to content

[feat]: improved side bar#4843

Open
ashrafchowdury wants to merge 15 commits into
mainfrom
feat/sidebar-improvements
Open

[feat]: improved side bar#4843
ashrafchowdury wants to merge 15 commits into
mainfrom
feat/sidebar-improvements

Conversation

@ashrafchowdury

Copy link
Copy Markdown
Contributor

No description provided.

@dosubot dosubot Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Jun 25, 2026
@vercel

vercel Bot commented Jun 25, 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, Comment Jun 26, 2026 9:46am

Request Review

@dosubot dosubot Bot added enhancement New feature or request Frontend UI labels Jun 25, 2026
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR adds shared sidebar contracts, dynamic entity sources, sidebar shell/menu rendering, scoped main and settings wiring, settings navigation helpers, and a references icon helper export.

Changes

Sidebar overhaul

Layer / File(s) Summary
Contracts and atoms
web/oss/src/components/Sidebar/engine/types.ts, web/oss/src/components/Sidebar/dynamic/types.ts, web/oss/src/components/Sidebar/scopes/constants.ts, web/oss/src/components/Sidebar/types.ts, web/oss/src/lib/atoms/sidebar.ts
Sidebar engine types, dynamic entity types, sidebar view and scope IDs, and sidebar popup/open-group atoms are added.
Dynamic sources and registry
web/oss/src/components/Sidebar/dynamic/source.ts, web/oss/src/components/Sidebar/dynamic/registry.ts
gatedSidebarSource, fromParts, the dynamic entity registry, and the aggregated source atom are added.
Dynamic children injection
web/oss/src/components/Sidebar/dynamic/useSidebarDynamicChildren.ts, web/oss/src/components/Sidebar/hooks/useSidebarConfig/index.tsx
Dynamic submenu children are resolved from sidebar entity sources and injected into the sidebar config, which now uses entity-kind icons and dynamic prompt and evaluation entries.
Sidebar shell and menu runtime
web/oss/src/components/Sidebar/engine/SidebarMenu.tsx, web/oss/src/components/Sidebar/engine/SidebarShell.tsx
SidebarMenu renders recursive menu items and popup notifications, and SidebarShell handles route selection, open groups, and section rendering.
Scopes and settings navigation
web/oss/src/components/Sidebar/scopes/mainScope.tsx, web/oss/src/components/Sidebar/scopes/settingsScope.tsx, web/oss/src/components/Layout/Layout.tsx, web/oss/src/components/Layout/SidebarIsland.tsx, web/oss/src/components/Sidebar/Sidebar.tsx, web/oss/src/components/Sidebar/components/WorkflowEntityCard.tsx, web/oss/src/components/Sidebar/components/assets/workflowEntitySelection.ts, web/oss/src/components/pages/settings/assets/navigation.ts, web/oss/src/pages/w/[workspace_id]/p/[project_id]/settings/index.tsx, web/oss/src/state/org/hooks.ts, web/oss/src/lib/navigation/projectSwitchHref.ts, web/oss/src/components/Sidebar/components/ListOfProjects.tsx
mainSidebarScope and createSettingsSidebarScope wire section composition and access-aware tab state, while the settings page, layout, sidebar island, org switching, and project-switch URL helper are updated to use the shared view and navigation helpers.
Settings and workflow validation
web/oss/src/components/pages/settings/assets/navigation.test.ts, web/oss/src/components/Sidebar/components/assets/workflowEntitySelection.test.ts, web/oss/src/lib/navigation/projectSwitchHref.test.ts
Tests cover settings tab resolution, workflow entity selection, and project-switch URL normalization.

References icon helper

Layer / File(s) Summary
Icon helper export
web/oss/src/components/References/ReferenceTag.tsx, web/oss/src/components/References/index.ts
getEntityKindIcon renders the icon for a reference tone and is re-exported from the references barrel.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • Agenta-AI/agenta#4498: Introduces the shared buildProjectSwitchHref path used here for org/workspace switching and related navigation normalization.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is related but too generic to describe the main sidebar refactor and dynamic settings/sidebar work. Use a concise, specific title like “Refactor sidebar to support dynamic main and settings scopes”.
Description check ❓ Inconclusive No description was provided, so there is no meaningful summary to evaluate. Add a brief description of the sidebar refactor and dynamic settings/main scope changes.
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 60.00%.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/sidebar-improvements

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: 8

🧹 Nitpick comments (1)
web/oss/src/components/Sidebar/hooks/useSidebarConfig/index.tsx (1)

50-257: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Memoize the composed sidebar tree before returning it.

Line 257 returns a fresh injectDynamicChildren(sidebarConfig, dynamicChildren) result on every render, so downstream memoization in web/oss/src/components/Sidebar/scopes/mainScope.tsx:35-73 is invalidated even when the menu is logically unchanged. Wrap the base config in useMemo, and hoist the click handlers into useCallback, so the injected tree can also be memoized.

♻️ Suggested shape
+    const handleOpenWidget = useCallback(
+        (e: React.MouseEvent<HTMLElement>) => {
+            e.preventDefault()
+            openWidget()
+        },
+        [openWidget],
+    )
+
+    const handleToggleSupport = useCallback(
+        (e: React.MouseEvent<HTMLElement>) => {
+            e.preventDefault()
+            toggle()
+        },
+        [toggle],
+    )
+
-    const sidebarConfig: SidebarConfig[] = [
+    const sidebarConfig = useMemo<SidebarConfig[]>(() => [
         // ...
         {
             key: "get-started-guide-link",
             // ...
-            onClick: (e) => {
-                e.preventDefault()
-                openWidget()
-            },
+            onClick: handleOpenWidget,
         },
         {
             key: "support-chat-link",
             // ...
-            onClick: (e) => {
-                e.preventDefault()
-                toggle()
-            },
+            onClick: handleToggleSupport,
         },
-    ]
+    ], [
+        appURL,
+        baseAppURL,
+        canInviteMembers,
+        currentApp,
+        doesSessionExist,
+        dynamicChildren,
+        handleOpenWidget,
+        handleToggleSupport,
+        hasAppContext,
+        hasProjectURL,
+        isCrispEnabled,
+        isVisible,
+        projectURL,
+        recentlyVisitedAppId,
+        recentlyVisitedAppURL,
+        selectedOrg,
+    ])
 
-    return injectDynamicChildren(sidebarConfig, dynamicChildren)
+    return useMemo(
+        () => injectDynamicChildren(sidebarConfig, dynamicChildren),
+        [sidebarConfig, dynamicChildren],
+    )

As per coding guidelines, "Use useMemo for expensive computations" and "Do not pass inline arrays of objects with JSX content as props. Memoize such arrays with useMemo to prevent re-renders."

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d9f399e0-ac3c-4b89-9ff2-8fe568af47b5

📥 Commits

Reviewing files that changed from the base of the PR and between 93c1939 and fcf2eb4.

📒 Files selected for processing (18)
  • web/oss/src/components/References/ReferenceTag.tsx
  • web/oss/src/components/References/index.ts
  • web/oss/src/components/Sidebar/SettingsSidebar.tsx
  • web/oss/src/components/Sidebar/Sidebar.tsx
  • web/oss/src/components/Sidebar/components/SidebarMenu.tsx
  • web/oss/src/components/Sidebar/components/WorkflowEntityCard.tsx
  • web/oss/src/components/Sidebar/dynamic/registry.ts
  • web/oss/src/components/Sidebar/dynamic/source.ts
  • web/oss/src/components/Sidebar/dynamic/types.ts
  • web/oss/src/components/Sidebar/dynamic/useSidebarDynamicChildren.ts
  • web/oss/src/components/Sidebar/engine/SidebarMenu.tsx
  • web/oss/src/components/Sidebar/engine/SidebarShell.tsx
  • web/oss/src/components/Sidebar/engine/types.ts
  • web/oss/src/components/Sidebar/hooks/useSidebarConfig/index.tsx
  • web/oss/src/components/Sidebar/scopes/mainScope.tsx
  • web/oss/src/components/Sidebar/scopes/settingsScope.tsx
  • web/oss/src/components/Sidebar/types.d.ts
  • web/oss/src/lib/atoms/sidebar.ts
💤 Files with no reviewable changes (3)
  • web/oss/src/components/Sidebar/types.d.ts
  • web/oss/src/components/Sidebar/SettingsSidebar.tsx
  • web/oss/src/components/Sidebar/components/SidebarMenu.tsx

Comment thread web/oss/src/components/Sidebar/dynamic/registry.ts Outdated
Comment thread web/oss/src/components/Sidebar/dynamic/source.ts
Comment thread web/oss/src/components/Sidebar/engine/SidebarMenu.tsx
Comment thread web/oss/src/components/Sidebar/engine/SidebarMenu.tsx
Comment thread web/oss/src/components/Sidebar/engine/SidebarShell.tsx
Comment thread web/oss/src/components/Sidebar/scopes/settingsScope.tsx Outdated
Comment thread web/oss/src/components/Sidebar/scopes/settingsScope.tsx
Comment thread web/oss/src/lib/atoms/sidebar.ts
@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Preview URL https://gateway-production-9baa.up.railway.app/w
Project agenta-oss-pr-4843
Image tag pr-4843-0fdc8e9
Status Deployed
Railway logs Open logs
Workflow logs View workflow run
Updated at 2026-06-26T09:53:32.202Z

@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.

🧹 Nitpick comments (1)
web/oss/src/components/Sidebar/hooks/useSidebarConfig/index.tsx (1)

50-50: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Memoize injected sidebar config to avoid unnecessary rerenders.

injectDynamicChildren(sidebarConfig, dynamicChildren) currently recomputes a full recursive config tree every render. Please wrap both the base sidebarConfig construction and injected result in useMemo with explicit dependencies so child menu trees stay referentially stable.

Suggested refactor
+import {useMemo} from "react"
...
-    const sidebarConfig: SidebarConfig[] = [
+    const sidebarConfig: SidebarConfig[] = useMemo(() => [
       ...
-    ]
+    ], [
+      baseAppURL,
+      projectURL,
+      appURL,
+      recentlyVisitedAppURL,
+      hasProjectURL,
+      hasAppContext,
+      currentApp,
+      recentlyVisitedAppId,
+      doesSessionExist,
+      selectedOrg,
+      canInviteMembers,
+      isVisible,
+      isCrispEnabled,
+      toggle,
+      openWidget,
+    ])
 
-    return injectDynamicChildren(sidebarConfig, dynamicChildren)
+    return useMemo(
+      () => injectDynamicChildren(sidebarConfig, dynamicChildren),
+      [sidebarConfig, dynamicChildren],
+    )

As per coding guidelines, web/**/*.tsx should use useMemo for expensive computations and avoid render-time object churn where possible.

Also applies to: 257-257

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 69dfc58e-d31b-4cfb-9032-db99efb47999

📥 Commits

Reviewing files that changed from the base of the PR and between fcf2eb4 and 50bdd75.

📒 Files selected for processing (3)
  • web/oss/src/components/Sidebar/dynamic/registry.ts
  • web/oss/src/components/Sidebar/engine/SidebarMenu.tsx
  • web/oss/src/components/Sidebar/hooks/useSidebarConfig/index.tsx
💤 Files with no reviewable changes (1)
  • web/oss/src/components/Sidebar/dynamic/registry.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/oss/src/components/Sidebar/engine/SidebarMenu.tsx

@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.

🧹 Nitpick comments (1)
web/oss/src/components/Sidebar/scopes/settingsScope.tsx (1)

171-178: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Stabilize the controlled selection callback.

onSelect is recreated on every render; memoizing it keeps the sidebar selection contract stable for downstream menu components.

♻️ Proposed refactor
+    const handleSelect = useCallback(
+        (key: string) => {
+            setSettingsTab(key)
+            setTab(key)
+        },
+        [setSettingsTab, setTab],
+    )
+
-    return {
+    return useMemo<SidebarSelection>(() => ({
         mode: "controlled",
         selectedKey: activeTab,
-        onSelect: (key) => {
-            setSettingsTab(key)
-            setTab(key)
-        },
-    }
+        onSelect: handleSelect,
+    }), [activeTab, handleSelect])

Add useCallback to the React import if it is not already present.

As per coding guidelines, “Use useCallback to create stable callbacks in render instead of defining inline functions.”

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0d62064a-4ad4-4048-907c-75b79a690a61

📥 Commits

Reviewing files that changed from the base of the PR and between cc4dd9e and 5ab7ca1.

📒 Files selected for processing (5)
  • web/oss/src/components/Sidebar/dynamic/useSidebarDynamicChildren.ts
  • web/oss/src/components/Sidebar/engine/SidebarMenu.tsx
  • web/oss/src/components/Sidebar/engine/SidebarShell.tsx
  • web/oss/src/components/Sidebar/hooks/useSidebarConfig/index.tsx
  • web/oss/src/components/Sidebar/scopes/settingsScope.tsx
🚧 Files skipped from review as they are similar to previous changes (4)
  • web/oss/src/components/Sidebar/dynamic/useSidebarDynamicChildren.ts
  • web/oss/src/components/Sidebar/engine/SidebarShell.tsx
  • web/oss/src/components/Sidebar/hooks/useSidebarConfig/index.tsx
  • web/oss/src/components/Sidebar/engine/SidebarMenu.tsx

…ve navigation handling

- Changed SidebarIslandProps to accept a SidebarView instead of showSettingsView and lastPath.
- Refactored Sidebar component to resolve sidebar scope based on SidebarView.
- Removed unused imports and cleaned up ListOfProjects component.
- Updated dynamic sidebar registry to use scope IDs for better organization.
- Enhanced gatedSidebarSource to accept scopeId as a parameter.
- Simplified SidebarConfig interface by removing unnecessary properties.
- Improved useSidebarConfig hook to return structured sidebar items.
- Added constants for main and settings sidebar scope IDs.
- Refactored settingsScope to utilize new settings tab management logic.
- Introduced new navigation functions for settings tab resolution and visibility.
- Added tests for settings tab resolution logic.
- Updated projectSwitchHref to handle navigation context more effectively.
- Cleaned up settings page to utilize new settings access logic.
- Updated org hooks to use the new projectSwitchHref for navigation.

@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: 1

🧹 Nitpick comments (2)
web/oss/src/components/Sidebar/components/assets/workflowEntitySelection.test.ts (1)

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

Add the stale-route-id regression case.

This suite never exercises currentWorkflowId being set but absent from both lists, which is exactly where the new helper can skip the recent-app / recent-evaluator fallback. Pinning that behavior down here would keep this precedence logic from regressing again.

Suggested test
+    it("falls back to recents when the current workflow id is stale", () => {
+        expect(
+            resolveWorkflowEntitySelection({
+                currentWorkflow: null,
+                currentWorkflowId: "missing-workflow",
+                apps: [app],
+                evaluators: [evaluator],
+                recentAppId: app.id,
+                recentEvaluatorId: evaluator.id,
+            }),
+        ).toBe(app)
+    })
web/oss/src/pages/w/[workspace_id]/p/[project_id]/settings/index.tsx (1)

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

Extract SettingsAccess construction into one shared helper.

Lines 76-86 duplicate the same SettingsAccess assembly already present in web/oss/src/components/Sidebar/scopes/settingsScope.tsx Lines 47-65. Both the page and the sidebar now depend on the same navigation helpers, so a future access-rule change can desync the active settings content from the sidebar state.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e353ae73-6acd-4e96-ada7-21b736ce8878

📥 Commits

Reviewing files that changed from the base of the PR and between 5ab7ca1 and 7e46a89.

📒 Files selected for processing (21)
  • web/oss/src/components/Layout/Layout.tsx
  • web/oss/src/components/Layout/SidebarIsland.tsx
  • web/oss/src/components/Sidebar/Sidebar.tsx
  • web/oss/src/components/Sidebar/components/ListOfProjects.tsx
  • web/oss/src/components/Sidebar/components/WorkflowEntityCard.tsx
  • web/oss/src/components/Sidebar/components/assets/workflowEntitySelection.test.ts
  • web/oss/src/components/Sidebar/components/assets/workflowEntitySelection.ts
  • web/oss/src/components/Sidebar/dynamic/registry.ts
  • web/oss/src/components/Sidebar/dynamic/source.ts
  • web/oss/src/components/Sidebar/engine/types.ts
  • web/oss/src/components/Sidebar/hooks/useSidebarConfig/index.tsx
  • web/oss/src/components/Sidebar/scopes/constants.ts
  • web/oss/src/components/Sidebar/scopes/mainScope.tsx
  • web/oss/src/components/Sidebar/scopes/settingsScope.tsx
  • web/oss/src/components/Sidebar/types.ts
  • web/oss/src/components/pages/settings/assets/navigation.test.ts
  • web/oss/src/components/pages/settings/assets/navigation.ts
  • web/oss/src/lib/navigation/projectSwitchHref.test.ts
  • web/oss/src/lib/navigation/projectSwitchHref.ts
  • web/oss/src/pages/w/[workspace_id]/p/[project_id]/settings/index.tsx
  • web/oss/src/state/org/hooks.ts
💤 Files with no reviewable changes (1)
  • web/oss/src/components/Sidebar/engine/types.ts
✅ Files skipped from review due to trivial changes (4)
  • web/oss/src/lib/navigation/projectSwitchHref.ts
  • web/oss/src/components/Sidebar/scopes/constants.ts
  • web/oss/src/lib/navigation/projectSwitchHref.test.ts
  • web/oss/src/components/Sidebar/components/ListOfProjects.tsx
🚧 Files skipped from review as they are similar to previous changes (4)
  • web/oss/src/components/Sidebar/dynamic/source.ts
  • web/oss/src/components/Sidebar/Sidebar.tsx
  • web/oss/src/components/Sidebar/hooks/useSidebarConfig/index.tsx
  • web/oss/src/components/Sidebar/scopes/settingsScope.tsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Frontend size:XXL This PR changes 1000+ lines, ignoring generated files. UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant