diff options
author | Ashutosh Bishnoi <mail2bishnoi@gmail.com> | 2020-12-02 11:09:08 +0530 |
---|---|---|
committer | Ashutosh Bishnoi <mail2bishnoi@gmail.com> | 2020-12-02 11:09:08 +0530 |
commit | b497c4fbf7caabd38b902d225ae0229b33323309 (patch) | |
tree | 885e43fc34d0caae8538bceb538ff4835ceca1b2 /modern/src/reports/ChartReportPage.js | |
parent | 3b066354210c22fff82f40ce3d30521d55d81533 (diff) | |
download | trackermap-web-b497c4fbf7caabd38b902d225ae0229b33323309.tar.gz trackermap-web-b497c4fbf7caabd38b902d225ae0229b33323309.tar.bz2 trackermap-web-b497c4fbf7caabd38b902d225ae0229b33323309.zip |
Chart report layout refactoring
Diffstat (limited to 'modern/src/reports/ChartReportPage.js')
-rw-r--r-- | modern/src/reports/ChartReportPage.js | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/modern/src/reports/ChartReportPage.js b/modern/src/reports/ChartReportPage.js index 10626273..841f1e73 100644 --- a/modern/src/reports/ChartReportPage.js +++ b/modern/src/reports/ChartReportPage.js @@ -1,13 +1,14 @@ import React, { useState } from 'react'; -import { Box, Paper } from '@material-ui/core'; +import { Box, Paper, FormControl, InputLabel, Select, MenuItem } from '@material-ui/core'; import ReportFilter from './ReportFilter'; import ReportLayoutPage from './ReportLayoutPage'; import { useAttributePreference } from '../common/preferences'; import { formatDate } from '../common/formatter'; import { speedConverter } from '../common/converter'; import {LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts'; +import t from '../common/localization'; -const ReportFilterForm = ({ setItems }) => { +const ReportFilterForm = ({ setItems, type, setType }) => { const speedUnit = useAttributePreference('speedUnit'); @@ -32,7 +33,17 @@ const ReportFilterForm = ({ setItems }) => { } return ( - <ReportFilter handleSubmit={handleSubmit} showOnly /> + <React.Fragment> + <ReportFilter handleSubmit={handleSubmit} showOnly /> + <FormControl variant="filled" margin="normal" fullWidth> + <InputLabel>{t('reportChartType')}</InputLabel> + <Select value={type} onChange={e => setType(e.target.value)}> + <MenuItem value="speed">{t('positionSpeed')}</MenuItem> + <MenuItem value="accuracy">{t('positionAccuracy')}</MenuItem> + <MenuItem value="altitude">{t('positionAltitude')}</MenuItem> + </Select> + </FormControl> + </React.Fragment> ) }; @@ -52,7 +63,7 @@ const ChartReportPage = () => { const [type, setType] = useState('speed'); return ( - <ReportLayoutPage reportFilterForm={ReportFilterForm} setItems={setItems} type={type} setType={setType} showChartType> + <ReportLayoutPage reportFilterForm={ReportFilterForm} setItems={setItems} type={type} setType={setType}> <Paper> <Box height={400}> <ResponsiveContainer> |