Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support naming and keying transit vehicle overlay #1297

Merged
merged 6 commits into from
Nov 25, 2024
Merged
11 changes: 10 additions & 1 deletion lib/components/map/default-map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,9 @@ class DefaultMap extends Component {
const baseLayerUrls = baseLayersWithNames?.map((bl) => bl.url)
const baseLayerNames = baseLayersWithNames?.map((bl) => bl.name)

const routeBasedTransitVehicleOverlayNameOverride =
overlays.find((o) => o.type === 'vehicles-one-route')?.name || undefined

return (
<MapContainer className="percy-hide">
<BaseMap
Expand All @@ -342,7 +345,13 @@ class DefaultMap extends Component {
{/* The default overlays */}
<EndpointsOverlay />
<RouteViewerOverlay />
<TransitVehicleOverlay ModeIcon={ModeIcon} />
<TransitVehicleOverlay
id={routeBasedTransitVehicleOverlayNameOverride}
key={routeBasedTransitVehicleOverlayNameOverride}
ModeIcon={ModeIcon}
name={routeBasedTransitVehicleOverlayNameOverride}
visible
/>
<GeolocateControl
onGeolocate={() => {
getCurrentPosition(intl)
Expand Down
Loading