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

correctly make use of scoped vehicle ids #1317

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading