Skip to content

Map Feature

Public Summary

Interactive MapLibre-based map showing supermarket locations, product search, multi-modal routing (walk, bike, car), market clustering, and AI-powered search dialog.

Internal Details

Files

FileRole
MapPage.jsxMain map page with all controls
RoutingEngine.jsxOSRM route rendering
MarketMarkers.jsxMarket pins with clustering
CreditMarker.jsxMap attribution
GlobalAISearchDialog.jsxAI-powered search overlay
RouteConfirmDialog.jsxRoute mode selection dialog
LocateUser.jsxGeolocation button
UserDot.jsxUser position indicator
MapProductInfoModal.jsxMarket product detail modal
useMapPitch.js3D pitch interaction hook
markerUtils.jsMarker helper utilities
defaultVisibleChains.jsDefault chain filter config
markerColors.jsChain color mapping
markerPaths.jsSVG marker path definitions

Key Interactions

Clustering

Uses Supercluster to group nearby markets at lower zoom levels, expanding to individual markers on zoom in. Performance optimization for hundreds of market locations.

Routing

  • OSRM backend at /route/ for path calculation.
  • Three modes: walking, cycling, driving.
  • Route rendered as styled polyline on map.
  • Route confirmation dialog lets user pick mode before rendering.

Chain Filters

  • Users can toggle chain visibility (e.g., show only Vero markets).
  • Filter state persisted to localStorage.
  • Default visible chains configured in defaultVisibleChains.js.

Feature Flag Integration

  • ai-search flag gates the GlobalAISearchDialog component.
  • When disabled, only basic map browsing is available.

Dependencies

DependencyUsage
MapLibre GL / react-map-glMap rendering
SuperclusterMarker clustering
OSRMRouting engine
themeStoreDark/light map style
featureFlagStoreAI search gate
useAuth / useLogoutAuth state in header

Source Anchors

PathRelevance
apps/client/src/features/map/Pages, components, hooks, config, utils

Student Obrok engineering documentation.