({
stats,
compact = false,
isLoading = false,
}: {
stats: FreebuffLiveStats
compact?: boolean
isLoading?: boolean
})
| 153 | } |
| 154 | |
| 155 | function WorldMap({ |
| 156 | stats, |
| 157 | compact = false, |
| 158 | isLoading = false, |
| 159 | }: { |
| 160 | stats: FreebuffLiveStats |
| 161 | compact?: boolean |
| 162 | isLoading?: boolean |
| 163 | }) { |
| 164 | const maxCount = Math.max(1, ...stats.countries.map((row) => row.count)) |
| 165 | const plottedCountries = stats.countries |
| 166 | .map((country) => { |
| 167 | const point = COUNTRY_POINT_LOOKUP[country.countryCode] |
| 168 | return point ? { ...country, point } : null |
| 169 | }) |
| 170 | .filter(isPlottedCountry) |
| 171 | const unplottedCount = stats.countries.length - plottedCountries.length |
| 172 | |
| 173 | return ( |
| 174 | <section className="relative self-start overflow-hidden rounded-lg border border-white/10 bg-[#020807] shadow-[0_24px_90px_rgba(0,0,0,0.34),inset_0_1px_0_rgba(255,255,255,0.05)]"> |
| 175 | <div className="pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_50%_28%,rgba(34,211,238,0.14),transparent_38%),linear-gradient(180deg,rgba(124,255,63,0.04),rgba(0,0,0,0.2))]" /> |
| 176 | {!compact && ( |
| 177 | <div className="pointer-events-none absolute left-4 top-4 z-10 rounded-md border border-white/10 bg-black/45 px-3 py-2 backdrop-blur md:left-5 md:top-5"> |
| 178 | <div className="font-mono text-[10px] uppercase tracking-[0.22em] text-white/45"> |
| 179 | Active countries |
| 180 | </div> |
| 181 | <div className="mt-1 text-2xl font-serif leading-none text-white"> |
| 182 | {stats.countries.length.toLocaleString()} |
| 183 | </div> |
| 184 | </div> |
| 185 | )} |
| 186 | |
| 187 | <svg |
| 188 | viewBox={`0 0 ${MAP_SIZE.width} ${MAP_SIZE.height}`} |
| 189 | role="img" |
| 190 | aria-label="World map of live Freebuff users by country" |
| 191 | className={cn( |
| 192 | 'relative w-full', |
| 193 | compact ? 'h-[230px] md:h-[380px]' : 'h-[300px] md:h-[520px]', |
| 194 | )} |
| 195 | > |
| 196 | <defs> |
| 197 | <pattern |
| 198 | id="live-map-grid" |
| 199 | width="48" |
| 200 | height="48" |
| 201 | patternUnits="userSpaceOnUse" |
| 202 | > |
| 203 | <path |
| 204 | d="M48 0H0V48" |
| 205 | fill="none" |
| 206 | stroke="rgba(124,255,63,0.055)" |
| 207 | strokeWidth="1" |
| 208 | /> |
| 209 | </pattern> |
| 210 | <linearGradient id="live-ocean" x1="0" x2="1" y1="0" y2="1"> |
| 211 | <stop offset="0%" stopColor="#03100d" /> |
| 212 | <stop offset="46%" stopColor="#041918" /> |
nothing calls this directly
no test coverage detected