diff --git a/app/javascript/controllers/maps_controller.js b/app/javascript/controllers/maps_controller.js
index ea94576f..b336b264 100644
--- a/app/javascript/controllers/maps_controller.js
+++ b/app/javascript/controllers/maps_controller.js
@@ -65,15 +65,12 @@ export default class extends Controller {
// Create markers for the start and end points
const startMarker = L.marker([startPoint[0], startPoint[1]], { icon: startIcon }).bindPopup(`Start: ${firstTimestamp}`);
-
const endMarker = L.marker([endPoint[0], endPoint[1]], { icon: finishIcon }).bindPopup(`
- Start: ${firstTimestamp}
- End: ${lastTimestamp}
- Time on route: ${timeOnRoute} minutes
- Distance to previous route: ${Math.round(distanceToPrev)} meters
- Distance to next route: ${Math.round(distanceToNext)} meters
- Time from previous route: ${timeBetweenPrev} minutes
- Time to next route: ${timeBetweenNext} minutes
+ Start: ${firstTimestamp}
+ End: ${lastTimestamp}
+ Duration: ${timeOnRoute} min
+ Prev Route: ${Math.round(distanceToPrev)} m, ${timeBetweenPrev} min away
+ Next Route: ${Math.round(distanceToNext)} m, ${timeBetweenNext} min away
`);
// Add mouseover event to highlight the polyline and show the start and end markers
@@ -85,13 +82,12 @@ export default class extends Controller {
// Add mouseout event to revert the polyline style and remove the start and end markers
polyline.on('mouseout', function(e) {
- polyline.setStyle(originalStyle);
- map.closePopup();
- map.removeLayer(startMarker);
- map.removeLayer(endMarker);
+ polyline.setStyle(originalStyle);
+ map.closePopup();
+ map.removeLayer(startMarker);
+ map.removeLayer(endMarker);
});
- }
-
+ }
var splitPolylines = [];
var currentPolyline = [];