import React from 'react'; import { Divider, List, ListItem, ListItemIcon, ListItemText, } from '@mui/material'; import SettingsIcon from '@mui/icons-material/Settings'; import CreateIcon from '@mui/icons-material/Create'; import NotificationsIcon from '@mui/icons-material/Notifications'; import FolderIcon from '@mui/icons-material/Folder'; import PersonIcon from '@mui/icons-material/Person'; import StorageIcon from '@mui/icons-material/Storage'; import BuildIcon from '@mui/icons-material/Build'; import PeopleIcon from '@mui/icons-material/People'; import TodayIcon from '@mui/icons-material/Today'; import PublishIcon from '@mui/icons-material/Publish'; import { Link, useLocation } from 'react-router-dom'; import { useSelector } from 'react-redux'; import { useTranslation } from '../../common/components/LocalizationProvider'; import { useAdministrator, useManager, useReadonly } from '../../common/util/permissions'; const MenuItem = ({ title, link, icon, selected, }) => ( {icon} ); const SettingsMenu = () => { const t = useTranslation(); const location = useLocation(); const readonly = useReadonly(); const admin = useAdministrator(); const manager = useManager(); const userId = useSelector((state) => state.session.user?.id); return ( <> } selected={location.pathname === '/settings/preferences'} /> {!readonly && ( <> } selected={location.pathname.startsWith('/settings/notification')} /> } selected={location.pathname === `/settings/user/${userId}`} /> } selected={location.pathname.startsWith('/settings/geofence')} /> } selected={location.pathname.startsWith('/settings/group')} /> } selected={location.pathname.startsWith('/settings/driver')} /> } selected={location.pathname.startsWith('/settings/calendar')} /> } selected={location.pathname.startsWith('/settings/attribute')} /> } selected={location.pathname.startsWith('/settings/maintenance')} /> } selected={location.pathname.startsWith('/settings/command')} /> )} {manager && ( <> {admin && ( } selected={location.pathname === '/settings/server'} /> )} } selected={location.pathname.startsWith('/settings/user') && location.pathname !== `/settings/user/${userId}`} /> )} ); }; export default SettingsMenu;