feat: follow bus button on trip search results - #776
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Adds “follow vehicle” support to trip search results by polling for vehicle positions per service journey and conditionally rendering a follow button in the trip leg UI.
Changes:
- Added a new
/api/departures/vehiclesendpoint and BFF client wrapper to fetch vehicle positions for a list of service journey IDs. - Introduced client-side polling hooks to fetch service-journey vehicle snapshots and derive which legs currently have live vehicle data.
- Rendered a “Follow {transportMode}” button in trip sections when live vehicle data is available, including new translation text.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/translations/pages/assistant.ts | Adds translated label for the new “follow vehicle” action. |
| src/pages/api/departures/vehicles.ts | New API route to fetch vehicle positions by service journey IDs. |
| src/page-modules/departures/server/vehicles/index.ts | New server-side BFF client wrapper for the vehicles endpoint. |
| src/page-modules/departures/server/index.ts | Composes the new vehicles client into the departure server client. |
| src/page-modules/departures/client/vehicles/index.ts | Re-exports the new polling hook. |
| src/page-modules/departures/client/vehicles/get-service-journey-vehicles.ts | Adds SWR polling hook for vehicle snapshots by service journey IDs. |
| src/page-modules/assistant/trip/trip-pattern-collapse/index.tsx | Computes live-vehicle IDs for a trip pattern and passes to trip sections. |
| src/page-modules/assistant/details/use-live-vehicle-ids.ts | New hook to derive the set of live-vehicle service journey IDs from legs. |
| src/page-modules/assistant/details/trip-section/index.tsx | Conditionally renders the “Follow vehicle” button per leg. |
| src/page-modules/assistant/details-body/index.tsx | Passes live-vehicle availability into trip sections in details view. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import { ColorIcon } from '@atb/components/icon'; | ||
| import { ColorIcon, MonoIcon } from '@atb/components/icon'; | ||
| import { ButtonLink } from '@atb/components/button'; | ||
| import { transportModeToTranslatedString } from '@atb/modules/transport-mode'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.