aboutsummaryrefslogtreecommitdiff
path: root/modern/src/settings/components/SettingsMenu.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-03 16:22:21 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-03 16:22:21 -0700
commitb418d001a498b5a5108bb13983b4f3aba6c60dbc (patch)
tree464dd5e4fc3f13a6209c05df4d3db3cbbe8e85d6 /modern/src/settings/components/SettingsMenu.js
parent5d17af8102f17d41610acb9ff34aabbff871cda1 (diff)
downloadtrackermap-web-b418d001a498b5a5108bb13983b4f3aba6c60dbc.tar.gz
trackermap-web-b418d001a498b5a5108bb13983b4f3aba6c60dbc.tar.bz2
trackermap-web-b418d001a498b5a5108bb13983b4f3aba6c60dbc.zip
Support feature disabling
Diffstat (limited to 'modern/src/settings/components/SettingsMenu.js')
-rw-r--r--modern/src/settings/components/SettingsMenu.js59
1 files changed, 35 insertions, 24 deletions
diff --git a/modern/src/settings/components/SettingsMenu.js b/modern/src/settings/components/SettingsMenu.js
index fae3ad86..ef5b07d7 100644
--- a/modern/src/settings/components/SettingsMenu.js
+++ b/modern/src/settings/components/SettingsMenu.js
@@ -16,6 +16,7 @@ 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';
+import useFeatures from '../../common/util/useFeatures';
const MenuItem = ({
title, link, icon, selected,
@@ -35,6 +36,8 @@ const SettingsMenu = () => {
const manager = useManager();
const userId = useSelector((state) => state.session.user?.id);
+ const features = useFeatures();
+
return (
<>
<List>
@@ -70,30 +73,38 @@ const SettingsMenu = () => {
icon={<FolderIcon />}
selected={location.pathname.startsWith('/settings/group')}
/>
- <MenuItem
- title={t('sharedDrivers')}
- link="/settings/drivers"
- icon={<PersonIcon />}
- selected={location.pathname.startsWith('/settings/driver')}
- />
- <MenuItem
- title={t('sharedCalendars')}
- link="/settings/calendars"
- icon={<TodayIcon />}
- selected={location.pathname.startsWith('/settings/calendar')}
- />
- <MenuItem
- title={t('sharedComputedAttributes')}
- link="/settings/attributes"
- icon={<StorageIcon />}
- selected={location.pathname.startsWith('/settings/attribute')}
- />
- <MenuItem
- title={t('sharedMaintenance')}
- link="/settings/maintenances"
- icon={<BuildIcon />}
- selected={location.pathname.startsWith('/settings/maintenance')}
- />
+ {!features.disableDrivers && (
+ <MenuItem
+ title={t('sharedDrivers')}
+ link="/settings/drivers"
+ icon={<PersonIcon />}
+ selected={location.pathname.startsWith('/settings/driver')}
+ />
+ )}
+ {!features.disableCalendars && (
+ <MenuItem
+ title={t('sharedCalendars')}
+ link="/settings/calendars"
+ icon={<TodayIcon />}
+ selected={location.pathname.startsWith('/settings/calendar')}
+ />
+ )}
+ {!features.disableComputedAttributes && (
+ <MenuItem
+ title={t('sharedComputedAttributes')}
+ link="/settings/attributes"
+ icon={<StorageIcon />}
+ selected={location.pathname.startsWith('/settings/attribute')}
+ />
+ )}
+ {!features.disableMaintenance && (
+ <MenuItem
+ title={t('sharedMaintenance')}
+ link="/settings/maintenances"
+ icon={<BuildIcon />}
+ selected={location.pathname.startsWith('/settings/maintenance')}
+ />
+ )}
<MenuItem
title={t('sharedSavedCommands')}
link="/settings/commands"