From 49fc86e18a3d1726ae48845fcafecba9a5a47b9d Mon Sep 17 00:00:00 2001 From: Donald Wu Date: Sun, 2 Oct 2022 12:37:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20fix=20renderBusServiceRou?= =?UTF-8?q?tesList=20logic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../busServiceRoutes/BusServiceRoutes.tsx | 212 ++++++++---------- 1 file changed, 90 insertions(+), 122 deletions(-) diff --git a/src/components/busServiceRoutes/BusServiceRoutes.tsx b/src/components/busServiceRoutes/BusServiceRoutes.tsx index 478e737..326c233 100644 --- a/src/components/busServiceRoutes/BusServiceRoutes.tsx +++ b/src/components/busServiceRoutes/BusServiceRoutes.tsx @@ -298,68 +298,52 @@ function BusServiceRoutes(props: any): JSX.Element { let view = null; if (item.busStop) { - if ( - _.inRange(latitude, item.busStop.latitude - 0.0015, item.busStop.latitude + 0.0015) && - _.inRange(longitude, item.busStop.longitude - 0.0015, item.busStop.longitude + 0.0015) - ) { - view = ( - - handleBusStopCodeClick(item.busStop.busStopCode)}> - - {/* {item.stopSequence} */} - - {item.busStop.description} + view = ( + + handleBusStopCodeClick(item.busStop.busStopCode)}> + + {/* {item.stopSequence} */} + + {item.busStop.description} + + + {item.busStop.busStopCode} + + handleCheckBusStopInMap(item.busStop.latitude, item.busStop.longitude)} + > + + Check bus stop in map - - {item.busStop.busStopCode} - - handleCheckBusStopInMap(item.busStop.latitude, item.busStop.longitude)} - > - - Check bus stop in map - - - - - {renderArrowDownIcon(inboundList, i)} - - ); - } else { - view = ( - - handleBusStopCodeClick(item.busStop.busStopCode)}> - - {/* {item.stopSequence} */} - - {item.busStop.description} - - - {item.busStop.busStopCode} - - handleCheckBusStopInMap(item.busStop.latitude, item.busStop.longitude)} - > - - Check bus stop in map - - - - - {renderArrowDownIcon(inboundList, i)} - - ); - } + + + + {renderArrowDownIcon(inboundList, i)} + + ); return view; } @@ -371,68 +355,52 @@ function BusServiceRoutes(props: any): JSX.Element { let view = null; if (item.busStop) { - if ( - _.inRange(latitude, item.busStop.latitude - 0.0015, item.busStop.latitude + 0.0015) && - _.inRange(longitude, item.busStop.longitude - 0.0015, item.busStop.longitude + 0.0015) - ) { - view = ( - - handleBusStopCodeClick(item.busStop.busStopCode)}> - - {/* {item.stopSequence} */} - - {item.busStop.description} + view = ( + + handleBusStopCodeClick(item.busStop.busStopCode)}> + + {/* {item.stopSequence} */} + + {item.busStop.description} + + + {item.busStop.busStopCode} + + handleCheckBusStopInMap(item.busStop.latitude, item.busStop.longitude)} + > + + Check bus stop in map - - {item.busStop.busStopCode} - - handleCheckBusStopInMap(item.busStop.latitude, item.busStop.longitude)} - > - - Check bus stop in map - - - - - {renderArrowDownIcon(outboundList, i)} - - ); - } else { - view = ( - - handleBusStopCodeClick(item.busStop.busStopCode)}> - - {/* {item.stopSequence} */} - - {item.busStop.description} - - - {item.busStop.busStopCode} - - handleCheckBusStopInMap(item.busStop.latitude, item.busStop.longitude)} - > - - Check bus stop in map - - - - - {renderArrowDownIcon(outboundList, i)} - - ); - } + + + + {renderArrowDownIcon(outboundList, i)} + + ); return view; }