Skip to content

armgit / mapcn

Public Imported from GitHub
0

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

TypeScript

feat: add uptime monitor block

anmolc9dbe654da50
diff --git a/public/r/registry.json b/public/r/registry.json
index 3c69801..87a22ac 100644
--- a/public/r/registry.json
+++ b/public/r/registry.json
@@ -157,27 +157,44 @@
}
},
{
- "name": "heatmap",
+ "name": "uptime-monitor",
"type": "registry:block",
- "title": "Heatmap",
- "description": "Globe-projected heatmap visualizing earthquake density with zoom-dependent styling.",
- "dependencies": [],
+ "title": "Uptime Monitor",
+ "description": "Status-page style map of edge network locations with live health, latency, and uptime.",
+ "dependencies": [
+ "maplibre-gl"
+ ],
"registryDependencies": [
"@mapcn/map"
],
"files": [
{
- "path": "src/registry/blocks/heatmap/page.tsx",
+ "path": "src/registry/blocks/uptime-monitor/page.tsx",
"type": "registry:page",
- "target": "app/heatmap/page.tsx"
+ "target": "app/uptime-monitor/page.tsx"
+ },
+ {
+ "path": "src/registry/blocks/uptime-monitor/data.ts",
+ "type": "registry:component",
+ "target": "app/uptime-monitor/data.ts"
+ },
+ {
+ "path": "src/registry/blocks/uptime-monitor/components/edge-node-marker.tsx",
+ "type": "registry:component",
+ "target": "app/uptime-monitor/components/edge-node-marker.tsx"
+ },
+ {
+ "path": "src/registry/blocks/uptime-monitor/components/status-sidebar.tsx",
+ "type": "registry:component",
+ "target": "app/uptime-monitor/components/status-sidebar.tsx"
}
],
"categories": [
- "visualization",
- "heatmap"
+ "monitoring",
+ "status"
],
"meta": {
- "iframeHeight": "800px"
+ "iframeHeight": "720px"
}
},
{
@@ -266,6 +283,30 @@
"iframeHeight": "800px"
}
},
+ {
+ "name": "heatmap",
+ "type": "registry:block",
+ "title": "Heatmap",
+ "description": "Globe-projected heatmap visualizing earthquake density with zoom-dependent styling.",
+ "dependencies": [],
+ "registryDependencies": [
+ "@mapcn/map"
+ ],
+ "files": [
+ {
+ "path": "src/registry/blocks/heatmap/page.tsx",
+ "type": "registry:page",
+ "target": "app/heatmap/page.tsx"
+ }
+ ],
+ "categories": [
+ "visualization",
+ "heatmap"
+ ],
+ "meta": {
+ "iframeHeight": "800px"
+ }
+ },
{
"name": "delivery-tracker",
"type": "registry:block",
diff --git a/public/r/uptime-monitor.json b/public/r/uptime-monitor.json
new file mode 100644
index 0000000..06ebece
--- /dev/null
+++ b/public/r/uptime-monitor.json
@@ -0,0 +1,46 @@
+{
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
+ "name": "uptime-monitor",
+ "title": "Uptime Monitor",
+ "description": "Status-page style map of edge network locations with live health, latency, and uptime.",
+ "dependencies": [
+ "maplibre-gl"
+ ],
+ "registryDependencies": [
+ "@mapcn/map"
+ ],
+ "files": [
+ {
+ "path": "src/registry/blocks/uptime-monitor/page.tsx",
+ "content": "\"use client\";\n\nimport { Map, MapControls, MapGeoJSON } from \"@/components/ui/map\";\nimport { EdgeNodeMarker } from \"./components/edge-node-marker\";\nimport { StatusSidebar } from \"./components/status-sidebar\";\nimport { edgeNodes, mapView, WORLD_GEOJSON } from \"./data\";\n\nexport default function Page() {\n return (\n <div className=\"flex min-h-screen items-center justify-center p-4\">\n <div className=\"bg-card flex h-[520px] w-full max-w-4xl overflow-hidden rounded-xl border shadow-sm\">\n <StatusSidebar nodes={edgeNodes} />\n\n <div className=\"relative min-w-0 flex-1\">\n <Map\n blank\n center={mapView.center}\n zoom={mapView.zoom}\n minZoom={mapView.minZoom}\n maxZoom={mapView.maxZoom}\n scrollZoom={false}\n dragRotate={false}\n pitchWithRotate={false}\n attributionControl={false}\n >\n <MapGeoJSON data={WORLD_GEOJSON} linePaint={false} />\n\n {edgeNodes.map((node) => (\n <EdgeNodeMarker key={node.id} node={node} />\n ))}\n\n <MapControls className=\"bottom-2\" />\n </Map>\n </div>\n </div>\n </div>\n );\n}\n",
+ "type": "registry:page",
+ "target": "app/uptime-monitor/page.tsx"
+ },
+ {
+ "path": "src/registry/blocks/uptime-monitor/data.ts",
+ "content": "export type EdgeStatus = \"operational\" | \"degraded\" | \"down\";\n\nexport interface EdgeNode {\n id: string;\n city: string;\n region: string;\n lng: number;\n lat: number;\n status: EdgeStatus;\n latency: number;\n uptime: number;\n}\n\nexport const statusMeta: Record<\n EdgeStatus,\n { dot: string; text: string }\n> = {\n operational: {\n dot: \"bg-emerald-500\",\n text: \"text-emerald-600 dark:text-emerald-400\",\n },\n degraded: {\n dot: \"bg-amber-500\",\n text: \"text-amber-600 dark:text-amber-400\",\n },\n down: {\n dot: \"bg-red-500\",\n text: \"text-red-600 dark:text-red-400\",\n },\n};\n\n/** Country borders served from a public CDN — swap in your own GeoJSON. */\nexport const WORLD_GEOJSON =\n \"https://cdn.jsdelivr.net/gh/nvkelso/[email protected]/geojson/ne_110m_admin_0_countries.geojson\";\n\nexport const mapView = {\n center: [5, 28] as [number, number],\n zoom: 0.5,\n minZoom: 0.5,\n maxZoom: 2,\n};\n\n/** Edge network points of presence. */\nexport const edgeNodes: EdgeNode[] = [\n {\n id: \"iad\",\n city: \"Washington, D.C.\",\n region: \"North America\",\n lng: -77.0369,\n lat: 38.9072,\n status: \"operational\",\n latency: 24,\n uptime: 99.99,\n },\n {\n id: \"sfo\",\n city: \"San Francisco\",\n region: \"North America\",\n lng: -122.4194,\n lat: 37.7749,\n status: \"operational\",\n latency: 31,\n uptime: 99.98,\n },\n {\n id: \"yyz\",\n city: \"Toronto\",\n region: \"North America\",\n lng: -79.3832,\n lat: 43.6532,\n status: \"degraded\",\n latency: 88,\n uptime: 99.21,\n },\n {\n id: \"gru\",\n city: \"São Paulo\",\n region: \"South America\",\n lng: -46.6333,\n lat: -23.5505,\n status: \"operational\",\n latency: 47,\n uptime: 99.95,\n },\n {\n id: \"lhr\",\n city: \"London\",\n region: \"Europe\",\n lng: -0.1276,\n lat: 51.5074,\n status: \"operational\",\n latency: 19,\n uptime: 99.99,\n },\n {\n id: \"fra\",\n city: \"Frankfurt\",\n region: \"Europe\",\n lng: 8.6821,\n lat: 50.1109,\n status: \"operational\",\n latency: 22,\n uptime: 99.97,\n },\n {\n id: \"cdg\",\n city: \"Paris\",\n region: \"Europe\",\n lng: 2.3522,\n lat: 48.8566,\n status: \"down\",\n latency: 0,\n uptime: 97.84,\n },\n {\n id: \"jnb\",\n city: \"Johannesburg\",\n region: \"Africa\",\n lng: 28.0473,\n lat: -26.2041,\n status: \"operational\",\n latency: 64,\n uptime: 99.92,\n },\n {\n id: \"bom\",\n city: \"Mumbai\",\n region: \"Asia Pacific\",\n lng: 72.8777,\n lat: 19.076,\n status: \"operational\",\n latency: 41,\n uptime: 99.96,\n },\n {\n id: \"sin\",\n city: \"Singapore\",\n region: \"Asia Pacific\",\n lng: 103.8198,\n lat: 1.3521,\n status: \"degraded\",\n latency: 73,\n uptime: 99.45,\n },\n {\n id: \"nrt\",\n city: \"Tokyo\",\n region: \"Asia Pacific\",\n lng: 139.6917,\n lat: 35.6895,\n status: \"operational\",\n latency: 28,\n uptime: 99.98,\n },\n {\n id: \"syd\",\n city: \"Sydney\",\n region: \"Asia Pacific\",\n lng: 151.2093,\n lat: -33.8688,\n status: \"operational\",\n latency: 52,\n uptime: 99.94,\n },\n {\n id: \"lax\",\n city: \"Los Angeles\",\n region: \"North America\",\n lng: -118.2437,\n lat: 34.0522,\n status: \"operational\",\n latency: 33,\n uptime: 99.97,\n },\n {\n id: \"ord\",\n city: \"Chicago\",\n region: \"North America\",\n lng: -87.6298,\n lat: 41.8781,\n status: \"operational\",\n latency: 27,\n uptime: 99.98,\n },\n {\n id: \"scl\",\n city: \"Santiago\",\n region: \"South America\",\n lng: -70.6693,\n lat: -33.4489,\n status: \"operational\",\n latency: 58,\n uptime: 99.91,\n },\n {\n id: \"ams\",\n city: \"Amsterdam\",\n region: \"Europe\",\n lng: 4.9041,\n lat: 52.3676,\n status: \"operational\",\n latency: 21,\n uptime: 99.98,\n },\n {\n id: \"mad\",\n city: \"Madrid\",\n region: \"Europe\",\n lng: -3.7038,\n lat: 40.4168,\n status: \"degraded\",\n latency: 79,\n uptime: 99.32,\n },\n {\n id: \"arn\",\n city: \"Stockholm\",\n region: \"Europe\",\n lng: 18.0686,\n lat: 59.3293,\n status: \"operational\",\n latency: 26,\n uptime: 99.96,\n },\n {\n id: \"dxb\",\n city: \"Dubai\",\n region: \"Middle East\",\n lng: 55.2708,\n lat: 25.2048,\n status: \"operational\",\n latency: 44,\n uptime: 99.95,\n },\n {\n id: \"hkg\",\n city: \"Hong Kong\",\n region: \"Asia Pacific\",\n lng: 114.1694,\n lat: 22.3193,\n status: \"operational\",\n latency: 36,\n uptime: 99.97,\n },\n {\n id: \"icn\",\n city: \"Seoul\",\n region: \"Asia Pacific\",\n lng: 126.978,\n lat: 37.5665,\n status: \"operational\",\n latency: 30,\n uptime: 99.98,\n },\n {\n id: \"los\",\n city: \"Lagos\",\n region: \"Africa\",\n lng: 3.3792,\n lat: 6.5244,\n status: \"down\",\n latency: 0,\n uptime: 98.12,\n },\n];\n\nexport interface NetworkSummary {\n status: EdgeStatus;\n label: string;\n operational: number;\n total: number;\n avgUptime: number;\n}\n\n/** Derive the overall network health from the individual edge nodes. */\nexport function getNetworkSummary(nodes: EdgeNode[]): NetworkSummary {\n const total = nodes.length;\n const operational = nodes.filter((n) => n.status === \"operational\").length;\n const hasDown = nodes.some((n) => n.status === \"down\");\n const hasDegraded = nodes.some((n) => n.status === \"degraded\");\n\n const status: EdgeStatus = hasDown\n ? \"down\"\n : hasDegraded\n ? \"degraded\"\n : \"operational\";\n\n const label = hasDown\n ? \"Partial outage\"\n : hasDegraded\n ? \"Degraded performance\"\n : \"All systems operational\";\n\n const avgUptime =\n nodes.reduce((sum, n) => sum + n.uptime, 0) / Math.max(total, 1);\n\n return { status, label, operational, total, avgUptime };\n}\n",
+ "type": "registry:component",
+ "target": "app/uptime-monitor/data.ts"
+ },
+ {
+ "path": "src/registry/blocks/uptime-monitor/components/edge-node-marker.tsx",
+ "content": "\"use client\";\n\nimport { cn } from \"@/lib/utils\";\nimport { MapMarker, MarkerContent, MarkerTooltip } from \"@/components/ui/map\";\nimport { statusMeta, type EdgeNode } from \"../data\";\n\ninterface EdgeNodeMarkerProps {\n node: EdgeNode;\n}\n\nexport function EdgeNodeMarker({ node }: EdgeNodeMarkerProps) {\n const meta = statusMeta[node.status];\n\n return (\n <MapMarker longitude={node.lng} latitude={node.lat}>\n <MarkerContent>\n <div className=\"group flex size-4 items-center justify-center\">\n <span\n className={cn(\n \"inline-flex size-2 rounded-full transition-transform group-hover:scale-125\",\n meta.dot,\n )}\n />\n </div>\n </MarkerContent>\n <MarkerTooltip offset={10} className=\"bg-popover min-w-28 border p-2\">\n <div className=\"flex items-center gap-1.5\">\n <span className={cn(\"size-1.5 rounded-full\", meta.dot)} />\n <span className=\"text-foreground text-[11px] font-medium\">\n {node.city}\n </span>\n <span className=\"text-muted-foreground ml-auto font-mono text-[10px] uppercase\">\n {node.id}\n </span>\n </div>\n <div className=\"text-muted-foreground mt-1.5 flex items-center justify-between gap-3 text-[10px]\">\n <span>{node.status === \"down\" ? \"—\" : `${node.latency} ms`}</span>\n <span className=\"tabular-nums\">{node.uptime.toFixed(2)}%</span>\n </div>\n </MarkerTooltip>\n </MapMarker>\n );\n}\n",
+ "type": "registry:component",
+ "target": "app/uptime-monitor/components/edge-node-marker.tsx"
+ },
+ {
+ "path": "src/registry/blocks/uptime-monitor/components/status-sidebar.tsx",
+ "content": "\"use client\";\n\nimport { cn } from \"@/lib/utils\";\nimport { getNetworkSummary, statusMeta, type EdgeNode } from \"../data\";\n\ninterface StatusSidebarProps {\n nodes: EdgeNode[];\n}\n\nexport function StatusSidebar({ nodes }: StatusSidebarProps) {\n const summary = getNetworkSummary(nodes);\n const summaryMeta = statusMeta[summary.status];\n\n return (\n <div className=\"bg-card flex w-56 shrink-0 flex-col overflow-hidden border-r\">\n <div className=\"border-b p-3\">\n <p className=\"text-foreground text-sm font-semibold\">Edge Network</p>\n\n <div className=\"mt-2 flex items-center gap-1.5\">\n <span className={cn(\"size-2 rounded-full\", summaryMeta.dot)} />\n <span className={cn(\"text-xs font-medium\", summaryMeta.text)}>\n {summary.label}\n </span>\n </div>\n\n <div className=\"mt-3 grid grid-cols-2 gap-2\">\n <div className=\"bg-background/60 rounded-md border p-2\">\n <p className=\"text-muted-foreground text-[10px] uppercase tracking-wide\">\n Uptime\n </p>\n <p className=\"text-foreground text-sm font-semibold tabular-nums\">\n {summary.avgUptime.toFixed(2)}%\n </p>\n </div>\n <div className=\"bg-background/60 rounded-md border p-2\">\n <p className=\"text-muted-foreground text-[10px] uppercase tracking-wide\">\n Edges up\n </p>\n <p className=\"text-foreground text-sm font-semibold tabular-nums\">\n {summary.operational}\n <span className=\"text-muted-foreground font-normal\">\n /{summary.total}\n </span>\n </p>\n </div>\n </div>\n </div>\n\n <ul className=\"flex-1 divide-y overflow-y-auto\">\n {nodes.map((node) => {\n const meta = statusMeta[node.status];\n\n return (\n <li key={node.id} className=\"flex items-center gap-2.5 px-3 py-2\">\n <span\n className={cn(\"size-2 shrink-0 rounded-full\", meta.dot)}\n />\n\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-foreground truncate text-xs font-medium\">\n {node.city}\n </p>\n <p className=\"text-muted-foreground truncate text-[10px]\">\n {node.region}\n </p>\n </div>\n\n <div className=\"flex shrink-0 flex-col items-end\">\n <span className=\"text-muted-foreground font-mono text-[10px] uppercase\">\n {node.id}\n </span>\n <span className=\"text-foreground font-mono text-[10px] tabular-nums\">\n {node.status === \"down\" ? \"—\" : `${node.latency}ms`}\n </span>\n </div>\n </li>\n );\n })}\n </ul>\n </div>\n );\n}\n",
+ "type": "registry:component",
+ "target": "app/uptime-monitor/components/status-sidebar.tsx"
+ }
+ ],
+ "meta": {
+ "iframeHeight": "720px"
+ },
+ "categories": [
+ "monitoring",
+ "status"
+ ],
+ "type": "registry:block"
+}
diff --git a/registry.json b/registry.json
index 3c69801..87a22ac 100644
--- a/registry.json
+++ b/registry.json
@@ -157,27 +157,44 @@
}
},
{
- "name": "heatmap",
+ "name": "uptime-monitor",
"type": "registry:block",
- "title": "Heatmap",
- "description": "Globe-projected heatmap visualizing earthquake density with zoom-dependent styling.",
- "dependencies": [],
+ "title": "Uptime Monitor",
+ "description": "Status-page style map of edge network locations with live health, latency, and uptime.",
+ "dependencies": [
+ "maplibre-gl"
+ ],
"registryDependencies": [
"@mapcn/map"
],
"files": [
{
- "path": "src/registry/blocks/heatmap/page.tsx",
+ "path": "src/registry/blocks/uptime-monitor/page.tsx",
"type": "registry:page",
- "target": "app/heatmap/page.tsx"
+ "target": "app/uptime-monitor/page.tsx"
+ },
+ {
+ "path": "src/registry/blocks/uptime-monitor/data.ts",
+ "type": "registry:component",
+ "target": "app/uptime-monitor/data.ts"
+ },
+ {
+ "path": "src/registry/blocks/uptime-monitor/components/edge-node-marker.tsx",
+ "type": "registry:component",
+ "target": "app/uptime-monitor/components/edge-node-marker.tsx"
+ },
+ {
+ "path": "src/registry/blocks/uptime-monitor/components/status-sidebar.tsx",
+ "type": "registry:component",
+ "target": "app/uptime-monitor/components/status-sidebar.tsx"
}
],
"categories": [
- "visualization",
- "heatmap"
+ "monitoring",
+ "status"
],
"meta": {
- "iframeHeight": "800px"
+ "iframeHeight": "720px"
}
},
{
@@ -266,6 +283,30 @@
"iframeHeight": "800px"
}
},
+ {
+ "name": "heatmap",
+ "type": "registry:block",
+ "title": "Heatmap",
+ "description": "Globe-projected heatmap visualizing earthquake density with zoom-dependent styling.",
+ "dependencies": [],
+ "registryDependencies": [
+ "@mapcn/map"
+ ],
+ "files": [
+ {
+ "path": "src/registry/blocks/heatmap/page.tsx",
+ "type": "registry:page",
+ "target": "app/heatmap/page.tsx"
+ }
+ ],
+ "categories": [
+ "visualization",
+ "heatmap"
+ ],
+ "meta": {
+ "iframeHeight": "800px"
+ }
+ },
{
"name": "delivery-tracker",
"type": "registry:block",
diff --git a/src/lib/llm-content.ts b/src/lib/llm-content.ts
index b979751..5bfa63f 100644
--- a/src/lib/llm-content.ts
+++ b/src/lib/llm-content.ts
@@ -61,6 +61,7 @@ function createBasemapMarkdown() {
- Use ${code("<Map>")} without ${code("blank")} for the default free CARTO basemap tiles. This is best for store locators, delivery tracking, logistics maps, address maps, and any UI where users need streets, place labels, or geographic context.
- Use ${code("<Map blank>")} for a transparent, tile-less canvas. Used alone it renders nothing; add your own layers such as ${code("MapGeoJSON")}, ${code("MapArc")}, markers, clusters, or custom MapLibre layers. This is best for choropleths, arc maps, dot maps, dashboards, and data visualizations where the data should define the geography.
+- If the user wants a blank map with only countries or country borders, use ${code("<Map blank>")} with ${code("<MapGeoJSON data={WORLD_GEOJSON} />")}. For world countries, a Natural Earth GeoJSON source works well: ${code("https://cdn.jsdelivr.net/gh/nvkelso/[email protected]/geojson/ne_110m_admin_0_countries.geojson")}. Users can also provide their own GeoJSON URL or GeoJSON object to ${code("MapGeoJSON")}.
- Use the ${code("styles")} prop for custom MapLibre-compatible style URLs or style objects, for example MapTiler, OpenFreeMap, CARTO, or a self-hosted style. Explicit ${code("styles")} override ${code("blank")}.
`;
}
diff --git a/src/lib/llm-prompts.ts b/src/lib/llm-prompts.ts
index 40e8189..e65f103 100644
--- a/src/lib/llm-prompts.ts
+++ b/src/lib/llm-prompts.ts
@@ -1,3 +1,3 @@
export const mapInstallCommand = "npx shadcn@latest add @mapcn/map";
-export const mapInstallAgentPrompt = `Read the mapcn agent instructions at https://mapcn.dev/llms.txt, then install mapcn in this project. Run ${mapInstallCommand}. Then add a basic example that imports Map and MapControls from "@/components/ui/map" and renders a map inside a sized container. Preserve the existing Tailwind CSS and shadcn/ui setup. Do not manually rewrite the registry component unless the command fails; if it fails, inspect https://mapcn.dev/r/map.json and install the listed dependencies.`;
+export const mapInstallAgentPrompt = `Read the mapcn agent instructions at https://mapcn.dev/llms.txt, then install mapcn in this project. Run ${mapInstallCommand}. Then add a basic example that imports Map and MapControls from "@/components/ui/map" and renders a map inside a sized container. Use the default tiled basemap for maps that need streets, labels, or geographic context. If the user wants a blank/data-only map, such as countries or country borders, use <Map blank> with MapGeoJSON and either a user-provided GeoJSON URL/object or a world countries GeoJSON source. Preserve the existing Tailwind CSS and shadcn/ui setup. Do not manually rewrite the registry component unless the command fails; if it fails, inspect https://mapcn.dev/r/map.json and install the listed dependencies.`;
diff --git a/src/registry/blocks/__index__.tsx b/src/registry/blocks/__index__.tsx
index 10a587f..07bf1f4 100644
--- a/src/registry/blocks/__index__.tsx
+++ b/src/registry/blocks/__index__.tsx
@@ -11,4 +11,5 @@ export const blockComponents: Record<
"logistics-network": React.lazy(() => import("./logistics-network/page")),
"store-locator": React.lazy(() => import("./store-locator/page")),
choropleth: React.lazy(() => import("./choropleth/page")),
+ "uptime-monitor": React.lazy(() => import("./uptime-monitor/page")),
};
diff --git a/src/registry/blocks/uptime-monitor/components/edge-node-marker.tsx b/src/registry/blocks/uptime-monitor/components/edge-node-marker.tsx
new file mode 100644
index 0000000..0a341a5
--- /dev/null
+++ b/src/registry/blocks/uptime-monitor/components/edge-node-marker.tsx
@@ -0,0 +1,43 @@
+"use client";
+
+import { cn } from "@/lib/utils";
+import { MapMarker, MarkerContent, MarkerTooltip } from "@/registry/map";
+import { statusMeta, type EdgeNode } from "../data";
+
+interface EdgeNodeMarkerProps {
+ node: EdgeNode;
+}
+
+export function EdgeNodeMarker({ node }: EdgeNodeMarkerProps) {
+ const meta = statusMeta[node.status];
+
+ return (
+ <MapMarker longitude={node.lng} latitude={node.lat}>
+ <MarkerContent>
+ <div className="group flex size-4 items-center justify-center">
+ <span
+ className={cn(
+ "inline-flex size-2 rounded-full transition-transform group-hover:scale-125",
+ meta.dot,
+ )}
+ />
+ </div>
+ </MarkerContent>
+ <MarkerTooltip offset={10} className="bg-popover min-w-28 border p-2">
+ <div className="flex items-center gap-1.5">
+ <span className={cn("size-1.5 rounded-full", meta.dot)} />
+ <span className="text-foreground text-[11px] font-medium">
+ {node.city}
+ </span>
+ <span className="text-muted-foreground ml-auto font-mono text-[10px] uppercase">
+ {node.id}
+ </span>
+ </div>
+ <div className="text-muted-foreground mt-1.5 flex items-center justify-between gap-3 text-[10px]">
+ <span>{node.status === "down" ? "—" : `${node.latency} ms`}</span>
+ <span className="tabular-nums">{node.uptime.toFixed(2)}%</span>
+ </div>
+ </MarkerTooltip>
+ </MapMarker>
+ );
+}
diff --git a/src/registry/blocks/uptime-monitor/components/status-sidebar.tsx b/src/registry/blocks/uptime-monitor/components/status-sidebar.tsx
new file mode 100644
index 0000000..307d45b
--- /dev/null
+++ b/src/registry/blocks/uptime-monitor/components/status-sidebar.tsx
@@ -0,0 +1,82 @@
+"use client";
+
+import { cn } from "@/lib/utils";
+import { getNetworkSummary, statusMeta, type EdgeNode } from "../data";
+
+interface StatusSidebarProps {
+ nodes: EdgeNode[];
+}
+
+export function StatusSidebar({ nodes }: StatusSidebarProps) {
+ const summary = getNetworkSummary(nodes);
+ const summaryMeta = statusMeta[summary.status];
+
+ return (
+ <div className="bg-card flex w-56 shrink-0 flex-col overflow-hidden border-r">
+ <div className="border-b p-3">
+ <p className="text-foreground text-sm font-semibold">Edge Network</p>
+
+ <div className="mt-2 flex items-center gap-1.5">
+ <span className={cn("size-2 rounded-full", summaryMeta.dot)} />
+ <span className={cn("text-xs font-medium", summaryMeta.text)}>
+ {summary.label}
+ </span>
+ </div>
+
+ <div className="mt-3 grid grid-cols-2 gap-2">
+ <div className="bg-background/60 rounded-md border p-2">
+ <p className="text-muted-foreground text-[10px] uppercase tracking-wide">
+ Uptime
+ </p>
+ <p className="text-foreground text-sm font-semibold tabular-nums">
+ {summary.avgUptime.toFixed(2)}%
+ </p>
+ </div>
+ <div className="bg-background/60 rounded-md border p-2">
+ <p className="text-muted-foreground text-[10px] uppercase tracking-wide">
+ Edges up
+ </p>
+ <p className="text-foreground text-sm font-semibold tabular-nums">
+ {summary.operational}
+ <span className="text-muted-foreground font-normal">
+ /{summary.total}
+ </span>
+ </p>
+ </div>
+ </div>
+ </div>
+
+ <ul className="flex-1 divide-y overflow-y-auto">
+ {nodes.map((node) => {
+ const meta = statusMeta[node.status];
+
+ return (
+ <li key={node.id} className="flex items-center gap-2.5 px-3 py-2">
+ <span
+ className={cn("size-2 shrink-0 rounded-full", meta.dot)}
+ />
+
+ <div className="min-w-0 flex-1">
+ <p className="text-foreground truncate text-xs font-medium">
+ {node.city}
+ </p>
+ <p className="text-muted-foreground truncate text-[10px]">
+ {node.region}
+ </p>
+ </div>
+
+ <div className="flex shrink-0 flex-col items-end">
+ <span className="text-muted-foreground font-mono text-[10px] uppercase">
+ {node.id}
+ </span>
+ <span className="text-foreground font-mono text-[10px] tabular-nums">
+ {node.status === "down" ? "—" : `${node.latency}ms`}
+ </span>
+ </div>
+ </li>
+ );
+ })}
+ </ul>
+ </div>
+ );
+}
diff --git a/src/registry/blocks/uptime-monitor/data.ts b/src/registry/blocks/uptime-monitor/data.ts
new file mode 100644
index 0000000..1777f25
--- /dev/null
+++ b/src/registry/blocks/uptime-monitor/data.ts
@@ -0,0 +1,298 @@
+export type EdgeStatus = "operational" | "degraded" | "down";
+
+export interface EdgeNode {
+ id: string;
+ city: string;
+ region: string;
+ lng: number;
+ lat: number;
+ status: EdgeStatus;
+ latency: number;
+ uptime: number;
+}
+
+export const statusMeta: Record<
+ EdgeStatus,
+ { dot: string; text: string }
+> = {
+ operational: {
+ dot: "bg-emerald-500",
+ text: "text-emerald-600 dark:text-emerald-400",
+ },
+ degraded: {
+ dot: "bg-amber-500",
+ text: "text-amber-600 dark:text-amber-400",
+ },
+ down: {
+ dot: "bg-red-500",
+ text: "text-red-600 dark:text-red-400",
+ },
+};
+
+/** Country borders served from a public CDN — swap in your own GeoJSON. */
+export const WORLD_GEOJSON =
+ "https://cdn.jsdelivr.net/gh/nvkelso/[email protected]/geojson/ne_110m_admin_0_countries.geojson";
+
+export const mapView = {
+ center: [5, 28] as [number, number],
+ zoom: 0.5,
+ minZoom: 0.5,
+ maxZoom: 2,
+};
+
+/** Edge network points of presence. */
+export const edgeNodes: EdgeNode[] = [
+ {
+ id: "iad",
+ city: "Washington, D.C.",
+ region: "North America",
+ lng: -77.0369,
+ lat: 38.9072,
+ status: "operational",
+ latency: 24,
+ uptime: 99.99,
+ },
+ {
+ id: "sfo",
+ city: "San Francisco",
+ region: "North America",
+ lng: -122.4194,
+ lat: 37.7749,
+ status: "operational",
+ latency: 31,
+ uptime: 99.98,
+ },
+ {
+ id: "yyz",
+ city: "Toronto",
+ region: "North America",
+ lng: -79.3832,
+ lat: 43.6532,
+ status: "degraded",
+ latency: 88,
+ uptime: 99.21,
+ },
+ {
+ id: "gru",
+ city: "São Paulo",
+ region: "South America",
+ lng: -46.6333,
+ lat: -23.5505,
+ status: "operational",
+ latency: 47,
+ uptime: 99.95,
+ },
+ {
+ id: "lhr",
+ city: "London",
+ region: "Europe",
+ lng: -0.1276,
+ lat: 51.5074,
+ status: "operational",
+ latency: 19,
+ uptime: 99.99,
+ },
+ {
+ id: "fra",
+ city: "Frankfurt",
+ region: "Europe",
+ lng: 8.6821,
+ lat: 50.1109,
+ status: "operational",
+ latency: 22,
+ uptime: 99.97,
+ },
+ {
+ id: "cdg",
+ city: "Paris",
+ region: "Europe",
+ lng: 2.3522,
+ lat: 48.8566,
+ status: "down",
+ latency: 0,
+ uptime: 97.84,
+ },
+ {
+ id: "jnb",
+ city: "Johannesburg",
+ region: "Africa",
+ lng: 28.0473,
+ lat: -26.2041,
+ status: "operational",
+ latency: 64,
+ uptime: 99.92,
+ },
+ {
+ id: "bom",
+ city: "Mumbai",
+ region: "Asia Pacific",
+ lng: 72.8777,
+ lat: 19.076,
+ status: "operational",
+ latency: 41,
+ uptime: 99.96,
+ },
+ {
+ id: "sin",
+ city: "Singapore",
+ region: "Asia Pacific",
+ lng: 103.8198,
+ lat: 1.3521,
+ status: "degraded",
+ latency: 73,
+ uptime: 99.45,
+ },
+ {
+ id: "nrt",
+ city: "Tokyo",
+ region: "Asia Pacific",
+ lng: 139.6917,
+ lat: 35.6895,
+ status: "operational",
+ latency: 28,
+ uptime: 99.98,
+ },
+ {
+ id: "syd",
+ city: "Sydney",
+ region: "Asia Pacific",
+ lng: 151.2093,
+ lat: -33.8688,
+ status: "operational",
+ latency: 52,
+ uptime: 99.94,
+ },
+ {
+ id: "lax",
+ city: "Los Angeles",
+ region: "North America",
+ lng: -118.2437,
+ lat: 34.0522,
+ status: "operational",
+ latency: 33,
+ uptime: 99.97,
+ },
+ {
+ id: "ord",
+ city: "Chicago",
+ region: "North America",
+ lng: -87.6298,
+ lat: 41.8781,
+ status: "operational",
+ latency: 27,
+ uptime: 99.98,
+ },
+ {
+ id: "scl",
+ city: "Santiago",
+ region: "South America",
+ lng: -70.6693,
+ lat: -33.4489,
+ status: "operational",
+ latency: 58,
+ uptime: 99.91,
+ },
+ {
+ id: "ams",
+ city: "Amsterdam",
+ region: "Europe",
+ lng: 4.9041,
+ lat: 52.3676,
+ status: "operational",
+ latency: 21,
+ uptime: 99.98,
+ },
+ {
+ id: "mad",
+ city: "Madrid",
+ region: "Europe",
+ lng: -3.7038,
+ lat: 40.4168,
+ status: "degraded",
+ latency: 79,
+ uptime: 99.32,
+ },
+ {
+ id: "arn",
+ city: "Stockholm",
+ region: "Europe",
+ lng: 18.0686,
+ lat: 59.3293,
+ status: "operational",
+ latency: 26,
+ uptime: 99.96,
+ },
+ {
+ id: "dxb",
+ city: "Dubai",
+ region: "Middle East",
+ lng: 55.2708,
+ lat: 25.2048,
+ status: "operational",
+ latency: 44,
+ uptime: 99.95,
+ },
+ {
+ id: "hkg",
+ city: "Hong Kong",
+ region: "Asia Pacific",
+ lng: 114.1694,
+ lat: 22.3193,
+ status: "operational",
+ latency: 36,
+ uptime: 99.97,
+ },
+ {
+ id: "icn",
+ city: "Seoul",
+ region: "Asia Pacific",
+ lng: 126.978,
+ lat: 37.5665,
+ status: "operational",
+ latency: 30,
+ uptime: 99.98,
+ },
+ {
+ id: "los",
+ city: "Lagos",
+ region: "Africa",
+ lng: 3.3792,
+ lat: 6.5244,
+ status: "down",
+ latency: 0,
+ uptime: 98.12,
+ },
+];
+
+export interface NetworkSummary {
+ status: EdgeStatus;
+ label: string;
+ operational: number;
+ total: number;
+ avgUptime: number;
+}
+
+/** Derive the overall network health from the individual edge nodes. */
+export function getNetworkSummary(nodes: EdgeNode[]): NetworkSummary {
+ const total = nodes.length;
+ const operational = nodes.filter((n) => n.status === "operational").length;
+ const hasDown = nodes.some((n) => n.status === "down");
+ const hasDegraded = nodes.some((n) => n.status === "degraded");
+
+ const status: EdgeStatus = hasDown
+ ? "down"
+ : hasDegraded
+ ? "degraded"
+ : "operational";
+
+ const label = hasDown
+ ? "Partial outage"
+ : hasDegraded
+ ? "Degraded performance"
+ : "All systems operational";
+
+ const avgUptime =
+ nodes.reduce((sum, n) => sum + n.uptime, 0) / Math.max(total, 1);
+
+ return { status, label, operational, total, avgUptime };
+}
diff --git a/src/registry/blocks/uptime-monitor/page.tsx b/src/registry/blocks/uptime-monitor/page.tsx
new file mode 100644
index 0000000..1a3e009
--- /dev/null
+++ b/src/registry/blocks/uptime-monitor/page.tsx
@@ -0,0 +1,38 @@
+"use client";
+
+import { Map, MapControls, MapGeoJSON } from "@/registry/map";
+import { EdgeNodeMarker } from "./components/edge-node-marker";
+import { StatusSidebar } from "./components/status-sidebar";
+import { edgeNodes, mapView, WORLD_GEOJSON } from "./data";
+
+export default function Page() {
+ return (
+ <div className="flex min-h-screen items-center justify-center p-4">
+ <div className="bg-card flex h-[520px] w-full max-w-4xl overflow-hidden rounded-xl border shadow-sm">
+ <StatusSidebar nodes={edgeNodes} />
+
+ <div className="relative min-w-0 flex-1">
+ <Map
+ blank
+ center={mapView.center}
+ zoom={mapView.zoom}
+ minZoom={mapView.minZoom}
+ maxZoom={mapView.maxZoom}
+ scrollZoom={false}
+ dragRotate={false}
+ pitchWithRotate={false}
+ attributionControl={false}
+ >
+ <MapGeoJSON data={WORLD_GEOJSON} linePaint={false} />
+
+ {edgeNodes.map((node) => (
+ <EdgeNodeMarker key={node.id} node={node} />
+ ))}
+
+ <MapControls className="bottom-2" />
+ </Map>
+ </div>
+ </div>
+ </div>
+ );
+}