From 52f565bcb5e14b77757676013d1328ead92e13fa Mon Sep 17 00:00:00 2001 From: Desmond Kyeremeh Date: Fri, 2 Jul 2021 15:18:00 +0000 Subject: Account Route --- modern/src/settings/OptionsLayout/useRoutes.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'modern/src/settings/OptionsLayout/useRoutes.js') diff --git a/modern/src/settings/OptionsLayout/useRoutes.js b/modern/src/settings/OptionsLayout/useRoutes.js index e53e8fd..6796a56 100644 --- a/modern/src/settings/OptionsLayout/useRoutes.js +++ b/modern/src/settings/OptionsLayout/useRoutes.js @@ -8,9 +8,14 @@ import StorageIcon from '@material-ui/icons/Storage'; import BuildIcon from '@material-ui/icons/Build'; import PeopleIcon from '@material-ui/icons/People'; import BarChartIcon from '@material-ui/icons/BarChart'; -import { getIsAdmin } from '../../selectors'; +import { getIsAdmin, getUserId } from '../../selectors'; import t from '../../common/localization'; +const accountRoute = { + name: t('settingsUser'), + icon: +}; + const adminRoutes = [ { subheader: t('userAdmin') }, { @@ -31,32 +36,39 @@ const adminRoutes = [ ]; const mainRoutes = [ + accountRoute, { + match: 'geofence', name: t('sharedGeofences'), href: '/geofences', icon: }, { + match: 'notification', name: t('sharedNotifications'), href: '/settings/notifications', icon: }, { + match: 'group', name: t('settingsGroups'), href: '/settings/groups', icon: }, { + match: 'driver', name: t('sharedDrivers'), href: '/settings/drivers', icon: }, { + match: 'attribute', name: t('sharedComputedAttributes'), href: '/settings/attributes', icon: }, { + match: 'maintenance', name: t('sharedMaintenance'), href: '/settings/maintenances', icon: @@ -65,6 +77,9 @@ const mainRoutes = [ export default () => { const isAdmin = useSelector(getIsAdmin); + const userId = useSelector(getUserId); + accountRoute.match = accountRoute.href = `/user/${userId}`; + return useMemo(() => [...mainRoutes, ...(isAdmin ? adminRoutes : [])], [ isAdmin ]); -- cgit v1.2.3