aboutsummaryrefslogtreecommitdiff
path: root/modern/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-02-03 15:13:48 -0800
committerAnton Tananaev <anton@traccar.org>2023-02-03 15:13:48 -0800
commit266f4cc2d14e14c1bbd273eed5708b9abde6159a (patch)
tree843c47cbd88cad0abbdab660d93a67b13c87d9dc /modern/src
parent84ae7fa37557db0cf498bc639f33d0ac333816a4 (diff)
downloadtrackermap-web-266f4cc2d14e14c1bbd273eed5708b9abde6159a.tar.gz
trackermap-web-266f4cc2d14e14c1bbd273eed5708b9abde6159a.tar.bz2
trackermap-web-266f4cc2d14e14c1bbd273eed5708b9abde6159a.zip
Add simple markers
Diffstat (limited to 'modern/src')
-rw-r--r--modern/src/map/MapMarkers.js2
-rw-r--r--modern/src/reports/CombinedReportPage.js10
2 files changed, 11 insertions, 1 deletions
diff --git a/modern/src/map/MapMarkers.js b/modern/src/map/MapMarkers.js
index 2fbfceea..7cb3b8a5 100644
--- a/modern/src/map/MapMarkers.js
+++ b/modern/src/map/MapMarkers.js
@@ -43,7 +43,7 @@ const MapMarkers = ({ markers }) => {
},
properties: {
category: category || 'default',
- color,
+ color: color || 'neutral',
},
})),
});
diff --git a/modern/src/reports/CombinedReportPage.js b/modern/src/reports/CombinedReportPage.js
index 59d5fb69..4efc7b9c 100644
--- a/modern/src/reports/CombinedReportPage.js
+++ b/modern/src/reports/CombinedReportPage.js
@@ -17,6 +17,7 @@ import MapGeofence from '../map/MapGeofence';
import { formatTime } from '../common/util/formatter';
import { usePreference } from '../common/util/preferences';
import { prefixString } from '../common/util/stringUtils';
+import MapMarkers from '../map/MapMarkers';
const CombinedReportPage = () => {
const classes = useReportStyles();
@@ -29,6 +30,14 @@ const CombinedReportPage = () => {
const [items, setItems] = useState([]);
const [loading, setLoading] = useState(false);
+ const createMarkers = () => items.flatMap((item) => item.events.map((event) => {
+ const position = item.positions.find((p) => event.positionId === p.id);
+ return {
+ latitude: position.latitude,
+ longitude: position.longitude,
+ };
+ }));
+
const handleSubmit = useCatch(async ({ deviceIds, groupIds, from, to }) => {
const query = new URLSearchParams({ from, to });
deviceIds.forEach((deviceId) => query.append('deviceId', deviceId));
@@ -60,6 +69,7 @@ const CombinedReportPage = () => {
coordinates={item.route}
/>
))}
+ <MapMarkers markers={createMarkers()} />
</MapView>
<MapCamera coordinates={items.flatMap((item) => item.route)} />
</div>