diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-09-21 22:33:41 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-09-21 22:33:41 -0700 |
commit | c25bacf17fe72fdcb8102503f3f1c4c208d469b8 (patch) | |
tree | 4b108270ec3786bf693dc4f11cdf8c0733f522ff /modern/src/DevicePage.js | |
parent | 59d6a589b0fad3d3b448eb65c9288d861d01c11f (diff) | |
download | trackermap-web-c25bacf17fe72fdcb8102503f3f1c4c208d469b8.tar.gz trackermap-web-c25bacf17fe72fdcb8102503f3f1c4c208d469b8.tar.bz2 trackermap-web-c25bacf17fe72fdcb8102503f3f1c4c208d469b8.zip |
Implement category selection
Diffstat (limited to 'modern/src/DevicePage.js')
-rw-r--r-- | modern/src/DevicePage.js | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/modern/src/DevicePage.js b/modern/src/DevicePage.js index 900b279b..a4b2e8b0 100644 --- a/modern/src/DevicePage.js +++ b/modern/src/DevicePage.js @@ -3,7 +3,7 @@ import TextField from '@material-ui/core/TextField'; import t from './common/localization'; import EditItemView from './EditItemView'; -import { Accordion, AccordionSummary, AccordionDetails, makeStyles, Typography } from '@material-ui/core'; +import { Accordion, AccordionSummary, AccordionDetails, makeStyles, Typography, FormControl, InputLabel, Select } from '@material-ui/core'; import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; const useStyles = makeStyles(() => ({ @@ -12,6 +12,30 @@ const useStyles = makeStyles(() => ({ }, })); +const deviceCategories = [ + 'default', + 'animal', + 'bicycle', + 'boat', + 'bus', + 'car', + 'crane', + 'helicopter', + 'motorcycle', + 'offroad', + 'person', + 'pickup', + 'plane', + 'ship', + 'tractor', + 'train', + 'tram', + 'trolleybus', + 'truck', + 'van', + 'scooter', +]; + const DevicePage = () => { const classes = useStyles(); @@ -67,6 +91,17 @@ const DevicePage = () => { onChange={(event) => setItem({...item, contact: event.target.value})} label={t('deviceContact')} variant="filled" /> + <FormControl margin="normal" variant="filled"> + <InputLabel>{t('deviceCategory')}</InputLabel> + <Select + native + defaultValue={item.category} + onChange={(event) => setItem({...item, category: event.target.value})}> + {deviceCategories.map((category) => ( + <option value={category}>{t(`category${category.replace(/^\w/, c => c.toUpperCase())}`)}</option> + ))} + </Select> + </FormControl> </AccordionDetails> </Accordion> </> |