import { PropsWithChildren, useContext } from 'react' import { Link } from 'react-router-dom' import { Theme } from '@mui/material/styles' import Box from '@mui/material/Box' import MuiDrawer from '@mui/material/Drawer' import List from '@mui/material/List' import MuiLink from '@mui/material/Link' import Typography from '@mui/material/Typography' import Divider from '@mui/material/Divider' import IconButton from '@mui/material/IconButton' import ChevronLeftIcon from '@mui/icons-material/ChevronLeft' import ChevronRightIcon from '@mui/icons-material/ChevronRight' import ListItem from '@mui/material/ListItem' import ListItemButton from '@mui/material/ListItemButton' import ListItemIcon from '@mui/material/ListItemIcon' import ListItemText from '@mui/material/ListItemText' import Home from '@mui/icons-material/Home' import SettingsApplications from '@mui/icons-material/SettingsRounded' import QuestionMark from '@mui/icons-material/QuestionMark' import Brightness4Icon from '@mui/icons-material/Brightness4' import Brightness7Icon from '@mui/icons-material/Brightness7' import ReportIcon from '@mui/icons-material/Report' import GitInfo from 'react-git-info/macro' import { routes } from 'config/routes' import { SettingsContext } from 'contexts/SettingsContext' import { ColorMode } from 'models/settings' const { commit } = GitInfo() export const drawerWidth = 240 export interface DrawerProps extends PropsWithChildren { isDrawerOpen: boolean onDrawerClose: () => void theme: Theme } export const Drawer = ({ isDrawerOpen, onDrawerClose, theme }: DrawerProps) => { const settingsContext = useContext(SettingsContext) const colorMode = settingsContext.getUserSettings().colorMode const handleColorModeToggleClick = () => { const newMode = colorMode === ColorMode.LIGHT ? ColorMode.DARK : ColorMode.LIGHT settingsContext.updateUserSettings({ colorMode: newMode }) } return ( ({ display: 'flex', alignItems: 'center', padding: theme.spacing(0, 1), // necessary for drawer content to be pushed below app bar ...theme.mixins.toolbar, justifyContent: 'flex-end', })} > {theme.direction === 'ltr' ? ( ) : ( )} {theme.palette.mode === 'dark' ? ( ) : ( )} Build signature:{' '} {commit.shortHash} ) }