Skip to content

feat(map): add Mapbox integration with clustering - #7

Merged
mitoperni merged 2 commits into
mainfrom
feat/05-mapbox-integration
Feb 4, 2026
Merged

mitoperni merged 2 commits into
mainfrom
feat/05-mapbox-integration

Conversation

@mitoperni

@mitoperni mitoperni commented Feb 4, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Integrate Mapbox GL JS for interactive map visualization
  • Implement marker clustering for better performance with many networks
  • Add pin markers with hover tooltips for individual networks
  • Create shared context for filtered networks between sidebar and map

Changes

New Components

  • map-container.tsx - Dynamic import wrapper for Mapbox (SSR-safe)
  • mapbox-map.tsx - Main map component with Mapbox GL
  • cluster-markers.tsx - GeoJSON clustering with Mapbox Layers
  • network-pin.tsx - Pin marker with tooltip for individual networks
  • map-error.tsx - Error display component for map failures
  • map-placeholder.tsx - Loading placeholder during map initialization

New Hooks and Context

  • use-fit-bounds.ts - Auto-fit map bounds to visible networks
  • filtered-networks-context.tsx - Share filtered networks between components

Configuration

  • constants.ts - Added MAPBOX_CONFIG and CLUSTER_CONFIG

Tests

  • Unit tests for map-error, map-markers, map-placeholder
  • Unit tests for use-fit-bounds hook

Features

  • Clusters show count and use grenadier color scale (lighter to darker = fewer to more)
  • Click cluster to zoom and expand
  • Hover individual pin to see tooltip with network name and city
  • Click individual pin to navigate to /network/{id}
  • Map auto-fits bounds when filtered networks change

Test plan

  • Verify map loads with Mapbox token configured
  • Verify error states display correctly without token
  • Verify clusters appear when zoomed out
  • Verify cluster click expands to show more detail
  • Verify pin hover shows tooltip
  • Verify pin click navigates to network detail
  • Verify map bounds update when filters change

- Add MapboxMap component with react-map-gl v8 integration
- Add MapMarkers component with memoized marker rendering
- Add MapContainer with dynamic import for code splitting
- Add MapError component for graceful error states
- Add MapPlaceholder for development mode without Mapbox
- Add useFitBounds hook for auto-fitting map to markers
- Add FilteredNetworksProvider context to centralize filtering
- Add comprehensive tests for all new components
- Update page.tsx to use Suspense boundary for useSearchParams
@mitoperni mitoperni self-assigned this Feb 4, 2026
- Add clustering for network markers using Mapbox GeoJSON source
- Create NetworkPin component with hover tooltip showing name/city
- Use grenadier color scale for clusters (darker = more networks)
- Replace individual Marker components with hybrid approach:
  - Mapbox Layers for clustered points (better performance)
  - React Markers for individual pins (interactive tooltips)
- Click cluster to zoom and expand, click pin to navigate to network
@mitoperni
mitoperni force-pushed the feat/05-mapbox-integration branch from 3afb99b to 0d73f48 Compare February 4, 2026 15:13
@mitoperni
mitoperni merged commit 3374a09 into main Feb 4, 2026
4 checks passed
@mitoperni
mitoperni deleted the feat/05-mapbox-integration branch February 5, 2026 09:21
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