From 6f842e81435d0c4e5822de3c80cda084ab2bf462 Mon Sep 17 00:00:00 2001 From: Eugene Burmakin Date: Thu, 21 Aug 2025 19:48:32 +0200 Subject: [PATCH] Make visit popup look nicer --- app/javascript/maps/visits.js | 66 ++++++++++++++++++++++---------- app/javascript/styles/visits.css | 39 +++++++++++++++++++ 2 files changed, 84 insertions(+), 21 deletions(-) diff --git a/app/javascript/maps/visits.js b/app/javascript/maps/visits.js index 0ceeb415..b55b52d2 100644 --- a/app/javascript/maps/visits.js +++ b/app/javascript/maps/visits.js @@ -1326,30 +1326,38 @@ export class VisitsManager { // Create popup content with form and dropdown const defaultName = visit.name; const popupContent = ` -
-
-
+
+
+
${dateTimeDisplay.trim()}
-
- - Duration: ${durationText}, - - - status: ${visit.status.charAt(0).toUpperCase() + visit.status.slice(1)} - - ${visit.place.latitude}, ${visit.place.longitude} +
+
+ Duration: ${durationText} +
+
+ Status: ${visit.status.charAt(0).toUpperCase() + visit.status.slice(1)} +
+
+ ${visit.place.latitude}, ${visit.place.longitude} +
-
+
+
-
- ${possiblePlaces.map(place => `
-
- +
+ ${visit.status !== 'confirmed' ? ` - - + + ` : ''}
@@ -1374,8 +1397,9 @@ export class VisitsManager { closeOnClick: true, autoClose: true, closeOnEscapeKey: true, - maxWidth: 450, // Set maximum width - minWidth: 300 // Set minimum width + maxWidth: 420, // Set maximum width + minWidth: 320, // Set minimum width + className: 'visit-popup' // Add custom class for additional styling }) .setLatLng([visit.place.latitude, visit.place.longitude]) .setContent(popupContent); diff --git a/app/javascript/styles/visits.css b/app/javascript/styles/visits.css index c43cb036..5852d002 100644 --- a/app/javascript/styles/visits.css +++ b/app/javascript/styles/visits.css @@ -15,3 +15,42 @@ .merge-visits-button { margin: 8px 0; } + +/* Visit popup styling */ +.visit-popup .leaflet-popup-content-wrapper { + border-radius: 0.5rem; + border: none; + box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); + padding: 0; + overflow: hidden; +} + +.visit-popup .leaflet-popup-content { + margin: 0; + line-height: 1.5; +} + +.visit-popup .leaflet-popup-tip { + border-top-color: hsl(var(--b1)); +} + +.visit-popup .leaflet-popup-close-button { + color: hsl(var(--bc)) !important; + font-size: 18px !important; + font-weight: bold !important; + top: 8px !important; + right: 8px !important; + width: 24px !important; + height: 24px !important; + text-align: center !important; + line-height: 24px !important; + background: hsl(var(--b2)) !important; + border-radius: 50% !important; + border: none !important; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important; +} + +.visit-popup .leaflet-popup-close-button:hover { + background: hsl(var(--b3)) !important; + color: hsl(var(--bc)) !important; +}