Skip to content

armgit / mapcn

Public Imported from GitHub
0

Beautiful map components. 100% Free, Zero config, one command setup.

TypeScript

add new map blocks and refresh block previews

anmol3708eecd4eb5
diff --git a/public/r/analytics-map.json b/public/r/analytics-map.json
index dc63216..d26d2ed 100644
--- a/public/r/analytics-map.json
+++ b/public/r/analytics-map.json
@@ -15,31 +15,31 @@
"files": [
{
"path": "src/registry/blocks/analytics-map/page.tsx",
- "content": "\"use client\";\n\nimport {\n Map,\n MapControls,\n MapMarker,\n MarkerContent,\n MarkerTooltip,\n} from \"@/components/ui/map\";\nimport { OverviewCard } from \"./components/overview-card\";\nimport { BreakdownCard } from \"./components/breakdown-card\";\nimport {\n locations,\n visitedPagesRows,\n countriesRows,\n referrersRows,\n browsersRows,\n} from \"./data\";\n\nconst MAP_HEIGHT = \"38rem\";\n\nexport default function Page() {\n return (\n <div\n className=\"bg-background relative min-h-screen\"\n style={{ \"--map-height\": MAP_HEIGHT } as React.CSSProperties}\n >\n <div className=\"relative h-(--map-height)\">\n <Map\n center={[-2, 16]}\n zoom={1.5}\n scrollZoom={false}\n renderWorldCopies={true}\n >\n <MapControls showFullscreen />\n {locations.map((location) => (\n <MapMarker\n key={location.city}\n longitude={location.lng}\n latitude={location.lat}\n >\n <MarkerContent>\n <div\n className=\"rounded-full bg-blue-500/70\"\n style={{\n width: location.size * 3,\n height: location.size * 3,\n }}\n />\n </MarkerContent>\n <MarkerTooltip\n offset={20}\n className=\"bg-background text-foreground border\"\n >\n <p className=\"text-muted-foreground font-medium\">\n {location.city}\n </p>\n <p className=\"mt-0.5\">{location.size} active users</p>\n </MarkerTooltip>\n </MapMarker>\n ))}\n </Map>\n <div\n className=\"via-background/30 to-background pointer-events-none absolute inset-x-0 bottom-0 h-40 bg-linear-to-b from-transparent\"\n aria-hidden\n />\n <OverviewCard />\n </div>\n\n <div className=\"grid gap-4 p-4 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4\">\n <BreakdownCard title=\"Visited pages\" rows={visitedPagesRows} />\n <BreakdownCard title=\"Referrers\" rows={referrersRows} />\n <BreakdownCard title=\"Countries\" rows={countriesRows} />\n <BreakdownCard title=\"Browsers\" rows={browsersRows} />\n </div>\n </div>\n );\n}\n",
+ "content": "\"use client\";\n\nimport {\n Map,\n MapControls,\n MapMarker,\n MarkerContent,\n MarkerTooltip,\n} from \"@/components/ui/map\";\nimport { OverviewCard } from \"./components/overview-card\";\nimport { BreakdownCard } from \"./components/breakdown-card\";\nimport {\n locations,\n visitedPagesRows,\n countriesRows,\n referrersRows,\n browsersRows,\n} from \"./data\";\n\nconst MAP_HEIGHT = \"38rem\";\n\nexport default function Page() {\n return (\n <div\n className=\"bg-background relative min-h-screen\"\n style={{ \"--map-height\": MAP_HEIGHT } as React.CSSProperties}\n >\n <div className=\"relative h-(--map-height)\">\n <Map\n center={[-2, 16]}\n zoom={1.5}\n scrollZoom={false}\n renderWorldCopies={true}\n >\n <MapControls />\n {locations.map((location) => (\n <MapMarker\n key={location.city}\n longitude={location.lng}\n latitude={location.lat}\n >\n <MarkerContent>\n <div\n className=\"rounded-full bg-blue-500/70\"\n style={{\n width: location.size * 3,\n height: location.size * 3,\n }}\n />\n </MarkerContent>\n <MarkerTooltip\n offset={20}\n className=\"bg-background text-foreground border\"\n >\n <p className=\"text-muted-foreground font-medium\">\n {location.city}\n </p>\n <p className=\"mt-0.5\">{location.size} active users</p>\n </MarkerTooltip>\n </MapMarker>\n ))}\n </Map>\n <div\n className=\"via-background/30 to-background pointer-events-none absolute inset-x-0 bottom-0 h-40 bg-linear-to-b from-transparent\"\n aria-hidden\n />\n <OverviewCard />\n </div>\n\n <div className=\"grid gap-4 p-4 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4\">\n <BreakdownCard title=\"Visited pages\" rows={visitedPagesRows} />\n <BreakdownCard title=\"Referrers\" rows={referrersRows} />\n <BreakdownCard title=\"Countries\" rows={countriesRows} />\n <BreakdownCard title=\"Browsers\" rows={browsersRows} />\n </div>\n </div>\n );\n}\n",
"type": "registry:page",
"target": "app/analytics/page.tsx"
},
{
"path": "src/registry/blocks/analytics-map/data.ts",
- "content": "import { type ChartConfig } from \"@/components/ui/chart\";\n\nexport interface LocationPoint {\n city: string;\n lng: number;\n lat: number;\n size: number;\n}\n\nexport interface BreakdownRow {\n label: string;\n value: number;\n}\n\nexport const locations: LocationPoint[] = [\n { city: \"San Francisco\", lng: -122.4194, lat: 37.7749, size: 16 },\n { city: \"New York\", lng: -74.006, lat: 40.7128, size: 15 },\n { city: \"Toronto\", lng: -79.3832, lat: 43.6532, size: 11 },\n { city: \"Mexico City\", lng: -99.1332, lat: 19.4326, size: 10 },\n { city: \"Sao Paulo\", lng: -46.6333, lat: -23.5505, size: 12 },\n { city: \"Buenos Aires\", lng: -58.3816, lat: -34.6037, size: 9 },\n { city: \"London\", lng: -0.1276, lat: 51.5074, size: 14 },\n { city: \"Berlin\", lng: 13.405, lat: 52.52, size: 11 },\n { city: \"Paris\", lng: 2.3522, lat: 48.8566, size: 13 },\n { city: \"Madrid\", lng: -3.7038, lat: 40.4168, size: 10 },\n { city: \"Cairo\", lng: 31.2357, lat: 30.0444, size: 9 },\n { city: \"Lagos\", lng: 3.3792, lat: 6.5244, size: 10 },\n { city: \"Mumbai\", lng: 72.8777, lat: 19.076, size: 13 },\n { city: \"Dubai\", lng: 55.2708, lat: 25.2048, size: 11 },\n { city: \"Seoul\", lng: 126.978, lat: 37.5665, size: 12 },\n { city: \"Singapore\", lng: 103.8198, lat: 1.3521, size: 10 },\n { city: \"Tokyo\", lng: 139.6917, lat: 35.6895, size: 12 },\n { city: \"Sydney\", lng: 151.2093, lat: -33.8688, size: 9 },\n { city: \"Auckland\", lng: 174.7633, lat: -36.8485, size: 8 },\n];\n\nexport const usersPerDay = [\n { day: \"Mon\", users: 320 },\n { day: \"Tue\", users: 410 },\n { day: \"Wed\", users: 560 },\n { day: \"Thu\", users: 640 },\n { day: \"Fri\", users: 780 },\n { day: \"Sat\", users: 690 },\n { day: \"Sun\", users: 720 },\n];\n\nexport const usersPerDayChartConfig = {\n users: {\n label: \"Users\",\n color: \"var(--color-blue-500)\",\n },\n} satisfies ChartConfig;\n\nexport const deviceCategoryData = [\n { name: \"Desktop\", value: 73.3, fill: \"var(--color-blue-500)\" },\n { name: \"Mobile\", value: 25.0, fill: \"var(--color-blue-400)\" },\n { name: \"Tablet\", value: 1.7, fill: \"var(--color-blue-300)\" },\n];\n\nexport const deviceCategoryChartConfig = {\n desktop: { label: \"Desktop\", color: \"var(--color-blue-500)\" },\n mobile: { label: \"Mobile\", color: \"var(--color-blue-400)\" },\n tablet: { label: \"Tablet\", color: \"var(--color-blue-300)\" },\n} satisfies ChartConfig;\n\nexport const visitedPagesRows: BreakdownRow[] = [\n { label: \"Home\", value: 31 },\n { label: \"Pricing\", value: 23 },\n { label: \"Docs / Basic Map\", value: 18 },\n { label: \"Installation\", value: 12 },\n { label: \"Components\", value: 9 },\n { label: \"Blog\", value: 6 },\n];\n\nexport const countriesRows: BreakdownRow[] = [\n { label: \"United States\", value: 27 },\n { label: \"India\", value: 14 },\n { label: \"United Kingdom\", value: 8 },\n { label: \"Germany\", value: 6 },\n { label: \"Japan\", value: 4 },\n { label: \"Australia\", value: 2 },\n];\n\nexport const referrersRows: BreakdownRow[] = [\n { label: \"google\", value: 38 },\n { label: \"direct\", value: 26 },\n { label: \"github.com\", value: 19 },\n { label: \"x.com\", value: 11 },\n { label: \"ui.shadcn.com\", value: 8 },\n { label: \"other\", value: 5 },\n];\n\nexport const browsersRows: BreakdownRow[] = [\n { label: \"Chrome\", value: 52 },\n { label: \"Safari\", value: 21 },\n { label: \"Firefox\", value: 14 },\n { label: \"Edge\", value: 8 },\n { label: \"Other\", value: 5 },\n];\n",
+ "content": "import { type ChartConfig } from \"@/components/ui/chart\";\n\nexport interface LocationPoint {\n city: string;\n lng: number;\n lat: number;\n size: number;\n}\n\nexport interface BreakdownRow {\n label: string;\n value: number;\n}\n\nexport const locations: LocationPoint[] = [\n { city: \"San Francisco\", lng: -122.4194, lat: 37.7749, size: 16 },\n { city: \"New York\", lng: -74.006, lat: 40.7128, size: 15 },\n { city: \"Toronto\", lng: -79.3832, lat: 43.6532, size: 11 },\n { city: \"Mexico City\", lng: -99.1332, lat: 19.4326, size: 10 },\n { city: \"Sao Paulo\", lng: -46.6333, lat: -23.5505, size: 12 },\n { city: \"Buenos Aires\", lng: -58.3816, lat: -34.6037, size: 9 },\n { city: \"London\", lng: -0.1276, lat: 51.5074, size: 14 },\n { city: \"Berlin\", lng: 13.405, lat: 52.52, size: 11 },\n { city: \"Paris\", lng: 2.3522, lat: 48.8566, size: 13 },\n { city: \"Madrid\", lng: -3.7038, lat: 40.4168, size: 10 },\n { city: \"Cairo\", lng: 31.2357, lat: 30.0444, size: 9 },\n { city: \"Lagos\", lng: 3.3792, lat: 6.5244, size: 10 },\n { city: \"Mumbai\", lng: 72.8777, lat: 19.076, size: 13 },\n { city: \"Dubai\", lng: 55.2708, lat: 25.2048, size: 11 },\n { city: \"Seoul\", lng: 126.978, lat: 37.5665, size: 12 },\n { city: \"Singapore\", lng: 103.8198, lat: 1.3521, size: 10 },\n { city: \"Tokyo\", lng: 139.6917, lat: 35.6895, size: 12 },\n { city: \"Sydney\", lng: 151.2093, lat: -33.8688, size: 9 },\n { city: \"Auckland\", lng: 174.7633, lat: -36.8485, size: 8 },\n];\n\nexport const usersPerDay = [\n { day: \"1\", users: 420 },\n { day: \"2\", users: 468 },\n { day: \"3\", users: 512 },\n { day: \"4\", users: 390 },\n { day: \"5\", users: 540 },\n { day: \"6\", users: 305 },\n { day: \"7\", users: 268 },\n { day: \"8\", users: 498 },\n { day: \"9\", users: 610 },\n { day: \"10\", users: 472 },\n { day: \"11\", users: 845 },\n { day: \"12\", users: 690 },\n { day: \"13\", users: 360 },\n { day: \"14\", users: 322 },\n { day: \"15\", users: 588 },\n { day: \"16\", users: 654 },\n { day: \"17\", users: 720 },\n { day: \"18\", users: 505 },\n { day: \"19\", users: 932 },\n { day: \"20\", users: 410 },\n { day: \"21\", users: 372 },\n { day: \"22\", users: 640 },\n { day: \"23\", users: 712 },\n { day: \"24\", users: 598 },\n { day: \"25\", users: 1040 },\n { day: \"26\", users: 805 },\n { day: \"27\", users: 445 },\n { day: \"28\", users: 398 },\n { day: \"29\", users: 702 },\n { day: \"30\", users: 868 },\n];\n\nexport const usersPerDayChartConfig = {\n users: {\n label: \"Users\",\n color: \"var(--color-blue-500)\",\n },\n} satisfies ChartConfig;\n\nexport const deviceCategoryData = [\n { name: \"Desktop\", value: 73.3, fill: \"var(--color-blue-500)\" },\n { name: \"Mobile\", value: 25.0, fill: \"var(--color-blue-400)\" },\n { name: \"Tablet\", value: 1.7, fill: \"var(--color-blue-300)\" },\n];\n\nexport const deviceCategoryChartConfig = {\n desktop: { label: \"Desktop\", color: \"var(--color-blue-500)\" },\n mobile: { label: \"Mobile\", color: \"var(--color-blue-400)\" },\n tablet: { label: \"Tablet\", color: \"var(--color-blue-300)\" },\n} satisfies ChartConfig;\n\nexport const visitedPagesRows: BreakdownRow[] = [\n { label: \"Home\", value: 31 },\n { label: \"Pricing\", value: 23 },\n { label: \"Docs / Basic Map\", value: 18 },\n { label: \"Installation\", value: 12 },\n { label: \"Components\", value: 9 },\n { label: \"Blog\", value: 6 },\n];\n\nexport const countriesRows: BreakdownRow[] = [\n { label: \"United States\", value: 27 },\n { label: \"India\", value: 14 },\n { label: \"United Kingdom\", value: 8 },\n { label: \"Germany\", value: 6 },\n { label: \"Japan\", value: 4 },\n { label: \"Australia\", value: 2 },\n];\n\nexport const referrersRows: BreakdownRow[] = [\n { label: \"google\", value: 38 },\n { label: \"direct\", value: 26 },\n { label: \"github.com\", value: 19 },\n { label: \"x.com\", value: 11 },\n { label: \"ui.shadcn.com\", value: 8 },\n { label: \"other\", value: 5 },\n];\n\nexport const browsersRows: BreakdownRow[] = [\n { label: \"Chrome\", value: 52 },\n { label: \"Safari\", value: 21 },\n { label: \"Firefox\", value: 14 },\n { label: \"Edge\", value: 8 },\n { label: \"Other\", value: 5 },\n];\n",
"type": "registry:component",
"target": "app/analytics/data.ts"
},
{
"path": "src/registry/blocks/analytics-map/components/overview-card.tsx",
- "content": "\"use client\";\n\nimport { Card, CardContent, CardHeader } from \"@/components/ui/card\";\nimport { ChartContainer } from \"@/components/ui/chart\";\nimport { TrendingUp } from \"lucide-react\";\nimport { Area, AreaChart, Cell, Pie, PieChart } from \"recharts\";\nimport {\n deviceCategoryChartConfig,\n deviceCategoryData,\n usersPerDay,\n usersPerDayChartConfig,\n} from \"../data\";\n\nfunction MetricChart() {\n return (\n <ChartContainer\n config={usersPerDayChartConfig}\n className=\"aspect-auto h-8 w-full\"\n >\n <AreaChart data={usersPerDay} margin={{ left: 4, right: 4, top: 4 }}>\n <defs>\n <linearGradient id=\"usersGradient\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop\n offset=\"0%\"\n stopColor=\"var(--color-users)\"\n stopOpacity={0.4}\n />\n <stop\n offset=\"100%\"\n stopColor=\"var(--color-users)\"\n stopOpacity={0}\n />\n </linearGradient>\n </defs>\n\n <Area\n type=\"natural\"\n dataKey=\"users\"\n stroke=\"var(--color-users)\"\n strokeWidth={1.5}\n fill=\"url(#usersGradient)\"\n />\n </AreaChart>\n </ChartContainer>\n );\n}\n\nexport function OverviewCard() {\n return (\n <Card className=\"bg-card/70 absolute top-4 left-4 z-10 w-60 backdrop-blur-sm\">\n <CardHeader>\n <div>\n <p className=\"text-muted-foreground pb-2 text-[10px] tracking-wider uppercase\">\n Users in last 7 days\n </p>\n <p className=\"text-3xl leading-none font-semibold\">3,803</p>\n </div>\n </CardHeader>\n\n <CardContent>\n <MetricChart />\n <div className=\"mt-4 flex items-center gap-1.5 text-xs\">\n <TrendingUp className=\"size-3 text-emerald-500\" />\n <span className=\"font-medium text-emerald-500\">+12.5%</span>\n <span className=\"text-muted-foreground\">vs previous 7 days</span>\n </div>\n\n <div className=\"border-border/60 mt-4 border-t pt-4\">\n <p className=\"text-muted-foreground text-[10px] tracking-wider uppercase\">\n Device category in last 7 days\n </p>\n\n <ChartContainer\n config={deviceCategoryChartConfig}\n className=\"mx-auto mt-3 aspect-square h-32 w-32\"\n >\n <PieChart>\n <Pie\n data={deviceCategoryData}\n dataKey=\"value\"\n nameKey=\"name\"\n innerRadius={32}\n outerRadius={52}\n strokeWidth={2}\n >\n {deviceCategoryData.map((entry) => (\n <Cell key={entry.name} fill={entry.fill} />\n ))}\n </Pie>\n </PieChart>\n </ChartContainer>\n\n <div className=\"mt-3 grid grid-cols-3 gap-2\">\n {deviceCategoryData.map((device) => (\n <div key={device.name} className=\"text-center\">\n <p className=\"text-muted-foreground flex items-center justify-center gap-1.5 text-[10px] tracking-wide uppercase\">\n <span\n className=\"size-2 rounded-full\"\n style={{ backgroundColor: device.fill }}\n />\n {device.name}\n </p>\n <p className=\"text-foreground mt-1 leading-none font-medium tabular-nums\">\n {device.value}%\n </p>\n </div>\n ))}\n </div>\n </div>\n </CardContent>\n </Card>\n );\n}\n",
+ "content": "\"use client\";\n\nimport { Card, CardContent, CardHeader } from \"@/components/ui/card\";\nimport { ChartContainer } from \"@/components/ui/chart\";\nimport { TrendingUp } from \"lucide-react\";\nimport { Area, AreaChart, Cell, Pie, PieChart } from \"recharts\";\nimport {\n deviceCategoryChartConfig,\n deviceCategoryData,\n usersPerDay,\n usersPerDayChartConfig,\n} from \"../data\";\n\nfunction MetricChart() {\n return (\n <ChartContainer\n config={usersPerDayChartConfig}\n className=\"aspect-auto h-14 w-full\"\n >\n <AreaChart data={usersPerDay}>\n <defs>\n <linearGradient id=\"usersGradient\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop\n offset=\"0%\"\n stopColor=\"var(--color-users)\"\n stopOpacity={0.4}\n />\n <stop\n offset=\"100%\"\n stopColor=\"var(--color-users)\"\n stopOpacity={0}\n />\n </linearGradient>\n </defs>\n\n <Area\n type=\"natural\"\n dataKey=\"users\"\n stroke=\"var(--color-users)\"\n strokeWidth={1.5}\n fill=\"url(#usersGradient)\"\n />\n </AreaChart>\n </ChartContainer>\n );\n}\n\nexport function OverviewCard() {\n return (\n <Card className=\"bg-card/80 absolute top-4 left-4 z-10 w-60 gap-1 backdrop-blur-sm\">\n <CardHeader>\n <div>\n <p className=\"text-muted-foreground pb-2 text-[10px] tracking-wider uppercase\">\n Users in last 30 days\n </p>\n <p className=\"text-3xl leading-none font-semibold\">17,234</p>\n </div>\n </CardHeader>\n\n <CardContent>\n <MetricChart />\n <div className=\"mt-2 flex items-center gap-1.5 text-xs\">\n <TrendingUp className=\"size-3 text-emerald-500\" />\n <span className=\"font-medium text-emerald-500\">+12.5%</span>\n <span className=\"text-muted-foreground\">vs previous 30 days</span>\n </div>\n\n <div className=\"border-border/60 mt-4 border-t pt-4\">\n <p className=\"text-muted-foreground text-[10px] tracking-wider uppercase\">\n Device category in last 30 days\n </p>\n\n <ChartContainer\n config={deviceCategoryChartConfig}\n className=\"mx-auto mt-3 aspect-square h-32 w-32\"\n >\n <PieChart>\n <Pie\n data={deviceCategoryData}\n dataKey=\"value\"\n nameKey=\"name\"\n innerRadius={32}\n outerRadius={52}\n strokeWidth={2}\n >\n {deviceCategoryData.map((entry) => (\n <Cell key={entry.name} fill={entry.fill} />\n ))}\n </Pie>\n </PieChart>\n </ChartContainer>\n\n <div className=\"mt-3 grid grid-cols-3 gap-2\">\n {deviceCategoryData.map((device) => (\n <div key={device.name} className=\"text-center\">\n <p className=\"text-muted-foreground flex items-center justify-center gap-1.5 text-[10px] tracking-wide uppercase\">\n <span\n className=\"size-2 rounded-full\"\n style={{ backgroundColor: device.fill }}\n />\n {device.name}\n </p>\n <p className=\"text-foreground mt-1 leading-none font-medium tabular-nums\">\n {device.value}%\n </p>\n </div>\n ))}\n </div>\n </div>\n </CardContent>\n </Card>\n );\n}\n",
"type": "registry:component",
"target": "app/analytics/components/overview-card.tsx"
},
{
"path": "src/registry/blocks/analytics-map/components/breakdown-card.tsx",
- "content": "\"use client\";\n\nimport { Card, CardContent, CardHeader, CardTitle } from \"@/components/ui/card\";\nimport { type BreakdownRow } from \"../data\";\n\ninterface BreakdownCardProps {\n title: string;\n rows: BreakdownRow[];\n}\n\nexport function BreakdownCard({ title, rows }: BreakdownCardProps) {\n const maxRowValue =\n rows.length > 0 ? Math.max(...rows.map((row) => row.value)) : 0;\n\n return (\n <Card>\n <CardHeader>\n <CardTitle className=\"text-sm font-medium\">{title}</CardTitle>\n </CardHeader>\n\n <CardContent>\n <div className=\"text-muted-foreground mb-2 flex items-center justify-between text-[11px] tracking-wider uppercase\">\n <span>{title}</span>\n <span>Visitors</span>\n </div>\n <div className=\"space-y-3\">\n {rows.map((row) => (\n <div key={row.label} className=\"space-y-1.5\">\n <div className=\"flex items-center justify-between text-xs\">\n <span className=\"text-foreground/90 truncate\">{row.label}</span>\n <span className=\"text-foreground font-medium\">{row.value}</span>\n </div>\n <div className=\"bg-muted h-1 rounded-full\">\n <div\n className=\"h-full rounded-full bg-blue-500/85\"\n style={{ width: `${(row.value / maxRowValue) * 100}%` }}\n />\n </div>\n </div>\n ))}\n </div>\n </CardContent>\n </Card>\n );\n}\n",
+ "content": "\"use client\";\n\nimport { Card, CardContent, CardHeader, CardTitle } from \"@/components/ui/card\";\nimport { type BreakdownRow } from \"../data\";\n\ninterface BreakdownCardProps {\n title: string;\n rows: BreakdownRow[];\n}\n\nexport function BreakdownCard({ title, rows }: BreakdownCardProps) {\n const maxRowValue =\n rows.length > 0 ? Math.max(...rows.map((row) => row.value)) : 0;\n\n return (\n <Card className=\"gap-2\">\n <CardHeader>\n <CardTitle className=\"text-sm font-medium\">{title}</CardTitle>\n </CardHeader>\n\n <CardContent>\n <div className=\"text-muted-foreground mb-2 flex items-center justify-between text-[11px] tracking-wider uppercase\">\n <span>{title}</span>\n <span>Visitors</span>\n </div>\n <div className=\"space-y-1.5\">\n {rows.map((row) => {\n const pct = maxRowValue ? (row.value / maxRowValue) * 100 : 0;\n return (\n <div\n key={row.label}\n className=\"relative flex items-center justify-between overflow-hidden rounded-md px-2 py-1.5 text-xs\"\n >\n <div\n className=\"absolute inset-y-0 left-0 rounded-md bg-blue-500/20\"\n style={{ width: `${pct}%` }}\n aria-hidden\n />\n <span className=\"text-foreground/90 relative truncate pr-2\">\n {row.label}\n </span>\n <span className=\"text-foreground relative font-medium tabular-nums\">\n {row.value.toLocaleString()}\n </span>\n </div>\n );\n })}\n </div>\n </CardContent>\n </Card>\n );\n}\n",
"type": "registry:component",
"target": "app/analytics/components/breakdown-card.tsx"
}
],
"meta": {
- "iframeHeight": "970px"
+ "iframeHeight": "940px"
},
"categories": [
"analytics",
diff --git a/public/r/choropleth.json b/public/r/choropleth.json
new file mode 100644
index 0000000..c27b484
--- /dev/null
+++ b/public/r/choropleth.json
@@ -0,0 +1,35 @@
+{
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
+ "name": "choropleth",
+ "title": "Choropleth",
+ "description": "World choropleth map shading countries by a metric, with a hover tooltip and legend.",
+ "dependencies": [
+ "maplibre-gl",
+ "next-themes"
+ ],
+ "registryDependencies": [
+ "@mapcn/map"
+ ],
+ "files": [
+ {
+ "path": "src/registry/blocks/choropleth/page.tsx",
+ "content": "\"use client\";\n\nimport { useEffect, useEffectEvent, useId, useRef, useState } from \"react\";\nimport type { MapLayerMouseEvent, StyleSpecification } from \"maplibre-gl\";\nimport { useTheme } from \"next-themes\";\n\nimport { Map, MapControls, MapPopup, useMap } from \"@/components/ui/map\";\nimport {\n COUNTRIES_GEOJSON_URL,\n mapConfig,\n visitorsByCountry,\n type Theme,\n} from \"./data\";\n\n// Transparent background so the themed container (`bg-background`) shows\n// through immediately on load, this avoids a white flash before the theme applies.\nconst MAP_STYLE: StyleSpecification = {\n version: 8,\n sources: {},\n layers: [\n {\n id: \"background\",\n type: \"background\",\n paint: { \"background-color\": \"rgba(0, 0, 0, 0)\" },\n },\n ],\n};\n\nconst MAP_STYLES = { light: MAP_STYLE, dark: MAP_STYLE };\n\nfunction buildFillColor(theme: Theme): unknown[] {\n const { base, ramp, hover } = mapConfig.colors[theme];\n const [s0, s1, s2, s3, s4] = mapConfig.scaleStops;\n return [\n \"case\",\n [\"boolean\", [\"feature-state\", \"hover\"], false],\n hover,\n [\n \"interpolate\",\n [\"linear\"],\n [\"coalesce\", [\"get\", \"visitors\"], 0],\n s0,\n base,\n s1,\n ramp[0],\n s2,\n ramp[1],\n s3,\n ramp[2],\n s4,\n ramp[3],\n ],\n ];\n}\n\ninterface HoverInfo {\n name: string;\n visitors: number;\n lng: number;\n lat: number;\n}\n\ninterface CountryFeatureCollection extends GeoJSON.FeatureCollection {\n features: Array<\n GeoJSON.Feature<GeoJSON.Geometry, { NAME_LONG: string; visitors: number }>\n >;\n}\n\nfunction ChoroplethLayer({\n onHover,\n}: {\n onHover: (info: HoverInfo | null) => void;\n}) {\n const { map, isLoaded } = useMap();\n const { resolvedTheme } = useTheme();\n const theme: Theme = resolvedTheme === \"dark\" ? \"dark\" : \"light\";\n const id = useId();\n const sourceId = `countries-${id}`;\n const fillLayerId = `countries-fill-${id}`;\n const lineLayerId = `countries-line-${id}`;\n\n const dataRef = useRef<CountryFeatureCollection | null>(null);\n const getTheme = useEffectEvent(() => theme);\n\n // Add the source + layers once.\n useEffect(() => {\n if (!map || !isLoaded) return;\n let cancelled = false;\n\n const setup = (data: CountryFeatureCollection) => {\n const currentTheme = getTheme();\n if (!map.getSource(sourceId)) {\n map.addSource(sourceId, {\n type: \"geojson\",\n data,\n promoteId: \"NAME_LONG\",\n });\n }\n if (!map.getLayer(fillLayerId)) {\n map.addLayer({\n id: fillLayerId,\n type: \"fill\",\n source: sourceId,\n paint: {\n \"fill-color\": buildFillColor(currentTheme) as never,\n \"fill-opacity\": 0.92,\n },\n });\n }\n if (!map.getLayer(lineLayerId)) {\n map.addLayer({\n id: lineLayerId,\n type: \"line\",\n source: sourceId,\n paint: {\n \"line-color\": mapConfig.colors[currentTheme].background,\n \"line-width\": 0.5,\n },\n });\n }\n };\n\n if (dataRef.current) {\n setup(dataRef.current);\n } else {\n fetch(COUNTRIES_GEOJSON_URL)\n .then((res) => res.json())\n .then((geo: CountryFeatureCollection) => {\n if (cancelled) return;\n for (const feature of geo.features) {\n const name = feature.properties.NAME_LONG;\n feature.properties.visitors = visitorsByCountry[name] ?? 0;\n }\n dataRef.current = geo;\n setup(geo);\n })\n .catch(() => {\n // ignore network errors\n });\n }\n\n return () => {\n cancelled = true;\n try {\n if (map.getLayer(lineLayerId)) map.removeLayer(lineLayerId);\n if (map.getLayer(fillLayerId)) map.removeLayer(fillLayerId);\n if (map.getSource(sourceId)) map.removeSource(sourceId);\n } catch {\n // ignore\n }\n };\n }, [map, isLoaded, sourceId, fillLayerId, lineLayerId]);\n\n // Recolor in place whenever the resolved theme changes.\n useEffect(() => {\n if (!map) return;\n if (map.getLayer(fillLayerId)) {\n map.setPaintProperty(\n fillLayerId,\n \"fill-color\",\n buildFillColor(theme) as never,\n );\n }\n if (map.getLayer(lineLayerId)) {\n map.setPaintProperty(\n lineLayerId,\n \"line-color\",\n mapConfig.colors[theme].background,\n );\n }\n }, [map, isLoaded, theme, fillLayerId, lineLayerId]);\n\n // Hover interaction: highlight the country and surface the popup.\n useEffect(() => {\n if (!map || !isLoaded) return;\n let hoveredId: string | null = null;\n\n const clearHover = () => {\n if (hoveredId != null && map.getSource(sourceId)) {\n map.setFeatureState(\n { source: sourceId, id: hoveredId },\n { hover: false },\n );\n }\n hoveredId = null;\n };\n\n const handleMove = (e: MapLayerMouseEvent) => {\n const feature = e.features?.[0];\n const visitors = (feature?.properties?.visitors as number) ?? 0;\n\n // Only data countries are interactive.\n if (!feature || visitors <= 0) {\n clearHover();\n map.getCanvas().style.cursor = \"\";\n onHover(null);\n return;\n }\n\n map.getCanvas().style.cursor = \"pointer\";\n\n const featureId = feature.id as string;\n if (featureId !== hoveredId) {\n clearHover();\n hoveredId = featureId;\n map.setFeatureState(\n { source: sourceId, id: featureId },\n { hover: true },\n );\n\n onHover({\n name: feature.properties?.NAME_LONG as string,\n visitors,\n lng: e.lngLat.lng,\n lat: e.lngLat.lat,\n });\n }\n };\n\n const handleLeave = () => {\n clearHover();\n map.getCanvas().style.cursor = \"\";\n onHover(null);\n };\n\n map.on(\"mousemove\", fillLayerId, handleMove);\n map.on(\"mouseleave\", fillLayerId, handleLeave);\n\n return () => {\n map.off(\"mousemove\", fillLayerId, handleMove);\n map.off(\"mouseleave\", fillLayerId, handleLeave);\n clearHover();\n };\n }, [map, isLoaded, sourceId, fillLayerId, onHover]);\n\n return null;\n}\n\nfunction Legend({ theme }: { theme: Theme }) {\n const gradient = `linear-gradient(to right, ${mapConfig.colors[theme].ramp.join(\", \")})`;\n\n return (\n <div className=\"bg-card/90 absolute bottom-4 left-4 z-10 rounded-lg border px-3 py-2.5 backdrop-blur-sm\">\n <p className=\"text-foreground text-xs font-medium\">Visitors by country</p>\n <div\n className=\"mt-2 h-2 w-40 rounded-full\"\n style={{ backgroundImage: gradient }}\n suppressHydrationWarning\n />\n <div className=\"text-muted-foreground flex items-center justify-between pt-1.5 text-[10px]\">\n <span>Low</span>\n <span>High</span>\n </div>\n </div>\n );\n}\n\nexport default function Page() {\n const { resolvedTheme } = useTheme();\n const theme: Theme = resolvedTheme === \"dark\" ? \"dark\" : \"light\";\n const [hover, setHover] = useState<HoverInfo | null>(null);\n\n return (\n <div className=\"bg-background relative h-screen overflow-hidden [&_.maplibregl-popup-content]:pointer-events-none\">\n <Map\n className=\"bg-background\"\n styles={MAP_STYLES}\n center={mapConfig.view.center}\n zoom={mapConfig.view.zoom}\n minZoom={mapConfig.view.minZoom}\n maxZoom={mapConfig.view.maxZoom}\n dragRotate={false}\n pitchWithRotate={false}\n attributionControl={false}\n >\n <ChoroplethLayer onHover={setHover} />\n <MapControls />\n {hover && (\n <MapPopup\n longitude={hover.lng}\n latitude={hover.lat}\n offset={12}\n closeButton={false}\n className=\"pointer-events-none p-2\"\n >\n <p className=\"text-popover-foreground text-xs font-medium\">\n {hover.name}\n </p>\n <div className=\"flex items-center justify-between gap-4 pt-1\">\n <span className=\"text-muted-foreground flex items-center gap-1.5 text-[11px]\">\n <span\n className=\"size-2 rounded-full\"\n style={{ backgroundColor: mapConfig.colors[theme].hover }}\n />\n Visitors\n </span>\n <span className=\"text-foreground text-xs font-semibold tabular-nums\">\n {hover.visitors.toLocaleString()}\n </span>\n </div>\n </MapPopup>\n )}\n </Map>\n\n <Legend theme={theme} />\n </div>\n );\n}\n",
+ "type": "registry:page",
+ "target": "app/choropleth/page.tsx"
+ },
+ {
+ "path": "src/registry/blocks/choropleth/data.ts",
+ "content": "export const COUNTRIES_GEOJSON_URL =\n \"https://cdn.jsdelivr.net/gh/martynafford/natural-earth-geojson/110m/cultural/ne_110m_admin_0_countries.json\";\n\n/** Visitor counts keyed by the feature `NAME_LONG`. */\nexport const visitorsByCountry: Record<string, number> = {\n Germany: 15,\n \"United States\": 14,\n \"United Kingdom\": 12,\n India: 9,\n France: 9,\n Australia: 8,\n Netherlands: 8,\n Spain: 7,\n Italy: 6,\n Sweden: 6,\n Poland: 4,\n};\n\nexport const MAX_VISITORS = 15;\n\nexport type Theme = \"light\" | \"dark\";\n\n/** Resolved colors for the choropleth, per theme. */\ninterface ChoroplethColors {\n /** Map surface behind the countries (also used for country borders). */\n background: string;\n /** Fill for countries with no data (value 0). */\n base: string;\n /** Sequential fill ramp from low → high, mapped to `scaleStops`. */\n ramp: [string, string, string, string];\n /** Fill for the hovered country. */\n hover: string;\n}\n\n/**\n * Central map config — colors, the value→color scale, and the initial view.\n * WebGL paint can't read CSS variables, so colors are concrete values per\n * theme. The ramp is a single-hue blue scale tuned for contrast on each\n * theme's basemap.\n */\nexport const mapConfig = {\n view: {\n center: [12, 28] as [number, number],\n zoom: 1.4,\n minZoom: 1,\n maxZoom: 4,\n },\n scaleStops: [0, 1, 5, 10, MAX_VISITORS] as const,\n colors: {\n light: {\n background: \"#fafafa\",\n base: \"#eef0f3\",\n ramp: [\"#bfdbfe\", \"#60a5fa\", \"#3b82f6\", \"#1d4ed8\"],\n hover: \"#1e3a8a\",\n },\n dark: {\n background: \"#0a0a0a\",\n base: \"#1a1a1a\",\n ramp: [\"#1d4ed8\", \"#3b82f6\", \"#60a5fa\", \"#93c5fd\"],\n hover: \"#bfdbfe\",\n },\n } satisfies Record<Theme, ChoroplethColors>,\n};\n",
+ "type": "registry:component",
+ "target": "app/choropleth/data.ts"
+ }
+ ],
+ "meta": {
+ "iframeHeight": "720px"
+ },
+ "categories": [
+ "visualization",
+ "choropleth"
+ ],
+ "type": "registry:block"
+}
diff --git a/public/r/registry.json b/public/r/registry.json
index a9b86fd..4345100 100644
--- a/public/r/registry.json
+++ b/public/r/registry.json
@@ -8,7 +8,10 @@
"type": "registry:ui",
"title": "Map",
"description": "A MapLibre-powered map component with markers, popups, tooltips, routes, and controls.",
- "dependencies": ["maplibre-gl", "lucide-react"],
+ "dependencies": [
+ "maplibre-gl",
+ "lucide-react"
+ ],
"registryDependencies": [],
"files": [
{
@@ -20,7 +23,7 @@
"css": {
"@layer base": {
".maplibregl-popup-content": {
- "@apply bg-transparent! shadow-none! p-0! rounded-none!": {}
+ "@apply bg-transparent! shadow-none! p-0! rounded-none!": {}
},
".maplibregl-popup-tip": {
"@apply hidden!": {}
@@ -33,8 +36,15 @@
"type": "registry:block",
"title": "Analytics Map",
"description": "Real-time analytics overview with a world map, breakdown cards, and device stats.",
- "dependencies": ["recharts", "lucide-react"],
- "registryDependencies": ["@mapcn/map", "card", "chart"],
+ "dependencies": [
+ "recharts",
+ "lucide-react"
+ ],
+ "registryDependencies": [
+ "@mapcn/map",
+ "card",
+ "chart"
+ ],
"files": [
{
"path": "src/registry/blocks/analytics-map/page.tsx",
@@ -57,9 +67,87 @@
"target": "app/analytics/components/breakdown-card.tsx"
}
],
- "categories": ["analytics", "dashboard"],
+ "categories": [
+ "analytics",
+ "dashboard"
+ ],
+ "meta": {
+ "iframeHeight": "940px"
+ }
+ },
+ {
+ "name": "choropleth",
+ "type": "registry:block",
+ "title": "Choropleth",
+ "description": "World choropleth map shading countries by a metric, with a hover tooltip and legend.",
+ "dependencies": [
+ "maplibre-gl",
+ "next-themes"
+ ],
+ "registryDependencies": [
+ "@mapcn/map"
+ ],
+ "files": [
+ {
+ "path": "src/registry/blocks/choropleth/page.tsx",
+ "type": "registry:page",
+ "target": "app/choropleth/page.tsx"
+ },
+ {
+ "path": "src/registry/blocks/choropleth/data.ts",
+ "type": "registry:component",
+ "target": "app/choropleth/data.ts"
+ }
+ ],
+ "categories": [
+ "visualization",
+ "choropleth"
+ ],
"meta": {
- "iframeHeight": "970px"
+ "iframeHeight": "720px"
+ }
+ },
+ {
+ "name": "store-locator",
+ "type": "registry:block",
+ "title": "Store Locator",
+ "description": "Searchable store list synced with map markers.",
+ "dependencies": [
+ "lucide-react"
+ ],
+ "registryDependencies": [
+ "@mapcn/map",
+ "input",
+ "sidebar"
+ ],
+ "files": [
+ {
+ "path": "src/registry/blocks/store-locator/page.tsx",
+ "type": "registry:page",
+ "target": "app/store-locator/page.tsx"
+ },
+ {
+ "path": "src/registry/blocks/store-locator/data.ts",
+ "type": "registry:component",
+ "target": "app/store-locator/data.ts"
+ },
+ {
+ "path": "src/registry/blocks/store-locator/components/store-list.tsx",
+ "type": "registry:component",
+ "target": "app/store-locator/components/store-list.tsx"
+ },
+ {
+ "path": "src/registry/blocks/store-locator/components/locator-map.tsx",
+ "type": "registry:component",
+ "target": "app/store-locator/components/locator-map.tsx"
+ }
+ ],
+ "categories": [
+ "store-locator",
+ "locator"
+ ],
+ "meta": {
+ "iframeHeight": "800px"
}
},
{
@@ -67,8 +155,14 @@
"type": "registry:block",
"title": "Logistics Network",
"description": "Domestic logistics map with a sidebar of stats.",
- "dependencies": ["lucide-react"],
- "registryDependencies": ["@mapcn/map", "sidebar", "separator"],
+ "dependencies": [
+ "lucide-react"
+ ],
+ "registryDependencies": [
+ "@mapcn/map",
+ "sidebar",
+ "separator"
+ ],
"files": [
{
"path": "src/registry/blocks/logistics-network/page.tsx",
@@ -91,47 +185,66 @@
"target": "app/logistics/components/network-map.tsx"
}
],
- "categories": ["logistics", "network"],
+ "categories": [
+ "logistics",
+ "network"
+ ],
"meta": {
"iframeHeight": "800px"
}
},
{
- "name": "heatmap",
+ "name": "delivery-tracker",
"type": "registry:block",
- "title": "Heatmap",
- "description": "Globe-projected heatmap visualizing earthquake density with zoom-dependent styling.",
- "dependencies": [],
- "registryDependencies": ["@mapcn/map", "card"],
+ "title": "Delivery Tracker",
+ "description": "Live order tracking with route progress, courier position, and order details.",
+ "dependencies": [
+ "lucide-react"
+ ],
+ "registryDependencies": [
+ "@mapcn/map",
+ "card",
+ "badge",
+ "button"
+ ],
"files": [
{
- "path": "src/registry/blocks/heatmap/page.tsx",
+ "path": "src/registry/blocks/delivery-tracker/page.tsx",
"type": "registry:page",
- "target": "app/heatmap/page.tsx"
+ "target": "app/delivery/page.tsx"
}
],
- "categories": ["visualization", "heatmap"],
+ "categories": [
+ "tracking",
+ "delivery"
+ ],
"meta": {
- "iframeHeight": "800px"
+ "iframeHeight": "680px"
}
},
{
- "name": "delivery-tracker",
+ "name": "heatmap",
"type": "registry:block",
- "title": "Delivery Tracker",
- "description": "Live order tracking with route progress, courier position, and order details.",
- "dependencies": ["lucide-react"],
- "registryDependencies": ["@mapcn/map", "card", "badge", "button"],
+ "title": "Heatmap",
+ "description": "Globe-projected heatmap visualizing earthquake density with zoom-dependent styling.",
+ "dependencies": [],
+ "registryDependencies": [
+ "@mapcn/map",
+ "card"
+ ],
"files": [
{
- "path": "src/registry/blocks/delivery-tracker/page.tsx",
+ "path": "src/registry/blocks/heatmap/page.tsx",
"type": "registry:page",
- "target": "app/delivery/page.tsx"
+ "target": "app/heatmap/page.tsx"
}
],
- "categories": ["tracking", "delivery"],
+ "categories": [
+ "visualization",
+ "heatmap"
+ ],
"meta": {
- "iframeHeight": "680px"
+ "iframeHeight": "800px"
}
}
]
diff --git a/public/r/store-locator.json b/public/r/store-locator.json
new file mode 100644
index 0000000..1fc054b
--- /dev/null
+++ b/public/r/store-locator.json
@@ -0,0 +1,48 @@
+{
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
+ "name": "store-locator",
+ "title": "Store Locator",
+ "description": "Searchable store list synced with map markers.",
+ "dependencies": [
+ "lucide-react"
+ ],
+ "registryDependencies": [
+ "@mapcn/map",
+ "input",
+ "sidebar"
+ ],
+ "files": [
+ {
+ "path": "src/registry/blocks/store-locator/page.tsx",
+ "content": "\"use client\";\n\nimport { useMemo, useState, type CSSProperties } from \"react\";\n\nimport { SidebarInset, SidebarProvider } from \"@/components/ui/sidebar\";\nimport { StoreList } from \"./components/store-list\";\nimport { LocatorMap } from \"./components/locator-map\";\nimport { MAP_CENTER, stores } from \"./data\";\n\nexport default function Page() {\n const [query, setQuery] = useState(\"\");\n const [selectedId, setSelectedId] = useState<string | null>(stores[0].id);\n\n const filtered = useMemo(() => {\n const q = query.trim().toLowerCase();\n if (!q) return stores;\n return stores.filter(\n (store) =>\n store.name.toLowerCase().includes(q) ||\n store.address.toLowerCase().includes(q) ||\n store.neighborhood.toLowerCase().includes(q),\n );\n }, [query]);\n\n return (\n <SidebarProvider style={{ \"--sidebar-width\": \"20rem\" } as CSSProperties}>\n <StoreList\n stores={filtered}\n query={query}\n onQueryChange={setQuery}\n selectedId={selectedId}\n onSelect={setSelectedId}\n />\n\n <SidebarInset>\n <LocatorMap\n stores={filtered}\n selectedId={selectedId}\n onSelect={setSelectedId}\n onClearSelection={() => setSelectedId(null)}\n center={MAP_CENTER}\n />\n </SidebarInset>\n </SidebarProvider>\n );\n}\n",
+ "type": "registry:page",
+ "target": "app/store-locator/page.tsx"
+ },
+ {
+ "path": "src/registry/blocks/store-locator/data.ts",
+ "content": "export interface Store {\n id: string;\n name: string;\n address: string;\n neighborhood: string;\n phone: string;\n hours: string;\n openNow: boolean;\n lat: number;\n lng: number;\n}\n\nexport const MAP_CENTER: [number, number] = [-122.4194, 37.7749];\n\nexport const stores: Store[] = [\n {\n id: \"ferry-building\",\n name: \"Ferry Building\",\n address: \"1 Ferry Building\",\n neighborhood: \"Embarcadero\",\n phone: \"(415) 555-0142\",\n hours: \"7:00 AM – 8:00 PM\",\n openNow: true,\n lat: 37.7955,\n lng: -122.3933,\n },\n {\n id: \"union-square\",\n name: \"Union Square\",\n address: \"333 Post St\",\n neighborhood: \"Downtown\",\n phone: \"(415) 555-0188\",\n hours: \"6:30 AM – 9:00 PM\",\n openNow: true,\n lat: 37.788,\n lng: -122.4075,\n },\n {\n id: \"north-beach\",\n name: \"North Beach\",\n address: \"601 Columbus Ave\",\n neighborhood: \"North Beach\",\n phone: \"(415) 555-0119\",\n hours: \"7:00 AM – 7:00 PM\",\n openNow: true,\n lat: 37.8003,\n lng: -122.4097,\n },\n {\n id: \"hayes-valley\",\n name: \"Hayes Valley\",\n address: \"450 Hayes St\",\n neighborhood: \"Hayes Valley\",\n phone: \"(415) 555-0163\",\n hours: \"7:30 AM – 6:00 PM\",\n openNow: false,\n lat: 37.7765,\n lng: -122.4256,\n },\n {\n id: \"mission\",\n name: \"Mission District\",\n address: \"2901 Mission St\",\n neighborhood: \"Mission\",\n phone: \"(415) 555-0177\",\n hours: \"6:00 AM – 8:00 PM\",\n openNow: true,\n lat: 37.7509,\n lng: -122.4181,\n },\n {\n id: \"marina\",\n name: \"Marina\",\n address: \"2156 Chestnut St\",\n neighborhood: \"Marina\",\n phone: \"(415) 555-0125\",\n hours: \"7:00 AM – 7:00 PM\",\n openNow: false,\n lat: 37.8003,\n lng: -122.4366,\n },\n {\n id: \"castro\",\n name: \"Castro\",\n address: \"489 Castro St\",\n neighborhood: \"Castro\",\n phone: \"(415) 555-0151\",\n hours: \"7:00 AM – 8:00 PM\",\n openNow: true,\n lat: 37.7609,\n lng: -122.435,\n },\n {\n id: \"soma\",\n name: \"SoMa\",\n address: \"680 Folsom St\",\n neighborhood: \"SoMa\",\n phone: \"(415) 555-0134\",\n hours: \"6:30 AM – 6:30 PM\",\n openNow: true,\n lat: 37.7852,\n lng: -122.3982,\n },\n];\n",
+ "type": "registry:component",
+ "target": "app/store-locator/data.ts"
+ },
+ {
+ "path": "src/registry/blocks/store-locator/components/store-list.tsx",
+ "content": "\"use client\";\n\nimport { useEffect, useRef } from \"react\";\nimport { Clock, MapPin, Phone, Search } from \"lucide-react\";\n\nimport {\n Sidebar,\n SidebarContent,\n SidebarGroup,\n SidebarHeader,\n SidebarMenu,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarSeparator,\n} from \"@/components/ui/sidebar\";\nimport { Input } from \"@/components/ui/input\";\nimport { cn } from \"@/lib/utils\";\nimport type { Store } from \"../data\";\n\ninterface StoreListProps {\n stores: Store[];\n query: string;\n onQueryChange: (value: string) => void;\n selectedId: string | null;\n onSelect: (id: string) => void;\n}\n\nexport function StoreList({\n stores,\n query,\n onQueryChange,\n selectedId,\n onSelect,\n}: StoreListProps) {\n const itemRefs = useRef(new Map<string, HTMLButtonElement>());\n\n useEffect(() => {\n if (!selectedId) return;\n itemRefs.current\n .get(selectedId)\n ?.scrollIntoView({ block: \"nearest\", behavior: \"smooth\" });\n }, [selectedId]);\n\n return (\n <Sidebar collapsible=\"offcanvas\">\n <SidebarHeader className=\"gap-3 p-4\">\n <div>\n <h2 className=\"text-foreground text-lg font-semibold tracking-tight\">\n Find a store\n </h2>\n <p className=\"text-muted-foreground text-sm\">\n {stores.length} {stores.length === 1 ? \"location\" : \"locations\"}{\" \"}\n near you\n </p>\n </div>\n <div className=\"relative\">\n <Search className=\"text-muted-foreground absolute top-1/2 left-2.5 size-4 -translate-y-1/2\" />\n <Input\n value={query}\n onChange={(e) => onQueryChange(e.target.value)}\n placeholder=\"Search name or address\"\n className=\"bg-background pl-8\"\n aria-label=\"Search stores\"\n />\n </div>\n </SidebarHeader>\n\n <SidebarSeparator className=\"mx-0\" />\n\n <SidebarContent>\n {stores.length === 0 ? (\n <div className=\"text-muted-foreground p-6 text-center text-sm\">\n No stores match your search.\n </div>\n ) : (\n <SidebarGroup className=\"p-2\">\n <SidebarMenu className=\"gap-1\">\n {stores.map((store) => {\n const active = store.id === selectedId;\n return (\n <SidebarMenuItem key={store.id}>\n <SidebarMenuButton\n asChild\n isActive={active}\n className=\"h-auto flex-col items-stretch gap-0 p-3\"\n >\n <button\n type=\"button\"\n ref={(el) => {\n if (el) itemRefs.current.set(store.id, el);\n else itemRefs.current.delete(store.id);\n }}\n onClick={() => onSelect(store.id)}\n aria-current={active}\n >\n <div className=\"flex items-center justify-between gap-2\">\n <span className=\"text-foreground font-medium\">\n {store.name}\n </span>\n <span\n className={cn(\n \"flex items-center gap-1.5 text-xs font-medium\",\n store.openNow\n ? \"text-foreground\"\n : \"text-muted-foreground\",\n )}\n >\n <span\n className={cn(\n \"size-1.5 rounded-full\",\n store.openNow\n ? \"bg-emerald-500\"\n : \"bg-neutral-500\",\n )}\n />\n {store.openNow ? \"Open\" : \"Closed\"}\n </span>\n </div>\n\n <div className=\"text-muted-foreground mt-2 space-y-1.5 text-xs font-normal tabular-nums\">\n <p className=\"flex items-center gap-1.5\">\n <MapPin className=\"size-3.5 shrink-0\" />\n {store.address}, {store.neighborhood}\n </p>\n <p className=\"flex items-center gap-1.5\">\n <Clock className=\"size-3.5 shrink-0\" />\n {store.hours}\n </p>\n <p className=\"flex items-center gap-1.5\">\n <Phone className=\"size-3.5 shrink-0\" />\n {store.phone}\n </p>\n </div>\n </button>\n </SidebarMenuButton>\n </SidebarMenuItem>\n );\n })}\n </SidebarMenu>\n </SidebarGroup>\n )}\n </SidebarContent>\n </Sidebar>\n );\n}\n",
+ "type": "registry:component",
+ "target": "app/store-locator/components/store-list.tsx"
+ },
+ {
+ "path": "src/registry/blocks/store-locator/components/locator-map.tsx",
+ "content": "\"use client\";\n\nimport { useEffect } from \"react\";\nimport { Clock, MapPin, Phone } from \"lucide-react\";\n\nimport {\n Map,\n MapControls,\n MapMarker,\n MapPopup,\n MarkerContent,\n MarkerTooltip,\n useMap,\n} from \"@/components/ui/map\";\nimport { SidebarTrigger } from \"@/components/ui/sidebar\";\nimport { cn } from \"@/lib/utils\";\nimport type { Store } from \"../data\";\n\ninterface LocatorMapProps {\n stores: Store[];\n selectedId: string | null;\n onSelect: (id: string) => void;\n onClearSelection: () => void;\n center: [number, number];\n}\n\nfunction FlyToSelected({ store }: { store?: Store }) {\n const { map } = useMap();\n\n useEffect(() => {\n if (!map || !store) return;\n map.flyTo({\n center: [store.lng, store.lat],\n zoom: 14,\n duration: 800,\n essential: true,\n });\n }, [map, store]);\n\n return null;\n}\n\nfunction StorePin({ active }: { active: boolean }) {\n return (\n <div\n className={cn(\n \"text-background flex items-center justify-center rounded-full shadow-md transition-all\",\n active\n ? \"bg-foreground/80 size-9 scale-110\"\n : \"bg-foreground hover:bg-muted-foreground size-7\",\n )}\n >\n <MapPin className={cn(active ? \"size-4.5\" : \"size-3.5\")} />\n </div>\n );\n}\n\nexport function LocatorMap({\n stores,\n selectedId,\n onSelect,\n onClearSelection,\n center,\n}: LocatorMapProps) {\n const selected = stores.find((store) => store.id === selectedId);\n\n return (\n <div className=\"relative h-full\">\n <SidebarTrigger className=\"bg-background absolute top-3 left-3 z-10 border shadow-sm md:hidden\" />\n\n <Map center={center} zoom={12} minZoom={10} maxZoom={17}>\n <MapControls showFullscreen />\n <FlyToSelected store={selected} />\n\n {stores.map((store) => (\n <MapMarker\n key={store.id}\n longitude={store.lng}\n latitude={store.lat}\n onClick={() => onSelect(store.id)}\n >\n <MarkerContent>\n <StorePin active={store.id === selectedId} />\n </MarkerContent>\n <MarkerTooltip\n offset={24}\n className=\"bg-foreground text-background\"\n >\n {store.name}\n </MarkerTooltip>\n </MapMarker>\n ))}\n\n {selected && (\n <MapPopup\n longitude={selected.lng}\n latitude={selected.lat}\n offset={26}\n closeButton\n closeOnClick={false}\n onClose={onClearSelection}\n className=\"min-w-56\"\n focusAfterOpen={false}\n >\n <p className=\"text-popover-foreground pr-5 font-medium\">\n {selected.name}\n </p>\n <span\n className={cn(\n \"mt-1 flex items-center gap-1.5 text-xs font-medium\",\n selected.openNow ? \"text-foreground\" : \"text-muted-foreground\",\n )}\n >\n <span\n className={cn(\n \"size-1.5 rounded-full\",\n selected.openNow ? \"bg-emerald-500\" : \"bg-neutral-500\",\n )}\n />\n {selected.openNow ? \"Open now\" : \"Closed\"}\n </span>\n\n <div className=\"text-muted-foreground mt-2.5 space-y-1.5 text-xs tabular-nums\">\n <p className=\"flex items-center gap-1.5\">\n <MapPin className=\"size-3.5 shrink-0\" />\n {selected.address}, {selected.neighborhood}\n </p>\n <p className=\"flex items-center gap-1.5\">\n <Clock className=\"size-3.5 shrink-0\" />\n {selected.hours}\n </p>\n <p className=\"flex items-center gap-1.5\">\n <Phone className=\"size-3.5 shrink-0\" />\n {selected.phone}\n </p>\n </div>\n </MapPopup>\n )}\n </Map>\n </div>\n );\n}\n",
+ "type": "registry:component",
+ "target": "app/store-locator/components/locator-map.tsx"
+ }
+ ],
+ "meta": {
+ "iframeHeight": "800px"
+ },
+ "categories": [
+ "store-locator",
+ "locator"
+ ],
+ "type": "registry:block"
+}
diff --git a/registry.json b/registry.json
index a9b86fd..4345100 100644
--- a/registry.json
+++ b/registry.json
@@ -8,7 +8,10 @@
"type": "registry:ui",
"title": "Map",
"description": "A MapLibre-powered map component with markers, popups, tooltips, routes, and controls.",
- "dependencies": ["maplibre-gl", "lucide-react"],
+ "dependencies": [
+ "maplibre-gl",
+ "lucide-react"
+ ],
"registryDependencies": [],
"files": [
{
@@ -20,7 +23,7 @@
"css": {
"@layer base": {
".maplibregl-popup-content": {
- "@apply bg-transparent! shadow-none! p-0! rounded-none!": {}
+ "@apply bg-transparent! shadow-none! p-0! rounded-none!": {}
},
".maplibregl-popup-tip": {
"@apply hidden!": {}
@@ -33,8 +36,15 @@
"type": "registry:block",
"title": "Analytics Map",
"description": "Real-time analytics overview with a world map, breakdown cards, and device stats.",
- "dependencies": ["recharts", "lucide-react"],
- "registryDependencies": ["@mapcn/map", "card", "chart"],
+ "dependencies": [
+ "recharts",
+ "lucide-react"
+ ],
+ "registryDependencies": [
+ "@mapcn/map",
+ "card",
+ "chart"
+ ],
"files": [
{
"path": "src/registry/blocks/analytics-map/page.tsx",
@@ -57,9 +67,87 @@
"target": "app/analytics/components/breakdown-card.tsx"
}
],
- "categories": ["analytics", "dashboard"],
+ "categories": [
+ "analytics",
+ "dashboard"
+ ],
+ "meta": {
+ "iframeHeight": "940px"
+ }
+ },
+ {
+ "name": "choropleth",
+ "type": "registry:block",
+ "title": "Choropleth",
+ "description": "World choropleth map shading countries by a metric, with a hover tooltip and legend.",
+ "dependencies": [
+ "maplibre-gl",
+ "next-themes"
+ ],
+ "registryDependencies": [
+ "@mapcn/map"
+ ],
+ "files": [
+ {
+ "path": "src/registry/blocks/choropleth/page.tsx",
+ "type": "registry:page",
+ "target": "app/choropleth/page.tsx"
+ },
+ {
+ "path": "src/registry/blocks/choropleth/data.ts",
+ "type": "registry:component",
+ "target": "app/choropleth/data.ts"
+ }
+ ],
+ "categories": [
+ "visualization",
+ "choropleth"
+ ],
"meta": {
- "iframeHeight": "970px"
+ "iframeHeight": "720px"
+ }
+ },
+ {
+ "name": "store-locator",
+ "type": "registry:block",
+ "title": "Store Locator",
+ "description": "Searchable store list synced with map markers.",
+ "dependencies": [
+ "lucide-react"
+ ],
+ "registryDependencies": [
+ "@mapcn/map",
+ "input",
+ "sidebar"
+ ],
+ "files": [
+ {
+ "path": "src/registry/blocks/store-locator/page.tsx",
+ "type": "registry:page",
+ "target": "app/store-locator/page.tsx"
+ },
+ {
+ "path": "src/registry/blocks/store-locator/data.ts",
+ "type": "registry:component",
+ "target": "app/store-locator/data.ts"
+ },
+ {
+ "path": "src/registry/blocks/store-locator/components/store-list.tsx",
+ "type": "registry:component",
+ "target": "app/store-locator/components/store-list.tsx"
+ },
+ {
+ "path": "src/registry/blocks/store-locator/components/locator-map.tsx",
+ "type": "registry:component",
+ "target": "app/store-locator/components/locator-map.tsx"
+ }
+ ],
+ "categories": [
+ "store-locator",
+ "locator"
+ ],
+ "meta": {
+ "iframeHeight": "800px"
}
},
{
@@ -67,8 +155,14 @@
"type": "registry:block",
"title": "Logistics Network",
"description": "Domestic logistics map with a sidebar of stats.",
- "dependencies": ["lucide-react"],
- "registryDependencies": ["@mapcn/map", "sidebar", "separator"],
+ "dependencies": [
+ "lucide-react"
+ ],
+ "registryDependencies": [
+ "@mapcn/map",
+ "sidebar",
+ "separator"
+ ],
"files": [
{
"path": "src/registry/blocks/logistics-network/page.tsx",
@@ -91,47 +185,66 @@
"target": "app/logistics/components/network-map.tsx"
}
],
- "categories": ["logistics", "network"],
+ "categories": [
+ "logistics",
+ "network"
+ ],
"meta": {
"iframeHeight": "800px"
}
},
{
- "name": "heatmap",
+ "name": "delivery-tracker",
"type": "registry:block",
- "title": "Heatmap",
- "description": "Globe-projected heatmap visualizing earthquake density with zoom-dependent styling.",
- "dependencies": [],
- "registryDependencies": ["@mapcn/map", "card"],
+ "title": "Delivery Tracker",
+ "description": "Live order tracking with route progress, courier position, and order details.",
+ "dependencies": [
+ "lucide-react"
+ ],
+ "registryDependencies": [
+ "@mapcn/map",
+ "card",
+ "badge",
+ "button"
+ ],
"files": [
{
- "path": "src/registry/blocks/heatmap/page.tsx",
+ "path": "src/registry/blocks/delivery-tracker/page.tsx",
"type": "registry:page",
- "target": "app/heatmap/page.tsx"
+ "target": "app/delivery/page.tsx"
}
],
- "categories": ["visualization", "heatmap"],
+ "categories": [
+ "tracking",
+ "delivery"
+ ],
"meta": {
- "iframeHeight": "800px"
+ "iframeHeight": "680px"
}
},
{
- "name": "delivery-tracker",
+ "name": "heatmap",
"type": "registry:block",
- "title": "Delivery Tracker",
- "description": "Live order tracking with route progress, courier position, and order details.",
- "dependencies": ["lucide-react"],
- "registryDependencies": ["@mapcn/map", "card", "badge", "button"],
+ "title": "Heatmap",
+ "description": "Globe-projected heatmap visualizing earthquake density with zoom-dependent styling.",
+ "dependencies": [],
+ "registryDependencies": [
+ "@mapcn/map",
+ "card"
+ ],
"files": [
{
- "path": "src/registry/blocks/delivery-tracker/page.tsx",
+ "path": "src/registry/blocks/heatmap/page.tsx",
"type": "registry:page",
- "target": "app/delivery/page.tsx"
+ "target": "app/heatmap/page.tsx"
}
],
- "categories": ["tracking", "delivery"],
+ "categories": [
+ "visualization",
+ "heatmap"
+ ],
"meta": {
- "iframeHeight": "680px"
+ "iframeHeight": "800px"
}
}
]
diff --git a/src/app/(main)/blocks/page.tsx b/src/app/(main)/blocks/page.tsx
index 0dec96f..cc6f364 100644
--- a/src/app/(main)/blocks/page.tsx
+++ b/src/app/(main)/blocks/page.tsx
@@ -23,7 +23,7 @@ export default async function Page() {
return (
<>
- <PageHeader align="left" showBackground={false}>
+ <PageHeader align="left">
<PageHeaderHeading className="font-semibold md:text-5xl">
Map blocks for your application
</PageHeaderHeading>
diff --git a/src/app/(main)/docs/_components/docs.tsx b/src/app/(main)/docs/_components/docs.tsx
index d74161e..8583d30 100644
--- a/src/app/(main)/docs/_components/docs.tsx
+++ b/src/app/(main)/docs/_components/docs.tsx
@@ -63,7 +63,7 @@ export function DocsLayout({
}: DocsLayoutProps) {
return (
<div className="flex size-full">
- <div className="mx-auto flex max-w-[50rem] min-w-0 flex-1 flex-col px-4 pt-10 pb-20">
+ <div className="mx-auto flex max-w-[50rem] min-w-0 flex-1 flex-col pt-10 pb-20 lg:px-4">
<DocsTitle title={title} description={description} />
<div className="mt-12 mb-12 space-y-12">{children}</div>
{(prev || next) && (
diff --git a/src/components/footer.tsx b/src/components/footer.tsx
index ccf4612..7985076 100644
--- a/src/components/footer.tsx
+++ b/src/components/footer.tsx
@@ -33,7 +33,7 @@ const footerLinks = {
export function Footer({ className }: { className?: string }) {
return (
- <footer className={cn("mt-30 border-t", className)}>
+ <footer className={cn("bg-muted/30 mt-30 border-t", className)}>
<div className="container py-12 md:py-16">
<div className="grid grid-cols-2 gap-8 md:grid-cols-5">
<div className="col-span-2 md:col-span-2">
diff --git a/src/components/page-header.tsx b/src/components/page-header.tsx
index 2c40c22..e9cb66f 100644
--- a/src/components/page-header.tsx
+++ b/src/components/page-header.tsx
@@ -16,47 +16,24 @@ function usePageHeaderContext() {
interface PageHeaderProps {
children: React.ReactNode;
className?: string;
- /** Show the dot grid background (default: true) */
- showBackground?: boolean;
/** Header content alignment (default: center) */
align?: HeaderAlign;
}
-function PageHeader({
- children,
- className,
- showBackground = true,
- align = "center",
-}: PageHeaderProps) {
+function PageHeader({ children, className, align = "center" }: PageHeaderProps) {
return (
<PageHeaderContext.Provider value={{ align }}>
- <div className="relative">
- {showBackground && (
- <div className="pointer-events-none absolute inset-x-0 -inset-y-10 overflow-hidden">
- <div
- className="absolute inset-0 opacity-[0.16] dark:opacity-[0.12]"
- style={{
- backgroundImage: `radial-gradient(circle, currentColor 1px, transparent 1px)`,
- backgroundSize: "24px 24px",
- }}
- />
-
- <div className="from-background to-background absolute inset-0 bg-linear-to-b via-transparent" />
- </div>
+ <section
+ className={cn(
+ "container mx-auto flex w-full max-w-6xl flex-col gap-4 py-16 md:py-20 lg:py-24",
+ align === "center"
+ ? "items-center text-center"
+ : "items-start text-left",
+ className,
)}
-
- <section
- className={cn(
- "container mx-auto flex w-full max-w-6xl flex-col gap-4 py-16 md:py-20 lg:py-24",
- align === "center"
- ? "items-center text-center"
- : "items-start text-left",
- className,
- )}
- >
- {children}
- </section>
- </div>
+ >
+ {children}
+ </section>
</PageHeaderContext.Provider>
);
}
@@ -126,7 +103,6 @@ function PageHeaderDescription({
interface PageActionsProps {
children: React.ReactNode;
className?: string;
- stagger?: number;
}
function PageActions({ children, className }: PageActionsProps) {
diff --git a/src/registry/blocks/__index__.tsx b/src/registry/blocks/__index__.tsx
index 65707d5..10a587f 100644
--- a/src/registry/blocks/__index__.tsx
+++ b/src/registry/blocks/__index__.tsx
@@ -9,4 +9,6 @@ export const blockComponents: Record<
heatmap: React.lazy(() => import("./heatmap/page")),
"delivery-tracker": React.lazy(() => import("./delivery-tracker/page")),
"logistics-network": React.lazy(() => import("./logistics-network/page")),
+ "store-locator": React.lazy(() => import("./store-locator/page")),
+ choropleth: React.lazy(() => import("./choropleth/page")),
};
diff --git a/src/registry/blocks/analytics-map/components/breakdown-card.tsx b/src/registry/blocks/analytics-map/components/breakdown-card.tsx
index d9580b2..9c7eb85 100644
--- a/src/registry/blocks/analytics-map/components/breakdown-card.tsx
+++ b/src/registry/blocks/analytics-map/components/breakdown-card.tsx
@@ -13,7 +13,7 @@ export function BreakdownCard({ title, rows }: BreakdownCardProps) {
rows.length > 0 ? Math.max(...rows.map((row) => row.value)) : 0;
return (
- <Card>
+ <Card className="gap-2">
<CardHeader>
<CardTitle className="text-sm font-medium">{title}</CardTitle>
</CardHeader>
@@ -23,21 +23,28 @@ export function BreakdownCard({ title, rows }: BreakdownCardProps) {
<span>{title}</span>
<span>Visitors</span>
</div>
- <div className="space-y-3">
- {rows.map((row) => (
- <div key={row.label} className="space-y-1.5">
- <div className="flex items-center justify-between text-xs">
- <span className="text-foreground/90 truncate">{row.label}</span>
- <span className="text-foreground font-medium">{row.value}</span>
- </div>
- <div className="bg-muted h-1 rounded-full">
+ <div className="space-y-1.5">
+ {rows.map((row) => {
+ const pct = maxRowValue ? (row.value / maxRowValue) * 100 : 0;
+ return (
+ <div
+ key={row.label}
+ className="relative flex items-center justify-between overflow-hidden rounded-md px-2 py-1.5 text-xs"
+ >
<div
- className="h-full rounded-full bg-blue-500/85"
- style={{ width: `${(row.value / maxRowValue) * 100}%` }}
+ className="absolute inset-y-0 left-0 rounded-md bg-blue-500/20"
+ style={{ width: `${pct}%` }}
+ aria-hidden
/>
+ <span className="text-foreground/90 relative truncate pr-2">
+ {row.label}
+ </span>
+ <span className="text-foreground relative font-medium tabular-nums">
+ {row.value.toLocaleString()}
+ </span>
</div>
- </div>
- ))}
+ );
+ })}
</div>
</CardContent>
</Card>
diff --git a/src/registry/blocks/analytics-map/components/overview-card.tsx b/src/registry/blocks/analytics-map/components/overview-card.tsx
index b49919d..05d4722 100644
--- a/src/registry/blocks/analytics-map/components/overview-card.tsx
+++ b/src/registry/blocks/analytics-map/components/overview-card.tsx
@@ -15,9 +15,9 @@ function MetricChart() {
return (
<ChartContainer
config={usersPerDayChartConfig}
- className="aspect-auto h-8 w-full"
+ className="aspect-auto h-14 w-full"
>
- <AreaChart data={usersPerDay} margin={{ left: 4, right: 4, top: 4 }}>
+ <AreaChart data={usersPerDay}>
<defs>
<linearGradient id="usersGradient" x1="0" y1="0" x2="0" y2="1">
<stop
@@ -47,27 +47,27 @@ function MetricChart() {
export function OverviewCard() {
return (
- <Card className="bg-card/70 absolute top-4 left-4 z-10 w-60 backdrop-blur-sm">
+ <Card className="bg-card/80 absolute top-4 left-4 z-10 w-60 gap-1 backdrop-blur-sm">
<CardHeader>
<div>
<p className="text-muted-foreground pb-2 text-[10px] tracking-wider uppercase">
- Users in last 7 days
+ Users in last 30 days
</p>
- <p className="text-3xl leading-none font-semibold">3,803</p>
+ <p className="text-3xl leading-none font-semibold">17,234</p>
</div>
</CardHeader>
<CardContent>
<MetricChart />
- <div className="mt-4 flex items-center gap-1.5 text-xs">
+ <div className="mt-2 flex items-center gap-1.5 text-xs">
<TrendingUp className="size-3 text-emerald-500" />
<span className="font-medium text-emerald-500">+12.5%</span>
- <span className="text-muted-foreground">vs previous 7 days</span>
+ <span className="text-muted-foreground">vs previous 30 days</span>
</div>
<div className="border-border/60 mt-4 border-t pt-4">
<p className="text-muted-foreground text-[10px] tracking-wider uppercase">
- Device category in last 7 days
+ Device category in last 30 days
</p>
<ChartContainer
diff --git a/src/registry/blocks/analytics-map/data.ts b/src/registry/blocks/analytics-map/data.ts
index 801f909..22b471d 100644
--- a/src/registry/blocks/analytics-map/data.ts
+++ b/src/registry/blocks/analytics-map/data.ts
@@ -35,13 +35,36 @@ export const locations: LocationPoint[] = [
];
export const usersPerDay = [
- { day: "Mon", users: 320 },
- { day: "Tue", users: 410 },
- { day: "Wed", users: 560 },
- { day: "Thu", users: 640 },
- { day: "Fri", users: 780 },
- { day: "Sat", users: 690 },
- { day: "Sun", users: 720 },
+ { day: "1", users: 420 },
+ { day: "2", users: 468 },
+ { day: "3", users: 512 },
+ { day: "4", users: 390 },
+ { day: "5", users: 540 },
+ { day: "6", users: 305 },
+ { day: "7", users: 268 },
+ { day: "8", users: 498 },
+ { day: "9", users: 610 },
+ { day: "10", users: 472 },
+ { day: "11", users: 845 },
+ { day: "12", users: 690 },
+ { day: "13", users: 360 },
+ { day: "14", users: 322 },
+ { day: "15", users: 588 },
+ { day: "16", users: 654 },
+ { day: "17", users: 720 },
+ { day: "18", users: 505 },
+ { day: "19", users: 932 },
+ { day: "20", users: 410 },
+ { day: "21", users: 372 },
+ { day: "22", users: 640 },
+ { day: "23", users: 712 },
+ { day: "24", users: 598 },
+ { day: "25", users: 1040 },
+ { day: "26", users: 805 },
+ { day: "27", users: 445 },
+ { day: "28", users: 398 },
+ { day: "29", users: 702 },
+ { day: "30", users: 868 },
];
export const usersPerDayChartConfig = {
diff --git a/src/registry/blocks/analytics-map/page.tsx b/src/registry/blocks/analytics-map/page.tsx
index eb6ec7a..40a002f 100644
--- a/src/registry/blocks/analytics-map/page.tsx
+++ b/src/registry/blocks/analytics-map/page.tsx
@@ -32,7 +32,7 @@ export default function Page() {
scrollZoom={false}
renderWorldCopies={true}
>
- <MapControls showFullscreen />
+ <MapControls />
{locations.map((location) => (
<MapMarker
key={location.city}
diff --git a/src/registry/blocks/choropleth/data.ts b/src/registry/blocks/choropleth/data.ts
new file mode 100644
index 0000000..f1528c1
--- /dev/null
+++ b/src/registry/blocks/choropleth/data.ts
@@ -0,0 +1,63 @@
+export const COUNTRIES_GEOJSON_URL =
+ "https://cdn.jsdelivr.net/gh/martynafford/natural-earth-geojson/110m/cultural/ne_110m_admin_0_countries.json";
+
+/** Visitor counts keyed by the feature `NAME_LONG`. */
+export const visitorsByCountry: Record<string, number> = {
+ Germany: 15,
+ "United States": 14,
+ "United Kingdom": 12,
+ India: 9,
+ France: 9,
+ Australia: 8,
+ Netherlands: 8,
+ Spain: 7,
+ Italy: 6,
+ Sweden: 6,
+ Poland: 4,
+};
+
+export const MAX_VISITORS = 15;
+
+export type Theme = "light" | "dark";
+
+/** Resolved colors for the choropleth, per theme. */
+interface ChoroplethColors {
+ /** Map surface behind the countries (also used for country borders). */
+ background: string;
+ /** Fill for countries with no data (value 0). */
+ base: string;
+ /** Sequential fill ramp from low → high, mapped to `scaleStops`. */
+ ramp: [string, string, string, string];
+ /** Fill for the hovered country. */
+ hover: string;
+}
+
+/**
+ * Central map config — colors, the value→color scale, and the initial view.
+ * WebGL paint can't read CSS variables, so colors are concrete values per
+ * theme. The ramp is a single-hue blue scale tuned for contrast on each
+ * theme's basemap.
+ */
+export const mapConfig = {
+ view: {
+ center: [12, 28] as [number, number],
+ zoom: 1.4,
+ minZoom: 1,
+ maxZoom: 4,
+ },
+ scaleStops: [0, 1, 5, 10, MAX_VISITORS] as const,
+ colors: {
+ light: {
+ background: "#fafafa",
+ base: "#eef0f3",
+ ramp: ["#bfdbfe", "#60a5fa", "#3b82f6", "#1d4ed8"],
+ hover: "#1e3a8a",
+ },
+ dark: {
+ background: "#0a0a0a",
+ base: "#1a1a1a",
+ ramp: ["#1d4ed8", "#3b82f6", "#60a5fa", "#93c5fd"],
+ hover: "#bfdbfe",
+ },
+ } satisfies Record<Theme, ChoroplethColors>,
+};
diff --git a/src/registry/blocks/choropleth/page.tsx b/src/registry/blocks/choropleth/page.tsx
new file mode 100644
index 0000000..7cf0899
--- /dev/null
+++ b/src/registry/blocks/choropleth/page.tsx
@@ -0,0 +1,308 @@
+"use client";
+
+import { useEffect, useEffectEvent, useId, useRef, useState } from "react";
+import type { MapLayerMouseEvent, StyleSpecification } from "maplibre-gl";
+import { useTheme } from "next-themes";
+
+import { Map, MapControls, MapPopup, useMap } from "@/registry/map";
+import {
+ COUNTRIES_GEOJSON_URL,
+ mapConfig,
+ visitorsByCountry,
+ type Theme,
+} from "./data";
+
+// Transparent background so the themed container (`bg-background`) shows
+// through immediately on load, this avoids a white flash before the theme applies.
+const MAP_STYLE: StyleSpecification = {
+ version: 8,
+ sources: {},
+ layers: [
+ {
+ id: "background",
+ type: "background",
+ paint: { "background-color": "rgba(0, 0, 0, 0)" },
+ },
+ ],
+};
+
+const MAP_STYLES = { light: MAP_STYLE, dark: MAP_STYLE };
+
+function buildFillColor(theme: Theme): unknown[] {
+ const { base, ramp, hover } = mapConfig.colors[theme];
+ const [s0, s1, s2, s3, s4] = mapConfig.scaleStops;
+ return [
+ "case",
+ ["boolean", ["feature-state", "hover"], false],
+ hover,
+ [
+ "interpolate",
+ ["linear"],
+ ["coalesce", ["get", "visitors"], 0],
+ s0,
+ base,
+ s1,
+ ramp[0],
+ s2,
+ ramp[1],
+ s3,
+ ramp[2],
+ s4,
+ ramp[3],
+ ],
+ ];
+}
+
+interface HoverInfo {
+ name: string;
+ visitors: number;
+ lng: number;
+ lat: number;
+}
+
+interface CountryFeatureCollection extends GeoJSON.FeatureCollection {
+ features: Array<
+ GeoJSON.Feature<GeoJSON.Geometry, { NAME_LONG: string; visitors: number }>
+ >;
+}
+
+function ChoroplethLayer({
+ onHover,
+}: {
+ onHover: (info: HoverInfo | null) => void;
+}) {
+ const { map, isLoaded } = useMap();
+ const { resolvedTheme } = useTheme();
+ const theme: Theme = resolvedTheme === "dark" ? "dark" : "light";
+ const id = useId();
+ const sourceId = `countries-${id}`;
+ const fillLayerId = `countries-fill-${id}`;
+ const lineLayerId = `countries-line-${id}`;
+
+ const dataRef = useRef<CountryFeatureCollection | null>(null);
+ const getTheme = useEffectEvent(() => theme);
+
+ // Add the source + layers once.
+ useEffect(() => {
+ if (!map || !isLoaded) return;
+ let cancelled = false;
+
+ const setup = (data: CountryFeatureCollection) => {
+ const currentTheme = getTheme();
+ if (!map.getSource(sourceId)) {
+ map.addSource(sourceId, {
+ type: "geojson",
+ data,
+ promoteId: "NAME_LONG",
+ });
+ }
+ if (!map.getLayer(fillLayerId)) {
+ map.addLayer({
+ id: fillLayerId,
+ type: "fill",
+ source: sourceId,
+ paint: {
+ "fill-color": buildFillColor(currentTheme) as never,
+ "fill-opacity": 0.92,
+ },
+ });
+ }
+ if (!map.getLayer(lineLayerId)) {
+ map.addLayer({
+ id: lineLayerId,
+ type: "line",
+ source: sourceId,
+ paint: {
+ "line-color": mapConfig.colors[currentTheme].background,
+ "line-width": 0.5,
+ },
+ });
+ }
+ };
+
+ if (dataRef.current) {
+ setup(dataRef.current);
+ } else {
+ fetch(COUNTRIES_GEOJSON_URL)
+ .then((res) => res.json())
+ .then((geo: CountryFeatureCollection) => {
+ if (cancelled) return;
+ for (const feature of geo.features) {
+ const name = feature.properties.NAME_LONG;
+ feature.properties.visitors = visitorsByCountry[name] ?? 0;
+ }
+ dataRef.current = geo;
+ setup(geo);
+ })
+ .catch(() => {
+ // ignore network errors
+ });
+ }
+
+ return () => {
+ cancelled = true;
+ try {
+ if (map.getLayer(lineLayerId)) map.removeLayer(lineLayerId);
+ if (map.getLayer(fillLayerId)) map.removeLayer(fillLayerId);
+ if (map.getSource(sourceId)) map.removeSource(sourceId);
+ } catch {
+ // ignore
+ }
+ };
+ }, [map, isLoaded, sourceId, fillLayerId, lineLayerId]);
+
+ // Recolor in place whenever the resolved theme changes.
+ useEffect(() => {
+ if (!map) return;
+ if (map.getLayer(fillLayerId)) {
+ map.setPaintProperty(
+ fillLayerId,
+ "fill-color",
+ buildFillColor(theme) as never,
+ );
+ }
+ if (map.getLayer(lineLayerId)) {
+ map.setPaintProperty(
+ lineLayerId,
+ "line-color",
+ mapConfig.colors[theme].background,
+ );
+ }
+ }, [map, isLoaded, theme, fillLayerId, lineLayerId]);
+
+ // Hover interaction: highlight the country and surface the popup.
+ useEffect(() => {
+ if (!map || !isLoaded) return;
+ let hoveredId: string | null = null;
+
+ const clearHover = () => {
+ if (hoveredId != null && map.getSource(sourceId)) {
+ map.setFeatureState(
+ { source: sourceId, id: hoveredId },
+ { hover: false },
+ );
+ }
+ hoveredId = null;
+ };
+
+ const handleMove = (e: MapLayerMouseEvent) => {
+ const feature = e.features?.[0];
+ const visitors = (feature?.properties?.visitors as number) ?? 0;
+
+ // Only data countries are interactive.
+ if (!feature || visitors <= 0) {
+ clearHover();
+ map.getCanvas().style.cursor = "";
+ onHover(null);
+ return;
+ }
+
+ map.getCanvas().style.cursor = "pointer";
+
+ const featureId = feature.id as string;
+ if (featureId !== hoveredId) {
+ clearHover();
+ hoveredId = featureId;
+ map.setFeatureState(
+ { source: sourceId, id: featureId },
+ { hover: true },
+ );
+
+ onHover({
+ name: feature.properties?.NAME_LONG as string,
+ visitors,
+ lng: e.lngLat.lng,
+ lat: e.lngLat.lat,
+ });
+ }
+ };
+
+ const handleLeave = () => {
+ clearHover();
+ map.getCanvas().style.cursor = "";
+ onHover(null);
+ };
+
+ map.on("mousemove", fillLayerId, handleMove);
+ map.on("mouseleave", fillLayerId, handleLeave);
+
+ return () => {
+ map.off("mousemove", fillLayerId, handleMove);
+ map.off("mouseleave", fillLayerId, handleLeave);
+ clearHover();
+ };
+ }, [map, isLoaded, sourceId, fillLayerId, onHover]);
+
+ return null;
+}
+
+function Legend({ theme }: { theme: Theme }) {
+ const gradient = `linear-gradient(to right, ${mapConfig.colors[theme].ramp.join(", ")})`;
+
+ return (
+ <div className="bg-card/90 absolute bottom-4 left-4 z-10 rounded-lg border px-3 py-2.5 backdrop-blur-sm">
+ <p className="text-foreground text-xs font-medium">Visitors by country</p>
+ <div
+ className="mt-2 h-2 w-40 rounded-full"
+ style={{ backgroundImage: gradient }}
+ suppressHydrationWarning
+ />
+ <div className="text-muted-foreground flex items-center justify-between pt-1.5 text-[10px]">
+ <span>Low</span>
+ <span>High</span>
+ </div>
+ </div>
+ );
+}
+
+export default function Page() {
+ const { resolvedTheme } = useTheme();
+ const theme: Theme = resolvedTheme === "dark" ? "dark" : "light";
+ const [hover, setHover] = useState<HoverInfo | null>(null);
+
+ return (
+ <div className="bg-background relative h-screen overflow-hidden [&_.maplibregl-popup-content]:pointer-events-none">
+ <Map
+ className="bg-background"
+ styles={MAP_STYLES}
+ center={mapConfig.view.center}
+ zoom={mapConfig.view.zoom}
+ minZoom={mapConfig.view.minZoom}
+ maxZoom={mapConfig.view.maxZoom}
+ dragRotate={false}
+ pitchWithRotate={false}
+ attributionControl={false}
+ >
+ <ChoroplethLayer onHover={setHover} />
+ <MapControls />
+ {hover && (
+ <MapPopup
+ longitude={hover.lng}
+ latitude={hover.lat}
+ offset={12}
+ closeButton={false}
+ className="pointer-events-none p-2"
+ >
+ <p className="text-popover-foreground text-xs font-medium">
+ {hover.name}
+ </p>
+ <div className="flex items-center justify-between gap-4 pt-1">
+ <span className="text-muted-foreground flex items-center gap-1.5 text-[11px]">
+ <span
+ className="size-2 rounded-full"
+ style={{ backgroundColor: mapConfig.colors[theme].hover }}
+ />
+ Visitors
+ </span>
+ <span className="text-foreground text-xs font-semibold tabular-nums">
+ {hover.visitors.toLocaleString()}
+ </span>
+ </div>
+ </MapPopup>
+ )}
+ </Map>
+
+ <Legend theme={theme} />
+ </div>
+ );
+}
diff --git a/src/registry/blocks/store-locator/components/locator-map.tsx b/src/registry/blocks/store-locator/components/locator-map.tsx
new file mode 100644
index 0000000..423332d
--- /dev/null
+++ b/src/registry/blocks/store-locator/components/locator-map.tsx
@@ -0,0 +1,142 @@
+"use client";
+
+import { useEffect } from "react";
+import { Clock, MapPin, Phone } from "lucide-react";
+
+import {
+ Map,
+ MapControls,
+ MapMarker,
+ MapPopup,
+ MarkerContent,
+ MarkerTooltip,
+ useMap,
+} from "@/registry/map";
+import { SidebarTrigger } from "@/components/ui/sidebar";
+import { cn } from "@/lib/utils";
+import type { Store } from "../data";
+
+interface LocatorMapProps {
+ stores: Store[];
+ selectedId: string | null;
+ onSelect: (id: string) => void;
+ onClearSelection: () => void;
+ center: [number, number];
+}
+
+function FlyToSelected({ store }: { store?: Store }) {
+ const { map } = useMap();
+
+ useEffect(() => {
+ if (!map || !store) return;
+ map.flyTo({
+ center: [store.lng, store.lat],
+ zoom: 14,
+ duration: 800,
+ essential: true,
+ });
+ }, [map, store]);
+
+ return null;
+}
+
+function StorePin({ active }: { active: boolean }) {
+ return (
+ <div
+ className={cn(
+ "text-background flex items-center justify-center rounded-full shadow-md transition-all",
+ active
+ ? "bg-foreground/80 size-9 scale-110"
+ : "bg-foreground hover:bg-muted-foreground size-7",
+ )}
+ >
+ <MapPin className={cn(active ? "size-4.5" : "size-3.5")} />
+ </div>
+ );
+}
+
+export function LocatorMap({
+ stores,
+ selectedId,
+ onSelect,
+ onClearSelection,
+ center,
+}: LocatorMapProps) {
+ const selected = stores.find((store) => store.id === selectedId);
+
+ return (
+ <div className="relative h-full">
+ <SidebarTrigger className="bg-background absolute top-3 left-3 z-10 border shadow-sm md:hidden" />
+
+ <Map center={center} zoom={12} minZoom={10} maxZoom={17}>
+ <MapControls showFullscreen />
+ <FlyToSelected store={selected} />
+
+ {stores.map((store) => (
+ <MapMarker
+ key={store.id}
+ longitude={store.lng}
+ latitude={store.lat}
+ onClick={() => onSelect(store.id)}
+ >
+ <MarkerContent>
+ <StorePin active={store.id === selectedId} />
+ </MarkerContent>
+ <MarkerTooltip
+ offset={24}
+ className="bg-foreground text-background"
+ >
+ {store.name}
+ </MarkerTooltip>
+ </MapMarker>
+ ))}
+
+ {selected && (
+ <MapPopup
+ longitude={selected.lng}
+ latitude={selected.lat}
+ offset={26}
+ closeButton
+ closeOnClick={false}
+ onClose={onClearSelection}
+ className="min-w-56"
+ focusAfterOpen={false}
+ >
+ <p className="text-popover-foreground pr-5 font-medium">
+ {selected.name}
+ </p>
+ <span
+ className={cn(
+ "mt-1 flex items-center gap-1.5 text-xs font-medium",
+ selected.openNow ? "text-foreground" : "text-muted-foreground",
+ )}
+ >
+ <span
+ className={cn(
+ "size-1.5 rounded-full",
+ selected.openNow ? "bg-emerald-500" : "bg-neutral-500",
+ )}
+ />
+ {selected.openNow ? "Open now" : "Closed"}
+ </span>
+
+ <div className="text-muted-foreground mt-2.5 space-y-1.5 text-xs tabular-nums">
+ <p className="flex items-center gap-1.5">
+ <MapPin className="size-3.5 shrink-0" />
+ {selected.address}, {selected.neighborhood}
+ </p>
+ <p className="flex items-center gap-1.5">
+ <Clock className="size-3.5 shrink-0" />
+ {selected.hours}
+ </p>
+ <p className="flex items-center gap-1.5">
+ <Phone className="size-3.5 shrink-0" />
+ {selected.phone}
+ </p>
+ </div>
+ </MapPopup>
+ )}
+ </Map>
+ </div>
+ );
+}
diff --git a/src/registry/blocks/store-locator/components/store-list.tsx b/src/registry/blocks/store-locator/components/store-list.tsx
new file mode 100644
index 0000000..dfdb9be
--- /dev/null
+++ b/src/registry/blocks/store-locator/components/store-list.tsx
@@ -0,0 +1,145 @@
+"use client";
+
+import { useEffect, useRef } from "react";
+import { Clock, MapPin, Phone, Search } from "lucide-react";
+
+import {
+ Sidebar,
+ SidebarContent,
+ SidebarGroup,
+ SidebarHeader,
+ SidebarMenu,
+ SidebarMenuButton,
+ SidebarMenuItem,
+ SidebarSeparator,
+} from "@/components/ui/sidebar";
+import { Input } from "@/components/ui/input";
+import { cn } from "@/lib/utils";
+import type { Store } from "../data";
+
+interface StoreListProps {
+ stores: Store[];
+ query: string;
+ onQueryChange: (value: string) => void;
+ selectedId: string | null;
+ onSelect: (id: string) => void;
+}
+
+export function StoreList({
+ stores,
+ query,
+ onQueryChange,
+ selectedId,
+ onSelect,
+}: StoreListProps) {
+ const itemRefs = useRef(new Map<string, HTMLButtonElement>());
+
+ useEffect(() => {
+ if (!selectedId) return;
+ itemRefs.current
+ .get(selectedId)
+ ?.scrollIntoView({ block: "nearest", behavior: "smooth" });
+ }, [selectedId]);
+
+ return (
+ <Sidebar collapsible="offcanvas">
+ <SidebarHeader className="gap-3 p-4">
+ <div>
+ <h2 className="text-foreground text-lg font-semibold tracking-tight">
+ Find a store
+ </h2>
+ <p className="text-muted-foreground text-sm">
+ {stores.length} {stores.length === 1 ? "location" : "locations"}{" "}
+ near you
+ </p>
+ </div>
+ <div className="relative">
+ <Search className="text-muted-foreground absolute top-1/2 left-2.5 size-4 -translate-y-1/2" />
+ <Input
+ value={query}
+ onChange={(e) => onQueryChange(e.target.value)}
+ placeholder="Search name or address"
+ className="bg-background pl-8"
+ aria-label="Search stores"
+ />
+ </div>
+ </SidebarHeader>
+
+ <SidebarSeparator className="mx-0" />
+
+ <SidebarContent>
+ {stores.length === 0 ? (
+ <div className="text-muted-foreground p-6 text-center text-sm">
+ No stores match your search.
+ </div>
+ ) : (
+ <SidebarGroup className="p-2">
+ <SidebarMenu className="gap-1">
+ {stores.map((store) => {
+ const active = store.id === selectedId;
+ return (
+ <SidebarMenuItem key={store.id}>
+ <SidebarMenuButton
+ asChild
+ isActive={active}
+ className="h-auto flex-col items-stretch gap-0 p-3"
+ >
+ <button
+ type="button"
+ ref={(el) => {
+ if (el) itemRefs.current.set(store.id, el);
+ else itemRefs.current.delete(store.id);
+ }}
+ onClick={() => onSelect(store.id)}
+ aria-current={active}
+ >
+ <div className="flex items-center justify-between gap-2">
+ <span className="text-foreground font-medium">
+ {store.name}
+ </span>
+ <span
+ className={cn(
+ "flex items-center gap-1.5 text-xs font-medium",
+ store.openNow
+ ? "text-foreground"
+ : "text-muted-foreground",
+ )}
+ >
+ <span
+ className={cn(
+ "size-1.5 rounded-full",
+ store.openNow
+ ? "bg-emerald-500"
+ : "bg-neutral-500",
+ )}
+ />
+ {store.openNow ? "Open" : "Closed"}
+ </span>
+ </div>
+
+ <div className="text-muted-foreground mt-2 space-y-1.5 text-xs font-normal tabular-nums">
+ <p className="flex items-center gap-1.5">
+ <MapPin className="size-3.5 shrink-0" />
+ {store.address}, {store.neighborhood}
+ </p>
+ <p className="flex items-center gap-1.5">
+ <Clock className="size-3.5 shrink-0" />
+ {store.hours}
+ </p>
+ <p className="flex items-center gap-1.5">
+ <Phone className="size-3.5 shrink-0" />
+ {store.phone}
+ </p>
+ </div>
+ </button>
+ </SidebarMenuButton>
+ </SidebarMenuItem>
+ );
+ })}
+ </SidebarMenu>
+ </SidebarGroup>
+ )}
+ </SidebarContent>
+ </Sidebar>
+ );
+}
diff --git a/src/registry/blocks/store-locator/data.ts b/src/registry/blocks/store-locator/data.ts
new file mode 100644
index 0000000..4c51a40
--- /dev/null
+++ b/src/registry/blocks/store-locator/data.ts
@@ -0,0 +1,104 @@
+export interface Store {
+ id: string;
+ name: string;
+ address: string;
+ neighborhood: string;
+ phone: string;
+ hours: string;
+ openNow: boolean;
+ lat: number;
+ lng: number;
+}
+
+export const MAP_CENTER: [number, number] = [-122.4194, 37.7749];
+
+export const stores: Store[] = [
+ {
+ id: "ferry-building",
+ name: "Ferry Building",
+ address: "1 Ferry Building",
+ neighborhood: "Embarcadero",
+ phone: "(415) 555-0142",
+ hours: "7:00 AM – 8:00 PM",
+ openNow: true,
+ lat: 37.7955,
+ lng: -122.3933,
+ },
+ {
+ id: "union-square",
+ name: "Union Square",
+ address: "333 Post St",
+ neighborhood: "Downtown",
+ phone: "(415) 555-0188",
+ hours: "6:30 AM – 9:00 PM",
+ openNow: true,
+ lat: 37.788,
+ lng: -122.4075,
+ },
+ {
+ id: "north-beach",
+ name: "North Beach",
+ address: "601 Columbus Ave",
+ neighborhood: "North Beach",
+ phone: "(415) 555-0119",
+ hours: "7:00 AM – 7:00 PM",
+ openNow: true,
+ lat: 37.8003,
+ lng: -122.4097,
+ },
+ {
+ id: "hayes-valley",
+ name: "Hayes Valley",
+ address: "450 Hayes St",
+ neighborhood: "Hayes Valley",
+ phone: "(415) 555-0163",
+ hours: "7:30 AM – 6:00 PM",
+ openNow: false,
+ lat: 37.7765,
+ lng: -122.4256,
+ },
+ {
+ id: "mission",
+ name: "Mission District",
+ address: "2901 Mission St",
+ neighborhood: "Mission",
+ phone: "(415) 555-0177",
+ hours: "6:00 AM – 8:00 PM",
+ openNow: true,
+ lat: 37.7509,
+ lng: -122.4181,
+ },
+ {
+ id: "marina",
+ name: "Marina",
+ address: "2156 Chestnut St",
+ neighborhood: "Marina",
+ phone: "(415) 555-0125",
+ hours: "7:00 AM – 7:00 PM",
+ openNow: false,
+ lat: 37.8003,
+ lng: -122.4366,
+ },
+ {
+ id: "castro",
+ name: "Castro",
+ address: "489 Castro St",
+ neighborhood: "Castro",
+ phone: "(415) 555-0151",
+ hours: "7:00 AM – 8:00 PM",
+ openNow: true,
+ lat: 37.7609,
+ lng: -122.435,
+ },
+ {
+ id: "soma",
+ name: "SoMa",
+ address: "680 Folsom St",
+ neighborhood: "SoMa",
+ phone: "(415) 555-0134",
+ hours: "6:30 AM – 6:30 PM",
+ openNow: true,
+ lat: 37.7852,
+ lng: -122.3982,
+ },
+];
diff --git a/src/registry/blocks/store-locator/page.tsx b/src/registry/blocks/store-locator/page.tsx
new file mode 100644
index 0000000..f84992e
--- /dev/null
+++ b/src/registry/blocks/store-locator/page.tsx
@@ -0,0 +1,46 @@
+"use client";
+
+import { useMemo, useState, type CSSProperties } from "react";
+
+import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar";
+import { StoreList } from "./components/store-list";
+import { LocatorMap } from "./components/locator-map";
+import { MAP_CENTER, stores } from "./data";
+
+export default function Page() {
+ const [query, setQuery] = useState("");
+ const [selectedId, setSelectedId] = useState<string | null>(stores[0].id);
+
+ const filtered = useMemo(() => {
+ const q = query.trim().toLowerCase();
+ if (!q) return stores;
+ return stores.filter(
+ (store) =>
+ store.name.toLowerCase().includes(q) ||
+ store.address.toLowerCase().includes(q) ||
+ store.neighborhood.toLowerCase().includes(q),
+ );
+ }, [query]);
+
+ return (
+ <SidebarProvider style={{ "--sidebar-width": "20rem" } as CSSProperties}>
+ <StoreList
+ stores={filtered}
+ query={query}
+ onQueryChange={setQuery}
+ selectedId={selectedId}
+ onSelect={setSelectedId}
+ />
+
+ <SidebarInset>
+ <LocatorMap
+ stores={filtered}
+ selectedId={selectedId}
+ onSelect={setSelectedId}
+ onClearSelection={() => setSelectedId(null)}
+ center={MAP_CENTER}
+ />
+ </SidebarInset>
+ </SidebarProvider>
+ );
+}