Skip to content

Conversation

@athul-rs
Copy link
Contributor

What

  • Adding a staff access button for cloud support.

Why

  • New introduction to support cloud feature

How

  • Added a new button the drop-down nav.

Can this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)

Database Migrations

Env Config

Relevant Docs

Related Issues or PRs

Dependencies Versions

Notes on Testing

Screenshots

Checklist

I have read and understood the Contribution Guidelines.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 17, 2025

Summary by CodeRabbit

  • New Features
    • Added a "Custom Plans" menu item to the top navigation bar for eligible users, providing direct access to custom plans management and administration features.

Walkthrough

Adds conditional rendering of a Custom Plans menu item in the navigation bar. The item appears when the application is Unstract, the user is staff, and the organization is not open source, including a SettingOutlined icon and navigation link to the admin custom-plans page.

Changes

Cohort / File(s) Summary
Custom Plans Navigation
frontend/src/components/navigations/top-nav-bar/TopNavBar.jsx
Imports SettingOutlined icon; derives isStaff and isOpenSource flags from session and organization data; conditionally renders a Custom Plans menu item with navigation to /{orgName}/admin/custom-plans when conditions are met; duplicates the menu item insertion in two locations within the same conditional block.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Duplicate menu item key: The Custom Plans item is inserted in two separate locations with the same condition and key, which may cause React warnings or unintended rendering behavior. Verify whether this is intentional or a bug.
  • Flag derivation logic: Confirm that isStaff and isOpenSource flags are correctly computed from session details and organization name.
  • Navigation path construction: Validate that the route /{orgName}/admin/custom-plans is correct and accessible for the intended user type.

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete; the critical 'Can this PR break any existing features' section is empty, which admins require before merging per the template guidelines. Complete the required section about potential breaking changes. Address the duplicate menu item issue identified in the code review and explain why it won't break existing features or list affected features.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'UN-3003: Addition to navbar' is vague and generic, using non-descriptive terms like 'Addition' that don't convey the meaningful change (adding a staff access button for custom plans navigation). Replace with a more specific title that describes the actual change, such as 'UN-3003: Add custom plans menu item for staff users' or 'UN-3003: Add staff access button to navbar for custom plans'.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch UN-3003-admin-access

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 and usage tips.

@sonarqubecloud
Copy link

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

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

⚠️ Outside diff range comments (1)
frontend/src/components/navigations/top-nav-bar/TopNavBar.jsx (1)

398-408: Add missing dependencies to the useMemo hook.

The items useMemo is missing several dependencies that are used within its callback: isStaff, isOpenSource, isLoggedIn, logout, and sessionDetails. This will cause the menu to use stale values when these dependencies change, preventing the Custom Plans menu item from appearing/disappearing correctly when user permissions or organization context changes.

Apply this diff to include the missing dependencies:

   }, [
     isUnstract,
     isSimpleLayout,
     reviewerStatus,
     approverStatus,
     allOrganization,
     cascadeOptions,
     orgName,
     orgId,
     shouldDisableRouting,
+    isStaff,
+    isOpenSource,
+    isLoggedIn,
+    logout,
+    sessionDetails,
   ]);
🧹 Nitpick comments (1)
frontend/src/components/navigations/top-nav-bar/TopNavBar.jsx (1)

167-167: Consider extracting the magic string to a constant.

The hardcoded "mock_org" string could be extracted to a named constant at the module level for better maintainability and clarity.

Apply this diff to extract the constant:

+const OPEN_SOURCE_ORG_NAME = "mock_org";
+
 let TrialDaysInfo;

Then update line 167:

-  const isOpenSource = orgName === "mock_org";
+  const isOpenSource = orgName === OPEN_SOURCE_ORG_NAME;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to Reviews > Disable Cache setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 3c37210 and 2c1d28e.

📒 Files selected for processing (1)
  • frontend/src/components/navigations/top-nav-bar/TopNavBar.jsx (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (3)
frontend/src/components/navigations/top-nav-bar/TopNavBar.jsx (3)

19-19: LGTM!

The import of SettingOutlined is correctly added and properly used in the Custom Plans menu item.


355-369: AI summary inconsistency: No duplication detected.

The AI summary claims this Custom Plans menu item is duplicated in two locations with the same key, but only one instance is visible in the provided code at lines 355-369. The implementation appears correct with no duplication.


355-369: Route verification confirms implementation is correct.

The route admin/custom-plans is properly defined at frontend/src/routes/useMainAppRoutes.js:122 and maps to UnstractAdministrationPage. The navigation target in the menu item correctly references this route.

Copy link
Contributor

@jaseemjaskp jaseemjaskp left a comment

Choose a reason for hiding this comment

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

LGTM

@johnyrahul johnyrahul merged commit a748c93 into main Nov 17, 2025
6 checks passed
@johnyrahul johnyrahul deleted the UN-3003-admin-access branch November 17, 2025 11:37
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.

4 participants