-
Notifications
You must be signed in to change notification settings - Fork 6
Feat: gtfs visualization refactor, UX enhancements and bug fixes #1419
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
Feat: gtfs visualization refactor, UX enhancements and bug fixes #1419
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the GTFS Visualization Map component to improve maintainability and address UX/functionality issues. The 1000+ line component has been split into smaller, focused modules while fixing critical bugs related to stop selection and route filtering.
Key Changes:
- Component extracted into separate files for layers, functions, and UI panels
- Fixed stop click interaction bug that prevented popup display
- Improved route selection precision to prevent unintended multi-route activation
- Enhanced click target areas for stops and routes
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| GtfsVisualizationMap.tsx | Core component refactored with extracted logic and improved null checks |
| GtfsVisualizationMap.layers.tsx | Map layer definitions extracted from main component |
| GtfsVisualizationMap.functions.tsx | Utility functions for route ID extraction, bounds calculation, and color generation |
| SelectedRoutesStopsPanel.tsx | Draggable panel component for displaying selected route stops |
| ScanningOverlay.tsx | Overlay component for tile scanning progress indication |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (!el.isStop) { | ||
| const routeElement: MapRouteElement = el as MapRouteElement; | ||
| if (routeElement.routeId && routeElement.routeColor) { | ||
| if (routeElement.routeId !== '' && routeElement.routeColor !== '') { |
Copilot
AI
Oct 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The null/undefined check is incomplete. Consider using routeElement.routeId && routeElement.routeColor or routeElement.routeId != null && routeElement.routeColor != null to handle both null/undefined and empty string cases consistently.
| if (routeElement.routeId !== '' && routeElement.routeColor !== '') { | |
| if ( | |
| routeElement.routeId != null && | |
| routeElement.routeId !== '' && | |
| routeElement.routeColor != null && | |
| routeElement.routeColor !== '' | |
| ) { |
| 'source-layer': 'routesoutput', | ||
| type: 'line', | ||
| paint: { | ||
| 'line-color': theme.palette.background.default, |
Copilot
AI
Oct 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
React hooks like useTheme() cannot be called inside regular functions. The theme should be passed as a parameter to RoutesWhiteLayer instead of being called within the function body.
| ): LayerSpecification => { | ||
| const theme = useTheme(); |
Copilot
AI
Oct 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
React hooks like useTheme() cannot be called inside regular functions. The theme should be passed as a parameter to StopsHighlightOuterLayer instead of being called within the function body.
| ): LayerSpecification => { | |
| const theme = useTheme(); | |
| theme: any, | |
| ): LayerSpecification => { |
| 'circle-opacity': 0, | ||
| 'circle-radius': 5, |
Copilot
AI
Oct 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The StopsIndexLayer uses circle-opacity: 0 to create invisible click targets, but the description mentions making stops more forgiving to select. The radius of 5 is now larger than the previous value of 1, which improves UX as intended. Consider adding a comment explaining this is an invisible layer for enhanced click detection.
| type: 'line', | ||
| paint: { | ||
| 'line-color': theme.palette.background.default, | ||
| 'line-width': ['match', ['get', 'route_type'], '3', 10, '1', 15, 3], |
Copilot
AI
Oct 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The line width values (10, 15, 3) differ from the original code which used (4, 15, 3). This change to route type '3' width from 4 to 10 is a significant visual change that isn't mentioned in the PR description. Consider documenting this intentional change or verifying it's correct.
| 'line-width': ['match', ['get', 'route_type'], '3', 10, '1', 15, 3], | |
| 'line-width': ['match', ['get', 'route_type'], '3', 4, '1', 15, 3], |
|
*Lighthouse ran on https://mobility-feeds-dev--pr-1419-k4dwm61b.web.app/ * (Desktop)
*Lighthouse ran on https://mobility-feeds-dev--pr-1419-k4dwm61b.web.app/feeds * (Desktop)
*Lighthouse ran on https://mobility-feeds-dev--pr-1419-k4dwm61b.web.app/feeds/gtfs/mdb-2126 * (Desktop)
*Lighthouse ran on https://mobility-feeds-dev--pr-1419-k4dwm61b.web.app/feeds/gtfs_rt/mdb-2585 * (Desktop)
*Lighthouse ran on https://mobility-feeds-dev--pr-1419-k4dwm61b.web.app/gbfs/gbfs-flamingo_porirua * (Desktop)
|
|
Preview Firebase Hosting URL: https://mobility-feeds-dev--pr-1419-k4dwm61b.web.app |
ffa4ee6 to
af6c1b6
Compare
cka-y
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 💯
Summary:
The GTFS Visualization file was large (1000+ lines), making quick changes going forward and understanding it after time of not seeing it will be difficult. This PR aims to reduce the complexity of the component. At the same time, during this refactor a bug was fixed and UX enhancements applied. Eslint is also re-enabled on the GTFS Visualization files
Expected behavior:
The map component should behave the way it was before with the following enhancements
UX enhancements
Bug Fixes
Testing tips:
Go to any map and test the general functionality. Especially clicking on stops, hovering routes and clicking on routes assuring no extra pop up
Next steps
Please make sure these boxes are checked before submitting your pull request - thanks!
./scripts/api-tests.shto make sure you didn't break anything