mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-28 23:50:08 +00:00
feat(flight-live): a live boarding pass on the web, desktop and phone
The booking dialog and the phone's transport sheet show a flight's moment, both airports with planned and expected times, the route as an arc with the aircraft on it and the numbers of the flight; booking cards and day plan rows get a one-line state with a progress bar. The trip map draws the aircraft in the air on Leaflet and GL, and the admin settings carry the switch. Translated into every language.
This commit is contained in:
@@ -23,6 +23,7 @@ import { markerPhotoHtml, placePhotoFull, placePhotoUrl } from './placePhoto'
|
||||
import { isStandardFamily, supportsCustom3d, wantsTerrain, addCustom3dBuildings, addTerrainAndSky } from './mapboxSetup'
|
||||
import { attachLocationMarker, type LocationMarkerHandle } from './locationMarkerMapbox'
|
||||
import { ReservationMapboxOverlay } from './reservationsMapbox'
|
||||
import { useFlightAircraftGL } from './useFlightAircraftGL'
|
||||
import { useTransportRoutes } from '../../hooks/useTransportRoutes'
|
||||
import { visibleRouteReservations } from '../../utils/reservationRoutes'
|
||||
import { safeHexColor } from '../../utils/safeColor'
|
||||
@@ -1838,22 +1839,19 @@ export function MapViewGL({
|
||||
useEffect(() => {
|
||||
const map = mapRef.current
|
||||
if (!map || !mapReady) return
|
||||
if (!reservationOverlayRef.current) {
|
||||
reservationOverlayRef.current = new ReservationMapboxOverlay(map, {
|
||||
showConnections: true,
|
||||
showStats: showReservationStats,
|
||||
showEndpointLabels,
|
||||
onEndpointClick: (id) => onReservationClickRef.current?.(id),
|
||||
}, gl.Marker as any)
|
||||
}
|
||||
reservationOverlayRef.current.update(visibleReservations, {
|
||||
const options = {
|
||||
showConnections: true,
|
||||
showStats: showReservationStats,
|
||||
showEndpointLabels,
|
||||
onEndpointClick: (id) => onReservationClickRef.current?.(id),
|
||||
}, transportRoutes)
|
||||
onEndpointClick: (id: number) => onReservationClickRef.current?.(id),
|
||||
}
|
||||
reservationOverlayRef.current ??= new ReservationMapboxOverlay(map, options, gl.Marker as any)
|
||||
reservationOverlayRef.current.update(visibleReservations, options, transportRoutes)
|
||||
}, [visibleReservations, transportRoutes, showReservationStats, showEndpointLabels, mapReady, glProvider])
|
||||
|
||||
// The trip's flights in the air, as on the Leaflet map.
|
||||
useFlightAircraftGL(mapRef, mapReady, gl?.Marker, id => onReservationClickRef.current?.(id), reservations)
|
||||
|
||||
// Fit bounds on fitKey change — matches the Leaflet BoundsController
|
||||
const paddingOpts = useMemo(() => {
|
||||
if (isMobile) return { top: 40, right: 20, bottom: 40, left: 20 }
|
||||
|
||||
Reference in New Issue
Block a user