diff --git a/src/App.jsx b/src/App.jsx index d157cce..f778a59 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -2513,6 +2513,7 @@ function ViewersPage({ viewers }) { function LocationSignalMap({ countries, locations }) { const mapRef = useRef(null) const markersRef = useRef(null) + const countryMarkerColor = '#e82517' const maxMarkerVisitors = Math.max( 1, ...countries.map((country) => Number(country.visitors || 0)), @@ -2602,7 +2603,82 @@ function LocationSignalMap({ countries, locations }) { return minRadius + normalized * (maxRadius - minRadius) } - countryMarkers.forEach((country) => { + const mapMarkers = cityMarkers.length ? cityMarkers : countryMarkers + mapMarkers.forEach((location) => { + const isCityMarker = cityMarkers.length > 0 + const radius = isCityMarker + ? scaleMarkerRadius(location.visitors, 5, 14) + : scaleMarkerRadius(location.visitors, 8, 24) + const tooltipPlace = isCityMarker ? location.label : location.label + L.circleMarker([location.lat, location.lon], { + color: countryMarkerColor, + fillColor: countryMarkerColor, + fillOpacity: 0.4, + opacity: 0, + radius, + stroke: false, + }) + .bindTooltip(`${tooltipPlace}: ${formatNumber(location.visitors)} visitors`, { + direction: 'top', + opacity: 0.95, + }) + .addTo(layer) + }) + }, [cityMarkers, countryMarkerColor, countryMarkers, maxMarkerVisitors]) + + return ( +
{location.label}
+{location.detail}
+{formatNumber(location.visitors)}
++ No Cloudflare location signals have been shared yet. +
+ ) : null} +