"use client"; import { ComposableMap, Geographies, Geography, } from "react-simple-maps"; const geoUrl = "https://cdn.jsdelivr.net/npm/world-atlas@2/countries-110m.json"; export default function GeographicOverview({ data, }: { data: { country: string; scans: number }[]; }) { const lookup = Object.fromEntries( data.map((x) => [x.country.toLowerCase(), x.scans]) ); const max = Math.max(...data.map((d) => d.scans), 1); function getColor(country: string) { const scans = lookup[country.toLowerCase()] || 0; if (scans === 0) return "#eceff5"; const ratio = scans / max; if (ratio > 0.7) return "#4338ca"; if (ratio > 0.4) return "#6366f1"; if (ratio > 0.2) return "#8b5cf6"; return "#c4b5fd"; } return (
{({ geographies }) => geographies.map((geo) => ( )) }
{data.slice(0, 6).map((c) => ( ))}
Country Scans
{c.country} {c.scans.toLocaleString()}
{data.length > 6 && (
+{data.length - 6} more countries
)}
); }