import { useMemo, useState } from 'react'; import china from '@svg-maps/china'; import { cn } from '@/lib/utils'; import { buildChinaRegionCountMap, heatFill, emptyFill } from './monitorMapUtils'; type Loc = { id: string; name: string; path: string }; type RegionStat = { country: string; region?: string; region_iso?: string; count: number; }; type Props = { regions: RegionStat[]; className?: string; }; /** 中国省区地图:按 BIN 解析出的省/区填色 */ export default function MonitorChinaMap({ regions, className }: Props) { const [hover, setHover] = useState<{ name: string; count: number } | null>(null); const counts = useMemo(() => buildChinaRegionCountMap(regions), [regions]); const max = useMemo(() => Math.max(0, ...Object.values(counts)), [counts]); const hasData = max > 0; const locations = (china as { locations: Loc[]; viewBox: string }).locations; const viewBox = (china as { viewBox: string }).viewBox; return (
暂无省级访问数据
放置 IP2LOCATION-LITE-DB3.BIN 后按省/区填色