From 47fdc633966a8f2baefb5424042de6be2ecd1ab6 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 28 May 2022 07:37:24 -0700 Subject: Add map to stops report --- modern/src/main/MainPage.js | 8 +- modern/src/map/MapCamera.js | 18 +++++ modern/src/map/MapCurrentLocation.js | 2 +- modern/src/map/MapGeofenceEdit.js | 2 +- modern/src/map/MapPadding.js | 2 +- modern/src/map/MapPositions.js | 6 +- modern/src/map/MapRoutePath.js | 2 +- modern/src/map/core/Map.js | 134 ------------------------------- modern/src/map/core/MapView.js | 134 +++++++++++++++++++++++++++++++ modern/src/map/main/MapAccuracy.js | 2 +- modern/src/map/main/MapDefaultCamera.js | 2 +- modern/src/map/main/MapGeofence.js | 2 +- modern/src/map/main/MapLiveRoutes.js | 2 +- modern/src/map/main/MapSelectedDevice.js | 2 +- modern/src/map/main/PoiMap.js | 2 +- modern/src/other/EventPage.js | 6 +- modern/src/other/GeofencesPage.js | 6 +- modern/src/other/ReplayPage.js | 6 +- modern/src/reports/RouteReportPage.js | 6 +- modern/src/reports/StopReportPage.js | 80 +++++++++++++----- 20 files changed, 239 insertions(+), 185 deletions(-) create mode 100644 modern/src/map/MapCamera.js delete mode 100644 modern/src/map/core/Map.js create mode 100644 modern/src/map/core/MapView.js (limited to 'modern') diff --git a/modern/src/main/MainPage.js b/modern/src/main/MainPage.js index b3b23aab..f9341eb6 100644 --- a/modern/src/main/MainPage.js +++ b/modern/src/main/MainPage.js @@ -15,7 +15,7 @@ import ListIcon from '@mui/icons-material/ViewList'; import { useDispatch, useSelector } from 'react-redux'; import DevicesList from './DevicesList'; -import Map from '../map/core/Map'; +import MapView from '../map/core/MapView'; import MapSelectedDevice from '../map/main/MapSelectedDevice'; import MapAccuracy from '../map/main/MapAccuracy'; import MapGeofence from '../map/main/MapGeofence'; @@ -149,15 +149,15 @@ const MainPage = () => { return (
- + {mapLiveRoutes && } - + - + {desktop && }
); diff --git a/modern/src/other/GeofencesPage.js b/modern/src/other/GeofencesPage.js index 6706ec98..fce15a39 100644 --- a/modern/src/other/GeofencesPage.js +++ b/modern/src/other/GeofencesPage.js @@ -7,7 +7,7 @@ import { useTheme } from '@mui/material/styles'; import Drawer from '@mui/material/Drawer'; import ArrowBackIcon from '@mui/icons-material/ArrowBack'; import { useNavigate } from 'react-router-dom'; -import Map from '../map/core/Map'; +import MapView from '../map/core/MapView'; import MapCurrentLocation from '../map/MapCurrentLocation'; import MapGeofenceEdit from '../map/MapGeofenceEdit'; import GeofencesList from './GeofencesList'; @@ -77,10 +77,10 @@ const GeofencesPage = () => {
- + - +
diff --git a/modern/src/other/ReplayPage.js b/modern/src/other/ReplayPage.js index fcf01fc7..4893dda9 100644 --- a/modern/src/other/ReplayPage.js +++ b/modern/src/other/ReplayPage.js @@ -13,7 +13,7 @@ import FastForwardIcon from '@mui/icons-material/FastForward'; import FastRewindIcon from '@mui/icons-material/FastRewind'; import { useNavigate } from 'react-router-dom'; import { useSelector } from 'react-redux'; -import Map from '../map/core/Map'; +import MapView from '../map/core/MapView'; import MapRoutePath from '../map/MapRoutePath'; import MapPositions from '../map/MapPositions'; import { formatTime } from '../common/util/formatter'; @@ -143,12 +143,12 @@ const ReplayPage = () => { return (
- + {index < positions.length && ( )} - +
diff --git a/modern/src/reports/RouteReportPage.js b/modern/src/reports/RouteReportPage.js index b29fb269..33bc9350 100644 --- a/modern/src/reports/RouteReportPage.js +++ b/modern/src/reports/RouteReportPage.js @@ -13,7 +13,7 @@ import PositionValue from '../common/components/PositionValue'; import ColumnSelect from './components/ColumnSelect'; import usePositionAttributes from '../common/attributes/usePositionAttributes'; import { useCatch } from '../reactHelper'; -import Map from '../map/core/Map'; +import MapView from '../map/core/MapView'; import MapRoutePath from '../map/MapRoutePath'; import MapPositions from '../map/MapPositions'; import useReportStyles from './common/useReportStyles'; @@ -52,10 +52,10 @@ const RouteReportPage = () => {
{selectedItem && (
- + - +
)}
diff --git a/modern/src/reports/StopReportPage.js b/modern/src/reports/StopReportPage.js index d2823b06..d44e2046 100644 --- a/modern/src/reports/StopReportPage.js +++ b/modern/src/reports/StopReportPage.js @@ -1,7 +1,10 @@ import React, { useState } from 'react'; import { + IconButton, Table, TableBody, TableCell, TableHead, TableRow, } from '@mui/material'; +import GpsFixedIcon from '@mui/icons-material/GpsFixed'; +import LocationSearchingIcon from '@mui/icons-material/LocationSearching'; import { formatDistance, formatHours, formatDate, formatVolume, } from '../common/util/formatter'; @@ -14,6 +17,9 @@ import ColumnSelect from './components/ColumnSelect'; import usePersistedState from '../common/util/usePersistedState'; import { useCatch } from '../reactHelper'; import useReportStyles from './common/useReportStyles'; +import MapPositions from '../map/MapPositions'; +import MapView from '../map/core/MapView'; +import MapCamera from '../map/MapCamera'; const columnsArray = [ ['startTime', 'reportStartTime'], @@ -35,6 +41,7 @@ const StopReportPage = () => { const [columns, setColumns] = usePersistedState('stopColumns', ['startTime', 'endTime', 'startOdometer', 'address']); const [items, setItems] = useState([]); + const [selectedItem, setSelectedItem] = useState(null); const handleSubmit = useCatch(async (deviceId, from, to, mail, headers) => { const query = new URLSearchParams({ @@ -75,29 +82,58 @@ const StopReportPage = () => { return ( } breadcrumbs={['reportTitle', 'reportStops']}> -
- - - -
- - - - {columns.map((key) => ({t(columnsMap.get(key))}))} - - - - {items.map((item) => ( - - {columns.map((key) => ( - - {formatValue(item, key)} - +
+ {selectedItem && ( +
+ + + + +
+ )} +
+
+ + + +
+
+ + + + {columns.map((key) => ({t(columnsMap.get(key))}))} + + + + {items.map((item) => ( + + + {selectedItem === item ? ( + setSelectedItem(null)}> + + + ) : ( + setSelectedItem(item)}> + + + )} + + {columns.map((key) => ( + + {formatValue(item, key)} + + ))} + ))} - - ))} - -
+ + +
+
); }; -- cgit v1.2.3