Skip to main content

Sidebar & Navigation

The platform uses a collapsible sidebar built with shadcn/ui as the primary navigation element. It adapts its content based on the user's role and provides quick access to all major sections.

Component Structure​

AppSidebar
├─ TeamSwitcher (workspace/project selector)
├─ NavMain (primary navigation items)
├─ NavProjects (project-level links)
└─ NavUser (user profile & logout)

AppSidebar​

File: src/components/app-sidebar.tsx

The root sidebar component. It assembles all navigation sections and manages the collapsed/expanded state. Uses the shadcn/ui Sidebar primitive with responsive behavior — collapses to icons on mobile via the use-mobile hook.

File: src/components/nav-main.tsx

Renders the primary navigation menu items. Each item can have nested sub-items that expand on click.

Navigation structure by role:

SectionRouteAdminHSEQUser
Dashboard/dashboardYesYesYes
MOC Tracking/dashboard/MocYesYesYes
MOC Archive/dashboard/Moc/listYesYesYes
PCR Tracking/dashboard/pcrYesYesYes
Create MOC/dashboard/Moc/createYesYesYes
Create PCR/dashboard/pcr/createYesYesYes
Analytics/dashboard/analyticsYesYesNo
User Management/dashboard/usersYesNoNo
Notifications/dashboard/notificationsYesYesYes
Year-End Review/dashboard/year-endYesYesNo

File: src/components/nav-user.tsx

Displays the current user's avatar, name, and role at the bottom of the sidebar. Includes a dropdown menu with:

  • Profile settings
  • Logout action

TeamSwitcher​

File: src/components/team-switcher.tsx

Displays the platform branding at the top of the sidebar. In the current configuration, this shows the Bahri logo and platform name.

Mobile Responsiveness​

Hook: src/hooks/use-mobile.tsx

The sidebar uses a custom hook to detect mobile viewports. On mobile:

  • Sidebar collapses to an icon-only rail
  • A hamburger menu button appears in the top navigation
  • Tapping the hamburger opens the full sidebar as an overlay

Top Navigation Bar​

File: src/features/mainTopNav/

The top navigation bar spans the full width above the content area and includes:

ElementPurpose
BreadcrumbsShows current location (Dashboard → MOC → Serial #)
SearchQuick search across MOCs and PCRs
Notifications bellShows unread notification count, opens notification panel
User avatarQuick access to profile dropdown

Notification Bell​

The notification bell in the top nav integrates with the notification system:

  • Displays unread count as a badge
  • Polls every 30 seconds for new notifications (via src/features/notification_system/)
  • Clicking opens either a dropdown preview or navigates to the full notifications page

Chat Floating Box​

File: src/features/chatFloatingBox/

A floating chat widget that appears in the bottom-right corner of the dashboard. Allows users to communicate within the context of a specific MOC without leaving the current page.

Route Layout​

The dashboard layout wraps all authenticated pages:

File: src/app/dashboard/layout.tsx

Dashboard Layout
├─ AppSidebar (left)
├─ TopNav (top)
└─ Content Area (center)
└─ {children} (page content)
PurposePath
App sidebarsrc/components/app-sidebar.tsx
Main navigationsrc/components/nav-main.tsx
User navigationsrc/components/nav-user.tsx
Team switchersrc/components/team-switcher.tsx
Mobile hooksrc/hooks/use-mobile.tsx
Top navigationsrc/features/mainTopNav/
Chat widgetsrc/features/chatFloatingBox/
Notification systemsrc/features/notification_system/
Dashboard layoutsrc/app/dashboard/layout.tsx