From aacd02324e656a28964c7d692f87b3e3fc9f4bae Mon Sep 17 00:00:00 2001 From: bwees Date: Tue, 16 Jan 2024 22:17:16 -0600 Subject: [PATCH] cancelled stop handling --- app/components/ui/Timetable.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/components/ui/Timetable.tsx b/app/components/ui/Timetable.tsx index ecfd483..f67d534 100644 --- a/app/components/ui/Timetable.tsx +++ b/app/components/ui/Timetable.tsx @@ -19,6 +19,7 @@ interface TableItem { color: string, shouldHighlight: boolean live: boolean, + cancelled: boolean } interface TableItemRow { @@ -57,7 +58,7 @@ const Timetable: React.FC = ({ item, tintColor, stopCode }) => { const timeEstimateIndex = estimate?.stopTimes.findIndex((stopTime) => stopTime.tripPointId == time.tripPointId) const timeEstimate = estimate?.stopTimes[timeEstimateIndex!]; - let departTime = timeEstimate ? moment(timeEstimate.estimatedDepartTimeUtc) : moment(time.scheduledDepartTimeUtc); + let departTime = (timeEstimate && timeEstimate.scheduledDepartTimeUtc != "0001-01-01T00:00:00") ? moment(timeEstimate.estimatedDepartTimeUtc) : moment(time.scheduledDepartTimeUtc); let relativeMinutes = departTime.diff(now, "minutes") let shouldHighlight = false; @@ -77,7 +78,8 @@ const Timetable: React.FC = ({ item, tintColor, stopCode }) => { time: departTime.format("h:mm"), color: color, shouldHighlight: shouldHighlight, - live: (timeEstimate && timeEstimate.isRealtime) ?? false + live: (timeEstimate && timeEstimate.isRealtime) ?? false, + cancelled: timeEstimate?.isCancelled ?? false } }) @@ -154,6 +156,7 @@ const Timetable: React.FC = ({ item, tintColor, stopCode }) => { color: item.color, fontWeight: item.color == tintColor ? "bold" : "normal", fontSize: 16, + textDecorationLine: item.cancelled ? "line-through" : "none" }} >{item.time} {item.live &&