Skip to content

Commit

Permalink
Merge pull request #1317 from opentripplanner/correct-rt-bubble-behavior
Browse files Browse the repository at this point in the history
correctly make use of scoped vehicle ids
  • Loading branch information
miles-grant-ibigroup authored Dec 13, 2024
2 parents 3efbfc6 + f8a9928 commit 7ea6e15
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/components/map/connected-transit-vehicle-overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,17 @@ import React from 'react'
function VehicleTooltip(props) {
const { intl, vehicle } = props

let vehicleLabel = vehicle?.label || vehicle?.vehicleId
const scopedVehicleId = vehicle?.vehicleId?.split(':')?.[1]

let vehicleLabel = scopedVehicleId || vehicle?.vehicleId
// If a vehicle's label prop is less than 5 characters long, we can assume it is a vehicle
// number. If this is the case, or if a vehicleId prop is provided,
// render as "Vehicle <vehicleId>" (or the equivalent in the user's language).
// Otherwise, the label itself is enough
// (this is TriMet-specific, when label contains text such as "MAX Green").
if (
vehicleLabel !== null &&
(vehicleLabel?.length <= 5 || vehicle?.vehicleId)
(vehicleLabel?.length <= 5 || scopedVehicleId || vehicle?.vehicleId)
) {
vehicleLabel = intl.formatMessage(
{ id: 'components.TransitVehicleOverlay.vehicleName' },
Expand Down

0 comments on commit 7ea6e15

Please sign in to comment.