aboutsummaryrefslogtreecommitdiff
path: root/modern/src/settings/PreferencesPage.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-05-01 17:23:27 -0700
committerAnton Tananaev <anton@traccar.org>2022-05-01 17:23:27 -0700
commit3e388e438f0e250bd1852c6fa54f9012f33aea6f (patch)
tree909274be4a1623275420b3d5a19a2846fd9af8a9 /modern/src/settings/PreferencesPage.js
parent05a7a75d6db6185bbea02df51a8506a9b1611bb3 (diff)
downloadtrackermap-web-3e388e438f0e250bd1852c6fa54f9012f33aea6f.tar.gz
trackermap-web-3e388e438f0e250bd1852c6fa54f9012f33aea6f.tar.bz2
trackermap-web-3e388e438f0e250bd1852c6fa54f9012f33aea6f.zip
Add map follow preference
Diffstat (limited to 'modern/src/settings/PreferencesPage.js')
-rw-r--r--modern/src/settings/PreferencesPage.js26
1 files changed, 24 insertions, 2 deletions
diff --git a/modern/src/settings/PreferencesPage.js b/modern/src/settings/PreferencesPage.js
index 39b76074..d9d0c87e 100644
--- a/modern/src/settings/PreferencesPage.js
+++ b/modern/src/settings/PreferencesPage.js
@@ -1,9 +1,11 @@
import React from 'react';
import {
- Accordion, AccordionSummary, AccordionDetails, makeStyles, Typography, Container, FormControl, InputLabel, Select, MenuItem,
+ Accordion, AccordionSummary, AccordionDetails, makeStyles, Typography, Container, FormControl, InputLabel, Select, MenuItem, Checkbox, FormControlLabel,
} from '@material-ui/core';
+import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import { useLocalization, useTranslation } from '../LocalizationProvider';
import OptionsLayout from './OptionsLayout';
+import usePersistedState from '../common/usePersistedState';
const useStyles = makeStyles((theme) => ({
container: {
@@ -21,11 +23,14 @@ const PreferencesPage = () => {
const { languages, language, setLanguage } = useLocalization();
const languageList = Object.entries(languages).map((values) => ({ code: values[0], name: values[1].name }));
+ const [mapLiveRoutes, setMapLiveRoutes] = usePersistedState('mapLiveRoutes', false);
+ const [mapFollow, setMapFollow] = usePersistedState('mapFollow', false);
+
return (
<OptionsLayout>
<Container maxWidth="xs" className={classes.container}>
<Accordion defaultExpanded>
- <AccordionSummary>
+ <AccordionSummary expandIcon={<ExpandMoreIcon />}>
<Typography variant="subtitle1">
{t('sharedPreferences')}
</Typography>
@@ -39,6 +44,23 @@ const PreferencesPage = () => {
</FormControl>
</AccordionDetails>
</Accordion>
+ <Accordion>
+ <AccordionSummary expandIcon={<ExpandMoreIcon />}>
+ <Typography variant="subtitle1">
+ {t('mapTitle')}
+ </Typography>
+ </AccordionSummary>
+ <AccordionDetails className={classes.details}>
+ <FormControlLabel
+ control={<Checkbox checked={mapLiveRoutes} onChange={(event) => setMapLiveRoutes(event.target.checked)} />}
+ label={t('mapLiveRoutes')}
+ />
+ <FormControlLabel
+ control={<Checkbox checked={mapFollow} onChange={(event) => setMapFollow(event.target.checked)} />}
+ label={t('deviceFollow')}
+ />
+ </AccordionDetails>
+ </Accordion>
</Container>
</OptionsLayout>
);