Skip to content

Commit

Permalink
Merge branch 'dev' into reduce-bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
binh-dam-ibigroup authored Dec 13, 2024
2 parents fe69e47 + 7ea6e15 commit b3c4268
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 b3c4268

Please sign in to comment.