Repository navigation
LayoutSideNav
LayoutSideNav is the shell's navigation component. It renders the side navigation projected from route metadata by useNavEntries — label, icon, and order come from each route's staticData.nav, and visibility adapts to connectivity, feature flags, and user roles — plus a provider-specific help link at the bottom of the navigation.
Use LayoutSideNav to keep route availability, active-state logic, and help-link behavior centralized instead of duplicating navigation rules across shell or page components.
- Source:
frontend/src/components/Layout/LayoutSideNav/index.tsx - Tests:
frontend/src/components/Layout/LayoutSideNav/index.unit.test.tsx
This component does not accept props.
- Reads
isSideNavExpandedfromuseLayout()to control CarbonSideNavexpansion and persistence. - Reads the current pathname from TanStack Router
useRouterState(). - Calls
useNavEntries()to project the visible navigation entries from routestaticData.navmetadata (label, icon, order, typedNavTarget), with gate metadata (roles,featureFlag, offline flags) inherited along each route's ancestor chain. - Renders every projected entry as a flat
SideNavLinkusing TanStackLinkwith the typedtotarget — no casts, no hand-built menu tree. - Always renders a
Need Help?link that targetsenv.VITE_IDIR_HELPfor IDIR users andenv.VITE_BCEID_HELPfor everyone else.
import { LayoutSideNav } from '@/components/Layout/LayoutSideNav';
<LayoutSideNav />;// src/routes/_authenticated/_admin/configuration.tsx
staticData: {
featureFlag: 'configuration-enabled',
nav: { label: 'Configuration', icon: ToolKit, order: 40, to: '/configuration' },
}The menu entry appears (and disappears with the flag) with no change to LayoutSideNav — the nav is data on routes, not code in a menu registry.
LayoutSideNav depends on:
LayoutProviderAuthProviderRouterProvider-
useNavEntries()fromsrc/routing/nav/useNavEntries.ts(which reads routestaticDatathroughcollectRouteGates) -
env.VITE_IDIR_HELPandenv.VITE_BCEID_HELP
- A link is active when
entry.to === pathname(exact match).
- Entries are flat: nested
SideNavMenugroups no longer exist — section grouping is handled bynav.orderand labels. - A route must declare
staticData.navwith a literalNavTargetmember to appear in the nav;NavTargetis a closed union, so a new destination requires extending it insrc/routing/staticData.ts. - When
user?.idpProvideris missing, the help link falls back to the BCeID help URL.
Current unit coverage verifies:
- nav rendering from projected
useNavEntriesoutput - active state for the current pathname
- icon rendering
- provider-specific help-link targets
-
codes/frontend/Components.md— catalog entry points to this page. -
codes/frontend/Layout/Layout.md— parent shell documentation references this nav. -
codes/frontend/Layout/LayoutHeader.md— embeds this navigation in the header shell.
This wiki documents NR Waste Plus for users and developers. Verify security and deployment guidance against the current application configuration before applying it elsewhere.
- Report an issue or ask a question in the GitHub repository.
- Follow the Contributing Guidelines to propose an update.
- Read the Code of Conduct.
Collection indexes support human browsing and machine retrieval. Keep both current when adding or moving wiki pages.
NR Waste Plus Wiki | GitHub Repository