Skip to content

feat: add interactive stations map with clustering and sidebar sync - #9

Merged
mitoperni merged 3 commits into
mainfrom
feat/detail-map
Feb 5, 2026
Merged

mitoperni merged 3 commits into
mainfrom
feat/detail-map

Conversation

@mitoperni

@mitoperni mitoperni commented Feb 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Add interactive Mapbox map to network detail page displaying all stations
  • Implement station clustering with 3 size levels (small <5, medium 5-19, large 20+) using torea-bay color scale
  • Add sidebar-map synchronization: clicking a table row flies the map to that station
  • Sort stations by distance to current map center
  • Sync selection state between table and map (highlight selected row and marker)

New Components

  • StationsMap - Main map component with Mapbox integration
  • StationClusterMarkers - GeoJSON-based clustering with zoom-on-click
  • StationPin - Individual station markers with hover tooltips
  • StationPopup - Popup showing station name and bike/slot availability
  • StationsSyncProvider - Context for sidebar-map state synchronization

Additional Changes

  • StationRow now clickable with keyboard support and selected state
  • MapPlaceholder extended to support stations (for dev mode)
  • Updated tests for placeholder component
  • Added STATION_CLUSTER_CONFIG constants

Test Plan

  • Navigate to a network detail page and verify the map loads with station markers
  • Zoom out to see stations cluster together
  • Click on a cluster to zoom into it
  • Click on a station row in the sidebar to fly the map to that station
  • Verify the station popup shows correct availability data
  • Pan the map and verify the station list reorders by distance

- Create StationsMapContainer and StationsMap components with Mapbox integration
- Add StationPin component with availability-based color coding (green/yellow/red)
- Implement StationPopup showing station name, free bikes and empty slots
- Update MapPlaceholder to support both networks and stations display
- Integrate map into network detail page with Suspense and MapSkeleton fallback
- Adjust DETAIL_ZOOM constant from 13 to 11 for better station visibility
- Add unit tests for MapPlaceholder with stations support
- Create StationClusterMarkers component with Mapbox native clustering
- Add STATION_CLUSTER_CONFIG with torea-bay color scale for visual distinction
- Implement interactive cluster zoom on click
- Update StationsMap to use clustering for better performance
- Fix use-fit-bounds test to use MAP_CONFIG.DETAIL_ZOOM constant
- Create StationsSyncContext for shared state between sidebar and map
- Add NetworkDetailClient wrapper to provide context
- Refactor page.tsx to single fetch (was duplicated)
- Make station rows clickable with flyTo animation to map
- Sort stations by distance to map center
- Add visual selection highlight on station rows
- Support keyboard navigation (Enter/Space) for accessibility
@mitoperni mitoperni self-assigned this Feb 5, 2026
@mitoperni
mitoperni merged commit b8877bd into main Feb 5, 2026
4 checks passed
@mitoperni
mitoperni deleted the feat/detail-map branch February 5, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant