feat: implement feature-filtered sidebar navigation#1403
Conversation
Add `feature` field to NavItem interface and filter TENANT_NAV_ITEMS based on enabled features from useTenantFeatures hook. Platform admins bypass the filter and always see all items. Items without a feature field (Transactions) are always visible. Update sidebar tests with mocked tenant context and feature hook, adding coverage for feature filtering, admin bypass, and always-visible items.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughFeature-based visibility filtering is added to the Sidebar component: NavItem gained an optional Changes
Sequence DiagramsequenceDiagram
participant Sidebar as Sidebar Component
participant TC as useTenantContext
participant TF as useTenantFeatures
participant Filter as Feature Filter Logic
participant Render as Render Engine
Sidebar->>TC: request user role / tenant lens
TC-->>Sidebar: returns role (platform admin / tenant user)
Sidebar->>TF: request enabled features
TF-->>Sidebar: returns enabled feature list
Sidebar->>Filter: apply filter to TENANT_NAV_ITEMS
Note over Filter: For each nav item
alt item has no `feature`
Filter-->>Filter: include
else item has `feature`
alt user is platform admin
Filter-->>Filter: include
else user is tenant user
alt feature in enabled list
Filter-->>Filter: include
else
Filter-->>Filter: exclude
end
end
end
Filter-->>Sidebar: visibleTenantItems
Sidebar->>Render: render visibleTenantItems + platform items
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
Claude Code ReviewCommit: SummaryClean, well-scoped implementation across 3 commits. Feature IDs in The PR description correctly notes this is UX-only — backend RBAC is the authorization boundary. The sidebar just hides navigation; direct URL access would still be blocked server-side. Risk Assessment
FindingsNo issues found. Verified:
Bot Review NotesNo unresolved bot threads found at time of review. CodeRabbit review was still in progress. |
…ment--18--feature-sidebar
The Sidebar now uses useTenantFeatures which depends on TenantContext. Update renderSidebar to use renderWithProviders from test-utils to supply the required provider tree.
Summary
feature?: stringfield toNavIteminterface in sidebar componentuseTenantFeatureshook anduseTenantContextto filter navigation itemsfeaturefield (Transactions) are always visibleChanges Made
frontend/src/components/layout/sidebar.tsxfeature?: stringtoNavIteminterfaceuseTenantFeaturesanduseTenantContextvisibleTenantItemscomputed list that filters by enabled features with admin bypassfrontend/src/components/layout/sidebar.test.tsx@/contexts/tenant-contextand@/hooks/use-tenant-featuresmakeContextandmakeFeaturestest helpersbeforeEachto set up default mocks (all features enabled, non-admin)feature filteringdescribe block with 4 new test cases:Technical Details
Feature-to-nav-item mapping follows ALL_FEATURES from
tenant-ui-config.ts:sagas→ Starlark Configmappings→ Gateway Mappingsaudit→ Audit LogFeature visibility is UX-only; backend RBAC enforces authorization.
Test plan