Admin Dashboard Components
The dashboard module provides geographic analytics widgets for the admin panel. These components visualise item location coverage, country/city distributions, and provide tools for managing the location search index.
Component Hierarchy
dashboard/
GeographicSection.tsx # Orchestrator: layout, loading, error states
LocationStatsCard.tsx # Coverage stats, distributions, sync badge
DistributionMap.tsx # Interactive map with clustered markers
IndexManagement.tsx # Index rebuild and clear actions
GeographicSection is the top-level entry point. It fetches data via the useGeoAnalytics hook and distributes it to the three child components.
GeographicSection
The layout orchestrator that handles the three main states: disabled (location features off), loading (skeleton), error (retry button), and the normal data view.
Rendering Logic
if (!settings.enabled) --> Disabled placeholder
if (isLoading) --> Skeleton grid
if (isError) --> Error message + Retry button
if (!data) --> null (no render)
else --> Two-column grid + IndexManagement
Layout Structure
<div className="space-y-6">
<AdminResponsiveGrid cols={2}>
<AdminErrorBoundary>
<LocationStatsCard stats={data.stats} distributions={data.distributions} />
</AdminErrorBoundary>
<AdminErrorBoundary>
<DistributionMap locations={data.locations} />
</AdminErrorBoundary>
</AdminResponsiveGrid>
<AdminErrorBoundary>
<IndexManagement
lastRebuildAt={data.stats.lastRebuildAt}
totalIndexed={data.stats.totalIndexed}
/>
</AdminErrorBoundary>
</div>
Each child is wrapped in AdminErrorBoundary so a failure in one widget does not bring down the entire section.