diff --git a/assets/src/components/incomingBox.tsx b/assets/src/components/incomingBox.tsx index 82cf07ebc..0b946d70a 100644 --- a/assets/src/components/incomingBox.tsx +++ b/assets/src/components/incomingBox.tsx @@ -1,6 +1,6 @@ import React, { useContext } from "react" import { StateDispatchContext } from "../contexts/stateDispatchContext" -import vehicleLabel from "../helpers/vehicleLabel" +import { vehicleLabel } from "../helpers/vehicleLabel" import { blockWaiverAlertStyle } from "../models/blockWaiver" import { crowdingLabel, OccupancyStatus } from "../models/crowding" import { diff --git a/assets/src/components/ladder.tsx b/assets/src/components/ladder.tsx index f9d36e70f..01355a036 100644 --- a/assets/src/components/ladder.tsx +++ b/assets/src/components/ladder.tsx @@ -5,7 +5,7 @@ import "tippy.js/dist/tippy.css" import { StateDispatchContext } from "../contexts/stateDispatchContext" import { flatten, partition } from "../helpers/array" import { joinClasses } from "../helpers/dom" -import vehicleLabel from "../helpers/vehicleLabel" +import { vehicleLabel } from "../helpers/vehicleLabel" import { blockWaiverAlertStyle } from "../models/blockWaiver" import { crowdingLabel, OccupancyStatus } from "../models/crowding" import { diff --git a/assets/src/components/mapMarkers.tsx b/assets/src/components/mapMarkers.tsx index e08dd899c..21f5431e5 100644 --- a/assets/src/components/mapMarkers.tsx +++ b/assets/src/components/mapMarkers.tsx @@ -12,7 +12,7 @@ import { Marker, Polyline, Popup, Tooltip } from "react-leaflet" import { StateDispatchContext } from "../contexts/stateDispatchContext" import { joinClasses } from "../helpers/dom" -import vehicleLabelString from "../helpers/vehicleLabel" +import { vehicleLabel } from "../helpers/vehicleLabel" import { drawnStatus, statusClasses } from "../models/vehicleStatus" import { TrainVehicle, Vehicle } from "../realtime" import { Shape, Stop } from "../schedule" @@ -77,7 +77,7 @@ const makeLabelIcon = ( settings: UserSettings, isSelected: boolean ): Leaflet.DivIcon => { - const labelString = vehicleLabelString(vehicle, settings) + const labelString = vehicleLabel(vehicle, settings) const labelBackgroundHeight = isPrimary ? 16 : 12 const labelBackgroundWidth = labelString.length <= 4 ? (isPrimary ? 40 : 30) : isPrimary ? 62 : 40 diff --git a/assets/src/components/propertiesPanel/header.tsx b/assets/src/components/propertiesPanel/header.tsx index 01c5bcace..ee6083818 100644 --- a/assets/src/components/propertiesPanel/header.tsx +++ b/assets/src/components/propertiesPanel/header.tsx @@ -2,7 +2,7 @@ import React, { useContext } from "react" import { useRoute } from "../../contexts/routesContext" import { StateDispatchContext } from "../../contexts/stateDispatchContext" import { joinClasses } from "../../helpers/dom" -import vehicleLabel from "../../helpers/vehicleLabel" +import { vehicleLabel } from "../../helpers/vehicleLabel" import { secondsAgoLabel, secondsToMinutes } from "../../util/dateTime" import { useCurrentTimeSeconds } from "../../hooks/useCurrentTime" import { emptyLadderDirectionsByRouteId } from "../../models/ladderDirection" diff --git a/assets/src/components/vehicleRouteSummary.tsx b/assets/src/components/vehicleRouteSummary.tsx index 18f0ddc96..87a5e5da3 100644 --- a/assets/src/components/vehicleRouteSummary.tsx +++ b/assets/src/components/vehicleRouteSummary.tsx @@ -6,7 +6,7 @@ import React, { import { useRoute } from "../contexts/routesContext" import { StateDispatchContext } from "../contexts/stateDispatchContext" import { joinClasses } from "../helpers/dom" -import vehicleLabel from "../helpers/vehicleLabel" +import { vehicleLabel } from "../helpers/vehicleLabel" import { emptyLadderDirectionsByRouteId } from "../models/ladderDirection" import { currentRouteTab } from "../models/routeTab" import { diff --git a/assets/src/helpers/vehicleLabel.ts b/assets/src/helpers/vehicleLabel.ts index 6dc8ed5c6..840b63cb5 100644 --- a/assets/src/helpers/vehicleLabel.ts +++ b/assets/src/helpers/vehicleLabel.ts @@ -18,7 +18,7 @@ export const runOrBusNumberLabel = ( } } -const vehicleLabel = ( +export const vehicleLabel = ( vehicleOrGhost: Vehicle | Ghost, settings: UserSettings ): string => { @@ -58,5 +58,3 @@ export const runIdToLabel = (runId: RunId | null): string => { const stripLeadingZero = (num: string): string => num.startsWith("0") ? num.slice(1) : num - -export default vehicleLabel diff --git a/assets/tests/helpers/vehicleLabel.test.ts b/assets/tests/helpers/vehicleLabel.test.ts index f00550cf1..c30b74cd3 100644 --- a/assets/tests/helpers/vehicleLabel.test.ts +++ b/assets/tests/helpers/vehicleLabel.test.ts @@ -1,5 +1,6 @@ import { describe, test, expect } from "@jest/globals" -import vehicleLabel, { +import { + vehicleLabel, runOrBusNumberLabel, runIdToLabel, } from "../../src/helpers/vehicleLabel"