Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix stop viewer next days departures #1005

Merged
merged 13 commits into from
Oct 3, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(live-stop-times): Use a unique key with patterns on multiple days.
binh-dam-ibigroup committed Sep 20, 2023
commit ef0eb9acfe72f93874d21d1d5d2856241426ee38
48 changes: 21 additions & 27 deletions lib/components/viewers/live-stop-times.tsx
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ type Props = {
findStopTimesForStop: ({ stopId }: { stopId: string }) => void
homeTimezone: string
intl: IntlShape
nearbyStops: any // TODO: shared types
nearbyStops: string[]
setHoveredStop: (stopId: string) => void
showNearbyStops: boolean
showOperatorLogo?: boolean
@@ -175,32 +175,26 @@ class LiveStopTimes extends Component<Props, State> {
return (
<>
<ul className="route-row-container">
{routeTimes.map((time: any, index: number) => {
const { id, pattern, route, times } = time
return (
<React.Fragment key={id}>
{((index > 0 &&
!isSameDay(
time.day * 1000,
routeTimes[index - 1]?.day * 1000
)) ||
(index === 0 && !isSameDay(now, time.day * 1000))) &&
this.renderDay(homeTimezone, time.day, now)}
<PatternRow
homeTimezone={homeTimezone}
pattern={pattern}
route={{
...route,
operator: transitOperators.find(
(o: TransitOperator) => o.agencyId === route.agencyId
)
}}
showOperatorLogo={showOperatorLogo}
stopTimes={times}
/>
</React.Fragment>
)
})}
{routeTimes.map(({ day, id, pattern, route, times }, index) => (
<React.Fragment key={`${id}-${day}`}>
{((index > 0 &&
!isSameDay(day * 1000, routeTimes[index - 1]?.day * 1000)) ||
(index === 0 && !isSameDay(now, day * 1000))) &&
this.renderDay(homeTimezone, day, now)}
<PatternRow
homeTimezone={homeTimezone}
pattern={pattern}
route={{
...route,
operator: transitOperators.find(
(o: TransitOperator) => o.agencyId === route.agencyId
)
}}
showOperatorLogo={showOperatorLogo}
stopTimes={times}
/>
</React.Fragment>
))}
</ul>

{/* Auto update controls for realtime arrivals */}