From 05a7a75d6db6185bbea02df51a8506a9b1611bb3 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 1 May 2022 17:03:36 -0700 Subject: Add preferences page --- modern/src/App.js | 2 ++ modern/src/components/BottomMenu.js | 2 +- modern/src/settings/OptionsLayout.js | 2 ++ modern/src/settings/PreferencesPage.js | 47 ++++++++++++++++++++++++++++++++++ 4 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 modern/src/settings/PreferencesPage.js (limited to 'modern') diff --git a/modern/src/App.js b/modern/src/App.js index e12a2e78..57e44621 100644 --- a/modern/src/App.js +++ b/modern/src/App.js @@ -47,6 +47,7 @@ import useQuery from './common/useQuery'; import { useEffectAsync } from './reactHelper'; import { devicesActions } from './store'; import EventPage from './EventPage'; +import PreferencesPage from './settings/PreferencesPage'; const App = () => { const history = useHistory(); @@ -101,6 +102,7 @@ const App = () => { + diff --git a/modern/src/components/BottomMenu.js b/modern/src/components/BottomMenu.js index c6bf66e6..c43cfb96 100644 --- a/modern/src/components/BottomMenu.js +++ b/modern/src/components/BottomMenu.js @@ -43,7 +43,7 @@ const BottomMenu = () => { history.push('/reports/route'); break; case 2: - history.push('/settings/notifications'); + history.push('/settings/preferences'); break; case 3: setAnchorEl(event.currentTarget); diff --git a/modern/src/settings/OptionsLayout.js b/modern/src/settings/OptionsLayout.js index f2d8c5da..6ba636c2 100644 --- a/modern/src/settings/OptionsLayout.js +++ b/modern/src/settings/OptionsLayout.js @@ -10,6 +10,7 @@ import { } from '@material-ui/core'; import { useSelector } from 'react-redux'; +import SettingsIcon from '@material-ui/icons/Settings'; import CreateIcon from '@material-ui/icons/Create'; import ArrowBackIcon from '@material-ui/icons/ArrowBack'; import NotificationsIcon from '@material-ui/icons/Notifications'; @@ -80,6 +81,7 @@ const OptionsLayout = ({ children }) => { ], [t]); const mainRoutes = useMemo(() => [ + { name: t('sharedPreferences'), href: '/settings/preferences', icon: }, { name: t('sharedNotifications'), href: '/settings/notifications', icon: }, { name: t('settingsUser'), href: `/user/${userId}`, icon: }, { name: t('sharedGeofences'), href: '/geofences', icon: }, diff --git a/modern/src/settings/PreferencesPage.js b/modern/src/settings/PreferencesPage.js new file mode 100644 index 00000000..39b76074 --- /dev/null +++ b/modern/src/settings/PreferencesPage.js @@ -0,0 +1,47 @@ +import React from 'react'; +import { + Accordion, AccordionSummary, AccordionDetails, makeStyles, Typography, Container, FormControl, InputLabel, Select, MenuItem, +} from '@material-ui/core'; +import { useLocalization, useTranslation } from '../LocalizationProvider'; +import OptionsLayout from './OptionsLayout'; + +const useStyles = makeStyles((theme) => ({ + container: { + marginTop: theme.spacing(2), + }, + details: { + flexDirection: 'column', + }, +})); + +const PreferencesPage = () => { + const classes = useStyles(); + const t = useTranslation(); + + const { languages, language, setLanguage } = useLocalization(); + const languageList = Object.entries(languages).map((values) => ({ code: values[0], name: values[1].name })); + + return ( + + + + + + {t('sharedPreferences')} + + + + + {t('loginLanguage')} + + + + + + + ); +}; + +export default PreferencesPage; -- cgit v1.2.3