Layout Component
The mainLayout component wraps all protected routes and provides the application shell.
File Location
Features
Responsive Design
Automatically adapts to mobile (< 1024px) and desktop viewports
Collapsible Sidebar
Toggle between collapsed (80px) and expanded (280px) states
Mobile Overlay
Backdrop overlay when mobile menu is open
Nested Routing
Uses React Router’s
<Outlet /> for child routesImplementation
Layout.tsx
Usage in Routes
The Layout component is applied to protected routes:AppRoutes.tsx
AppSidebar Component
The application sidebar provides navigation to main application sections.File Location
Props
Features
- Active Route Highlighting: Automatically highlights the current page
- Icon-Only Mode: Shows only icons when collapsed
- Alert Badges: Displays notification counts on TamboEngine link
- Smooth Animations: Fade-in transitions for text elements
Navigation Items
AppSidebar.tsx
Implementation
AppSidebar.tsx
Navbar Component
The Navbar provides the top navigation bar with menu toggle and user actions.File Location
Props
Key Features
- Hamburger menu button for mobile/desktop sidebar toggle
- User profile display
- Logout functionality
- Establishment name display
Loading Components
The layout system includes loading states for better UX.LoadingSpinner
Displayed during initial app load and route authentication:LoadingSpinner.tsx
apps/frontend/src/components/layout/LoadingSpinner.tsx
Loading (Full Page)
Used by ProtectedRoute during authentication check: Location:apps/frontend/src/components/layout/Loading.tsx
Responsive Breakpoints
The layout uses consistent breakpoints:Customization
Change Sidebar Width
Layout.tsx
Adjust Mobile Breakpoint
Layout.tsx
Modify Color Scheme
Best Practices
Always use the Layout component
All authenticated pages should render inside the Layout component via
<Outlet />Don't nest Layouts
Only one Layout component should be active at a time
Mobile-first responsive design
Test all pages on mobile viewports to ensure proper sidebar behavior
Use semantic HTML
The layout uses proper HTML5 semantic elements like
<nav>, <main>, and <aside>Related Components
Sidebar Primitives
Base sidebar components from common/sidebar
Protected Routes
How routes integrate with Layout
Auth Context
User data displayed in Navbar
Dashboard
Example page using Layout
