aboutsummaryrefslogtreecommitdiff
path: root/modern/src/EventPage.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-05-08 13:16:57 -0700
committerAnton Tananaev <anton@traccar.org>2022-05-08 13:16:57 -0700
commit2cd374bb9fa941d7e2a6fd8aa5079893a158c98f (patch)
treef4ee48130592fed5de25dce7af4ac0cbeb017680 /modern/src/EventPage.js
parent2352071211b61c10fa5bf5736baaff7809d18bf0 (diff)
downloadtrackermap-web-2cd374bb9fa941d7e2a6fd8aa5079893a158c98f.tar.gz
trackermap-web-2cd374bb9fa941d7e2a6fd8aa5079893a158c98f.tar.bz2
trackermap-web-2cd374bb9fa941d7e2a6fd8aa5079893a158c98f.zip
Reorganize remaining files
Diffstat (limited to 'modern/src/EventPage.js')
-rw-r--r--modern/src/EventPage.js77
1 files changed, 0 insertions, 77 deletions
diff --git a/modern/src/EventPage.js b/modern/src/EventPage.js
deleted file mode 100644
index 2131baab..00000000
--- a/modern/src/EventPage.js
+++ /dev/null
@@ -1,77 +0,0 @@
-import React, { useState } from 'react';
-
-import {
- makeStyles, Typography, AppBar, Toolbar, IconButton,
-} from '@material-ui/core';
-import ArrowBackIcon from '@material-ui/icons/ArrowBack';
-import { useHistory, useParams } from 'react-router-dom';
-import ContainerDimensions from 'react-container-dimensions';
-import { useEffectAsync } from './reactHelper';
-import { useTranslation } from './LocalizationProvider';
-import Map from './map/core/Map';
-import PositionsMap from './map/PositionsMap';
-
-const useStyles = makeStyles(() => ({
- root: {
- height: '100%',
- display: 'flex',
- flexDirection: 'column',
- },
- mapContainer: {
- flexGrow: 1,
- },
-}));
-
-const EventPage = () => {
- const classes = useStyles();
- const history = useHistory();
- const t = useTranslation();
-
- const { id } = useParams();
-
- const [event, setEvent] = useState();
- const [position, setPosition] = useState();
-
- useEffectAsync(async () => {
- if (id) {
- const response = await fetch(`/api/events/${id}`);
- if (response.ok) {
- setEvent(await response.json());
- }
- }
- }, [id]);
-
- useEffectAsync(async () => {
- if (event && event.positionId) {
- const response = await fetch(`/api/positions?id=${event.positionId}`);
- if (response.ok) {
- const positions = await response.json();
- if (positions.length > 0) {
- setPosition(positions[0]);
- }
- }
- }
- }, [event]);
-
- return (
- <div className={classes.root}>
- <AppBar color="inherit" position="static">
- <Toolbar>
- <IconButton color="inherit" edge="start" onClick={() => history.push('/')}>
- <ArrowBackIcon />
- </IconButton>
- <Typography variant="h6">{t('positionEvent')}</Typography>
- </Toolbar>
- </AppBar>
- <div className={classes.mapContainer}>
- <ContainerDimensions>
- <Map>
- {position && <PositionsMap positions={[position]} />}
- </Map>
- </ContainerDimensions>
- </div>
- </div>
- );
-};
-
-export default EventPage;