aboutsummaryrefslogtreecommitdiff
path: root/modern/src/reports/ReplayPage.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-11-14 16:13:58 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2020-11-14 16:13:58 -0800
commitec8fed96e394ff252c7e98bed1ca2e5322ad650a (patch)
tree447c6e6946935047763bc2dd8cb50ae8c5ea4fbe /modern/src/reports/ReplayPage.js
parentbcef1fda0756f0ef1afbb53c26f6cbab4dcfeba8 (diff)
downloadtrackermap-web-ec8fed96e394ff252c7e98bed1ca2e5322ad650a.tar.gz
trackermap-web-ec8fed96e394ff252c7e98bed1ca2e5322ad650a.tar.bz2
trackermap-web-ec8fed96e394ff252c7e98bed1ca2e5322ad650a.zip
More cleanup
Diffstat (limited to 'modern/src/reports/ReplayPage.js')
-rw-r--r--modern/src/reports/ReplayPage.js31
1 files changed, 5 insertions, 26 deletions
diff --git a/modern/src/reports/ReplayPage.js b/modern/src/reports/ReplayPage.js
index 6b84d4d9..5c27cb52 100644
--- a/modern/src/reports/ReplayPage.js
+++ b/modern/src/reports/ReplayPage.js
@@ -1,13 +1,13 @@
import React, { useState } from 'react';
-import { Accordion, AccordionDetails, AccordionSummary, Button, Container, FormControl, makeStyles, Paper, Slider, Tooltip, Typography } from '@material-ui/core';
+import { Accordion, AccordionDetails, AccordionSummary, Container, makeStyles, Paper, Slider, Tooltip, Typography } from '@material-ui/core';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import MainToolbar from '../MainToolbar';
import Map from '../map/Map';
import t from '../common/localization';
-import FilterForm from './FilterForm';
import ReplayPathMap from '../map/ReplayPathMap';
import PositionsMap from '../map/PositionsMap';
import { formatPosition } from '../common/formatter';
+import ReportFilter from './ReportFilter';
const useStyles = makeStyles(theme => ({
root: {
@@ -43,21 +43,11 @@ const ReplayPage = () => {
const classes = useStyles();
const [expanded, setExpanded] = useState(true);
-
- const [deviceId, setDeviceId] = useState();
- const [from, setFrom] = useState();
- const [to, setTo] = useState();
-
const [positions, setPositions] = useState([]);
-
const [index, setIndex] = useState(0);
- const handleShow = async () => {
- const query = new URLSearchParams({
- deviceId,
- from: from.toISOString(),
- to: to.toISOString(),
- });
+ const handleSubmit = async (deviceId, from, to) => {
+ const query = new URLSearchParams({ deviceId, from, to });
const response = await fetch(`/api/positions?${query.toString()}`, { headers: { 'Accept': 'application/json' } });
if (response.ok) {
setIndex(0);
@@ -98,18 +88,7 @@ const ReplayPage = () => {
</Typography>
</AccordionSummary>
<AccordionDetails className={classes.configForm}>
- <FilterForm
- deviceId={deviceId}
- setDeviceId={setDeviceId}
- from={from}
- setFrom={setFrom}
- to={to}
- setTo={setTo} />
- <FormControl margin='normal' fullWidth>
- <Button type='button' color='primary' variant='contained' disabled={!deviceId} onClick={handleShow}>
- {t('reportShow')}
- </Button>
- </FormControl>
+ <ReportFilter handleSubmit={handleSubmit} />;
</AccordionDetails>
</Accordion>
</div>