From d212a2897ec3c7f0cb7b4a4556e9147bb29a8aae Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 16 Oct 2022 17:37:57 -0700 Subject: Add replay card --- modern/src/other/ReplayPage.js | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) (limited to 'modern/src/other/ReplayPage.js') diff --git a/modern/src/other/ReplayPage.js b/modern/src/other/ReplayPage.js index 46f7571c..fb83d5a9 100644 --- a/modern/src/other/ReplayPage.js +++ b/modern/src/other/ReplayPage.js @@ -1,5 +1,5 @@ import React, { - useState, useEffect, useRef, useCallback, + useState, useEffect, useRef, } from 'react'; import { IconButton, Paper, Slider, Toolbar, Typography, @@ -23,6 +23,7 @@ import { useTranslation } from '../common/components/LocalizationProvider'; import { useCatch } from '../reactHelper'; import MapCamera from '../map/MapCamera'; import MapGeofence from '../map/MapGeofence'; +import StatusCard from '../common/components/StatusCard'; const useStyles = makeStyles((theme) => ({ root: { @@ -71,6 +72,18 @@ const useStyles = makeStyles((theme) => ({ marginTop: theme.spacing(1), }, }, + statusCard: { + position: 'fixed', + zIndex: 5, + left: '50%', + [theme.breakpoints.up('md')]: { + bottom: theme.spacing(3), + }, + [theme.breakpoints.down('md')]: { + bottom: `calc(${theme.spacing(3)} + ${theme.dimensions.bottomBarHeight}px)`, + }, + transform: 'translateX(-50%)', + }, })); const ReplayPage = () => { @@ -84,6 +97,7 @@ const ReplayPage = () => { const [positions, setPositions] = useState([]); const [index, setIndex] = useState(0); const [selectedDeviceId, setSelectedDeviceId] = useState(defaultDeviceId); + const [showCard, setShowCard] = useState(false); const [from, setFrom] = useState(); const [to, setTo] = useState(); const [expanded, setExpanded] = useState(true); @@ -99,12 +113,6 @@ const ReplayPage = () => { return null; }); - const onClick = useCallback((positionId) => { - if (positionId) { - navigate(`/position/${positionId}`); - } - }, [navigate]); - useEffect(() => { if (playing && positions.length > 0) { timerRef.current = setInterval(() => { @@ -155,7 +163,10 @@ const ReplayPage = () => { {index < positions.length && ( - + setShowCard(true)} + /> )} @@ -209,6 +220,16 @@ const ReplayPage = () => { )} + {showCard && index < positions.length && ( +
+ setShowCard(false)} + disableActions + /> +
+ )} ); }; -- cgit v1.2.3