Skip to content

Commit

Permalink
fix: hide delay in route schedule when the vehicle has no realtime
Browse files Browse the repository at this point in the history
  • Loading branch information
oterral committed Oct 25, 2023
1 parent 0a99b79 commit 8716ce7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
10 changes: 8 additions & 2 deletions src/components/RouteSchedule/RouteSchedule.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ function RouteStop({
}}
>
<div className="rt-route-delay">
{typeof arrivalDelay === "undefined" || isFirstStation || cancelled ? (
{arrivalDelay === undefined ||
arrivalDelay === null ||
isFirstStation ||
cancelled ? (
""
) : (
<span
Expand All @@ -166,7 +169,10 @@ function RouteStop({
{`+${getDelayString(arrivalDelay)}`}
</span>
)}
{typeof departureDelay === "undefined" || isLastStation || cancelled ? (
{departureDelay === undefined ||
departureDelay === null ||
isLastStation ||
cancelled ? (
""
) : (
<span
Expand Down
4 changes: 2 additions & 2 deletions src/components/RouteSchedule/RouteSchedule.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ const lineInfos = {
stationId: "4",
stationName: "no stop",
coordinates: [8.54119, 47.36646],
arrivalDelay: null, // +0
arrivalDelay: null, // no realtime
arrivalTime: 0,
aimedArrivalTime: 0,
departureDelay: null, // +2m
departureDelay: null, // no realtime
departureTime: 0,
aimedDepartureTime: 0,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,7 @@ exports[`RouteSchedule matches snapshots. 1`] = `
>
<div
className="rt-route-delay"
>
<span
className="rt-route-delay-arrival green"
>
+0
</span>
<span
className="rt-route-delay-departure green"
>
+0
</span>
</div>
/>
<div
className="rt-route-times"
>
Expand Down

0 comments on commit 8716ce7

Please sign in to comment.