fix(stats): hide zero-usage countries (#40400)

This commit is contained in:
opencode-agent[bot] 2026-08-04 06:26:48 -05:00 committed by GitHub
parent c387fe190b
commit 6c97a46dae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 6 deletions

View file

@ -988,9 +988,10 @@ function GeoWorldMap(props: {
const i18n = useI18n()
const opacityScale = createMemo(() => scaleSqrt().domain([0, props.maxTokens]).range([0.26, 0.96]).clamp(true))
const countryOpacity = (country: CountryEntry | undefined) => {
if (!country) return 0
if (!country || country.tokens <= 0) return 0
const opacity = opacityScale()(country.tokens)
if (!props.activeCountry || props.activeCountry === country.country) return opacity
if (props.activeCountry === country.country) return 1
if (!props.activeCountry) return opacity
return Math.max(0.18, opacity * 0.36)
}

View file

@ -2275,7 +2275,7 @@ body {
[data-page="stats"] [data-slot="geo-countries"] path[data-active="true"] {
fill: color-mix(in srgb, var(--stats-accent) 70%, var(--stats-text));
opacity: 1;
opacity: var(--geo-country-opacity);
}
[data-page="stats"] [data-slot="geo-country-markers"] circle {
@ -2292,7 +2292,7 @@ body {
[data-page="stats"] [data-slot="geo-country-markers"] circle[data-active="true"] {
fill: color-mix(in srgb, var(--stats-accent) 70%, var(--stats-text));
opacity: 1;
opacity: var(--geo-country-opacity);
}
[data-page="stats"] [data-slot="geo-borders"] {

View file

@ -1410,9 +1410,10 @@ function GeoWorldMap(props: {
const i18n = useI18n()
const opacityScale = createMemo(() => scaleSqrt().domain([0, props.maxTokens]).range([0.26, 0.96]).clamp(true))
const countryOpacity = (country: CountryEntry | undefined) => {
if (!country) return 0
if (!country || country.tokens <= 0) return 0
const opacity = opacityScale()(country.tokens)
if (!props.activeCountry || props.activeCountry === country.country) return opacity
if (props.activeCountry === country.country) return 1
if (!props.activeCountry) return opacity
return Math.max(0.18, opacity * 0.36)
}