handle null headsign

This commit is contained in:
cjdenio committed 2026-07-08 14:09:40 -06:00
1 parent bb1be8a143
commit 9354988f93
2 files changed
+14 -3

No files matched your search

+13 -2
View File
@@ -166,10 +166,21 @@ function renderVehicleIcon(vehicle) {
}
function vehiclePopupContent(vehicle) {
return `<b>${routeDesignator(vehicle.route)}</b> to <b>${vehicle.headsign?.replace(
let content = `<b>${routeDesignator(vehicle.route)}</b>`
if (vehicle.headsign) {
content += ` to <b>${vehicle.headsign.replace(
/^to /i,
""
)}</b>${vehicle.nearest_station ? `<br />@ ${vehicle.nearest_station?.name}` : ""}<br /><br /><small>vehicle #: ${vehicle.id}</small>`
)}</b>`
}
if (vehicle.nearest_station) {
content += `<br />@ ${vehicle.nearest_station.name}`
}
content += `<br /><br /><small>vehicle #: ${vehicle.id}</small>`
return content
}
function renderVehicle(vehicle) {