import { Suspense, type MutableRefObject, type ReactNode } from 'react'; import { useTranslation } from 'react-i18next'; import type { ActualListing, FeatureFilters, FeatureMeta, POI, PostcodeGeometry, ViewState, } from '../../../types'; import type { useMapData } from '../../../hooks/useMapData'; import type { useTutorial } from '../../../hooks/useTutorial'; import type { TravelTimeEntry } from '../../../hooks/useTravelTime'; import type { getTutorialStyles } from '../../../lib/tutorial-styles'; import type { OverlayId } from '../../../lib/overlays'; import type { BasemapId } from '../../../lib/basemaps'; import type { SearchedLocation } from '../LocationSearch'; import { MapPinIcon } from '../../ui/icons/MapPinIcon'; import { EyeIcon } from '../../ui/icons/EyeIcon'; import { HouseIcon } from '../../ui/icons/HouseIcon'; import { SpinnerIcon } from '../../ui/icons/SpinnerIcon'; import { IndeterminateProgressBar } from '../../ui/IndeterminateProgressBar'; import type { MapFlyTo, PaneResizeHandlers } from './types'; import { MapFallback, PaneFallback } from './Fallbacks'; import { MapErrorBoundary } from '../MapErrorBoundary'; import { LoadingOverlay } from './LoadingOverlay'; import { Joyride, Map, MapPageSelectionPane } from './lazyComponents'; type MapData = ReturnType; type Tutorial = ReturnType; type TutorialTheme = ReturnType; type RightPaneTab = 'properties' | 'area'; interface DesktopMapPageProps { initialLoading: boolean; tutorial: Tutorial; tutorialTheme: TutorialTheme; leftPaneWidth: number; leftPaneHandlers: PaneResizeHandlers; filtersPane: ReactNode; mapData: MapData; pois: POI[]; activeOverlays: Set; activeCrimeTypes: Set; basemap: BasemapId; colorOpacity: number; mapViewFeature: string | null; filterRange: [number, number] | null; viewSource: 'drag' | 'eye' | null; onCancelPin: () => void; features: FeatureMeta[]; selectedHexagonId: string | null; hoveredHexagonId: string | null; onHexagonClick: (id: string, isPostcode?: boolean, geometry?: PostcodeGeometry) => void; onHexagonHover: (h3: string | null, x?: number, y?: number) => void; initialViewState: ViewState; flyToRef: MutableRefObject; theme: 'light' | 'dark'; filters: FeatureFilters; selectedPostcodeGeometry: PostcodeGeometry | null; onLocationSearched: (location: SearchedLocation | null) => void; onCurrentLocationFound: (lat: number, lng: number) => void; currentLocation: { lat: number; lng: number } | null; actualListings: ActualListing[]; actualListingsEnabled: boolean; actualListingsLoading: boolean; onToggleActualListings?: () => void; travelTimeEntries: TravelTimeEntry[]; densityLabel: string; totalCount?: number; poiPaneOpen: boolean; onTogglePoiPane: () => void; poiPane: ReactNode; overlayPaneOpen: boolean; onToggleOverlayPane: () => void; overlayPane: ReactNode; showSelectionPane: boolean; rightPaneWidth: number; rightPaneHandlers: PaneResizeHandlers; rightPaneTab: RightPaneTab; onAreaTabClick: () => void; onPropertiesTabClick: () => void; onCloseSelection: () => void; renderAreaPane: () => ReactNode; renderPropertiesPane: () => ReactNode; toasts: ReactNode; upgradeModal: ReactNode; } export function DesktopMapPage({ initialLoading, tutorial, tutorialTheme, leftPaneWidth, leftPaneHandlers, filtersPane, mapData, pois, activeOverlays, activeCrimeTypes, basemap, colorOpacity, mapViewFeature, filterRange, viewSource, onCancelPin, features, selectedHexagonId, hoveredHexagonId, onHexagonClick, onHexagonHover, initialViewState, flyToRef, theme, filters, selectedPostcodeGeometry, onLocationSearched, onCurrentLocationFound, currentLocation, actualListings, actualListingsEnabled, actualListingsLoading, onToggleActualListings, travelTimeEntries, densityLabel, totalCount, poiPaneOpen, onTogglePoiPane, poiPane, overlayPaneOpen, onToggleOverlayPane, overlayPane, showSelectionPane, rightPaneWidth, rightPaneHandlers, rightPaneTab, onAreaTabClick, onPropertiesTabClick, onCloseSelection, renderAreaPane, renderPropertiesPane, toasts, upgradeModal, }: DesktopMapPageProps) { const { t } = useTranslation(); return (
{tutorial.run && ( )}
{filtersPane}
}>
{onToggleActualListings && ( )}
{overlayPaneOpen && (
{overlayPane}
)} {poiPaneOpen && (
{poiPane}
)}
{showSelectionPane && ( }> )} {toasts} {upgradeModal}
); }