/**
* @ai-summary Hamburger menu drawer for mobile navigation
* @ai-context Bottom slide-up drawer with all navigation options
*/
import React from 'react';
import {
Box,
SwipeableDrawer,
List,
ListItemButton,
ListItemIcon,
ListItemText,
Typography,
useTheme
} from '@mui/material';
import HomeRoundedIcon from '@mui/icons-material/HomeRounded';
import DirectionsCarRoundedIcon from '@mui/icons-material/DirectionsCarRounded';
import LocalGasStationRoundedIcon from '@mui/icons-material/LocalGasStationRounded';
import DescriptionRoundedIcon from '@mui/icons-material/DescriptionRounded';
import BuildRoundedIcon from '@mui/icons-material/BuildRounded';
import SettingsRoundedIcon from '@mui/icons-material/SettingsRounded';
import { MobileScreen } from '../../../core/store/navigation';
// iOS swipeable drawer configuration
const iOS = typeof navigator !== 'undefined' && /iPad|iPhone|iPod/.test(navigator.userAgent);
interface HamburgerDrawerProps {
open: boolean;
onClose: () => void;
onNavigate: (screen: MobileScreen) => void;
activeScreen: MobileScreen;
}
interface MenuItem {
screen: MobileScreen;
label: string;
icon: React.ReactNode;
}
// Menu items from bottom to top (reversed order in array for rendering)
const menuItems: MenuItem[] = [
{ screen: 'Settings', label: 'Settings', icon: },
{ screen: 'Documents', label: 'Documents', icon: },
{ screen: 'Maintenance', label: 'Maintenance', icon: },
{ screen: 'Log Fuel', label: 'Log Fuel', icon: },
{ screen: 'Vehicles', label: 'Vehicles', icon: },
{ screen: 'Dashboard', label: 'Dashboard', icon: },
];
export const HamburgerDrawer: React.FC = ({
open,
onClose,
onNavigate,
activeScreen
}) => {
const theme = useTheme();
const handleNavigate = (screen: MobileScreen) => {
onNavigate(screen);
onClose();
};
return (
{}}
disableSwipeToOpen
disableBackdropTransition={!iOS}
disableDiscovery={iOS}
sx={{
'& .MuiDrawer-paper': {
borderTopLeftRadius: 16,
borderTopRightRadius: 16,
maxHeight: '60vh',
overflow: 'visible'
}
}}
>
{/* Drawer handle */}
{/* Header */}
Menu
{/* Menu Items */}
{menuItems.map(({ screen, label, icon }) => {
const isActive = activeScreen === screen;
return (
handleNavigate(screen)}
sx={{
py: 1.5,
px: 2,
minHeight: 56,
backgroundColor: isActive
? theme.palette.primary.main + '14'
: 'transparent',
borderLeft: isActive
? `3px solid ${theme.palette.primary.main}`
: '3px solid transparent',
'&:hover': {
backgroundColor: isActive
? theme.palette.primary.main + '20'
: theme.palette.action.hover
}
}}
>
{icon}
);
})}
);
};