diff --git a/client/src/components/Map/MapView.tsx b/client/src/components/Map/MapView.tsx index a62099912..5293f1c07 100644 --- a/client/src/components/Map/MapView.tsx +++ b/client/src/components/Map/MapView.tsx @@ -428,6 +428,7 @@ export const MapView = memo(function MapView({ reservations = [] as Reservation[], showReservationStats = false, visibleConnectionIds = [] as number[], + showTransitRoutes = true, onReservationClick, pois = [] as Poi[], onPoiClick, @@ -446,9 +447,10 @@ export const MapView = memo(function MapView({ )), [pois, onPoiClick]) const visibleReservations = useMemo(() => { const set = new Set(visibleConnectionIds || []) - // Transit journeys are part of the plan itself — always on the map (#1065). - return reservations.filter((r: Reservation) => r.type === 'transit' || set.has(r.id)) - }, [reservations, visibleConnectionIds]) + // Transit journeys ride the route toggle — they are part of the computed + // day route, so hiding the route hides them too (#1065). + return reservations.filter((r: Reservation) => (r.type === 'transit' && showTransitRoutes) || set.has(r.id)) + }, [reservations, visibleConnectionIds, showTransitRoutes]) // Dynamic padding: account for sidebars + bottom inspector + day detail panel const paddingOpts = useMemo((): L.FitBoundsOptions => { const isMobile = typeof window !== 'undefined' && window.innerWidth < 768 diff --git a/client/src/components/Map/MapViewGL.tsx b/client/src/components/Map/MapViewGL.tsx index 0f8749075..51011ced1 100644 --- a/client/src/components/Map/MapViewGL.tsx +++ b/client/src/components/Map/MapViewGL.tsx @@ -81,6 +81,7 @@ interface Props { hasDayDetail?: boolean reservations?: Reservation[] visibleConnectionIds?: number[] + showTransitRoutes?: boolean showReservationStats?: boolean onReservationClick?: (reservationId: number) => void pois?: Poi[] @@ -199,6 +200,7 @@ export function MapViewGL({ hasDayDetail = false, reservations = [], visibleConnectionIds = [], + showTransitRoutes = true, showReservationStats = false, onReservationClick, pois = [], @@ -801,9 +803,10 @@ export function MapViewGL({ // booking's route, matching the Leaflet MapView's behaviour. const visibleReservations = useMemo(() => { const set = new Set(visibleConnectionIds || []) - // Transit journeys are part of the plan itself — always on the map (#1065). - return reservations.filter(r => r.type === 'transit' || set.has(r.id)) - }, [reservations, visibleConnectionIds]) + // Transit journeys ride the route toggle — they are part of the computed + // day route, so hiding the route hides them too (#1065). + return reservations.filter(r => (r.type === 'transit' && showTransitRoutes) || set.has(r.id)) + }, [reservations, visibleConnectionIds, showTransitRoutes]) useEffect(() => { const map = mapRef.current diff --git a/client/src/components/Map/ReservationOverlay.tsx b/client/src/components/Map/ReservationOverlay.tsx index 1df0bbec5..33d45f564 100644 --- a/client/src/components/Map/ReservationOverlay.tsx +++ b/client/src/components/Map/ReservationOverlay.tsx @@ -414,7 +414,7 @@ export default function ReservationOverlay({ reservations, showConnections, show for (const item of visibleItems) { const fromPx = map.latLngToContainerPoint([item.from.lat, item.from.lng]) const toPx = map.latLngToContainerPoint([item.to.lat, item.to.lng]) - const minPx = item.type === 'flight' ? 50 : item.type === 'cruise' ? 300 : item.type === 'car' ? 150 : 400 + const minPx = item.type === 'flight' ? 50 : item.type === 'cruise' ? 300 : item.type === 'car' ? 150 : item.type === 'transit' ? 900 : 400 if (fromPx.distanceTo(toPx) >= minPx) set.add(item.res.id) } return set diff --git a/client/src/components/Map/reservationsMapbox.ts b/client/src/components/Map/reservationsMapbox.ts index 139c6113e..34072ad9d 100644 --- a/client/src/components/Map/reservationsMapbox.ts +++ b/client/src/components/Map/reservationsMapbox.ts @@ -331,7 +331,7 @@ export class ReservationMapboxOverlay { const toPx = map.project([item.to.lng, item.to.lat]) const dx = fromPx.x - toPx.x, dy = fromPx.y - toPx.y const dist = Math.sqrt(dx * dx + dy * dy) - const minPx = item.type === 'flight' ? 50 : item.type === 'cruise' ? 300 : item.type === 'car' ? 150 : 400 + const minPx = item.type === 'flight' ? 50 : item.type === 'cruise' ? 300 : item.type === 'car' ? 150 : item.type === 'transit' ? 900 : 400 if (dist >= minPx) labelVisibleIds.add(item.res.id) } catch { /* ignore */ } } diff --git a/client/src/components/Planner/ReservationsPanel.tsx b/client/src/components/Planner/ReservationsPanel.tsx index 9ad2eecb6..a083b1eaf 100644 --- a/client/src/components/Planner/ReservationsPanel.tsx +++ b/client/src/components/Planner/ReservationsPanel.tsx @@ -561,7 +561,9 @@ function TransitJourneyCard({ r, days, onOpen, onDelete, canEdit }: { {r.notes && (