From 0ac659d3654c57f849d13d6ef878d88505897e47 Mon Sep 17 00:00:00 2001 From: Law Wai Chun Date: Fri, 5 Jan 2024 17:59:41 +0800 Subject: [PATCH] Fix reverse route for GMB --- src/components/route-eta/ReverseButton.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/route-eta/ReverseButton.tsx b/src/components/route-eta/ReverseButton.tsx index 01955e38ba0a..935d3ae9b6fe 100644 --- a/src/components/route-eta/ReverseButton.tsx +++ b/src/components/route-eta/ReverseButton.tsx @@ -14,7 +14,7 @@ const ReverseButton = ({ routeId }: { routeId: string }) => { db: { routeList, holidays, stopList, serviceDayMap }, vibrateDuration, } = useContext(AppContext); - const { route, stops, co } = routeList[routeId]; + const { route, stops, co, gtfsId } = routeList[routeId]; const navigate = useNavigate(); const isTodayHoliday = useMemo( @@ -28,7 +28,10 @@ const ReverseButton = ({ routeId }: { routeId: string }) => { .reduce>( (acc, [key, _routeListEntry]) => { if (key === routeId) return acc; - const { co: _co, route: _route } = _routeListEntry; + const { co: _co, route: _route, gtfsId: _gtfsId } = _routeListEntry; + if (co[0] === "gmb" && gtfsId && gtfsId !== _gtfsId) { + return acc; + } if ( _route === route && JSON.stringify(co) === JSON.stringify(_co) @@ -78,6 +81,7 @@ const ReverseButton = ({ routeId }: { routeId: string }) => { [ route, co, + gtfsId, routeList, stopList, isTodayHoliday,