import React from 'react';
import {
Divider, List, ListItem, ListItemIcon, ListItemText,
} from '@material-ui/core';
import SettingsIcon from '@material-ui/icons/Settings';
import CreateIcon from '@material-ui/icons/Create';
import NotificationsIcon from '@material-ui/icons/Notifications';
import FolderIcon from '@material-ui/icons/Folder';
import PersonIcon from '@material-ui/icons/Person';
import StorageIcon from '@material-ui/icons/Storage';
import BuildIcon from '@material-ui/icons/Build';
import PeopleIcon from '@material-ui/icons/People';
import TodayIcon from '@material-ui/icons/Today';
import PublishIcon from '@material-ui/icons/Publish';
import { Link, useLocation } from 'react-router-dom';
import { useSelector } from 'react-redux';
import { useTranslation } from '../../common/components/LocalizationProvider';
import { useAdministrator, 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 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')}
/>
>
)}
{admin && (
<>
}
selected={location.pathname === '/settings/server'}
/>
}
selected={location.pathname.startsWith('/settings/user') && location.pathname !== `/settings/user/${userId}`}
/>
>
)}
>
);
};
export default SettingsMenu;