fix(stats): hide zero-usage countries (#40400)
This commit is contained in:
committed by
GitHub
parent
eb998a9e3d
commit
5437d2cf1c
@@ -988,9 +988,10 @@ function GeoWorldMap(props: {
|
|||||||
const i18n = useI18n()
|
const i18n = useI18n()
|
||||||
const opacityScale = createMemo(() => scaleSqrt().domain([0, props.maxTokens]).range([0.26, 0.96]).clamp(true))
|
const opacityScale = createMemo(() => scaleSqrt().domain([0, props.maxTokens]).range([0.26, 0.96]).clamp(true))
|
||||||
const countryOpacity = (country: CountryEntry | undefined) => {
|
const countryOpacity = (country: CountryEntry | undefined) => {
|
||||||
if (!country) return 0
|
if (!country || country.tokens <= 0) return 0
|
||||||
const opacity = opacityScale()(country.tokens)
|
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)
|
return Math.max(0.18, opacity * 0.36)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2275,7 +2275,7 @@ body {
|
|||||||
|
|
||||||
[data-page="stats"] [data-slot="geo-countries"] path[data-active="true"] {
|
[data-page="stats"] [data-slot="geo-countries"] path[data-active="true"] {
|
||||||
fill: color-mix(in srgb, var(--stats-accent) 70%, var(--stats-text));
|
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 {
|
[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"] {
|
[data-page="stats"] [data-slot="geo-country-markers"] circle[data-active="true"] {
|
||||||
fill: color-mix(in srgb, var(--stats-accent) 70%, var(--stats-text));
|
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"] {
|
[data-page="stats"] [data-slot="geo-borders"] {
|
||||||
|
|||||||
@@ -1410,9 +1410,10 @@ function GeoWorldMap(props: {
|
|||||||
const i18n = useI18n()
|
const i18n = useI18n()
|
||||||
const opacityScale = createMemo(() => scaleSqrt().domain([0, props.maxTokens]).range([0.26, 0.96]).clamp(true))
|
const opacityScale = createMemo(() => scaleSqrt().domain([0, props.maxTokens]).range([0.26, 0.96]).clamp(true))
|
||||||
const countryOpacity = (country: CountryEntry | undefined) => {
|
const countryOpacity = (country: CountryEntry | undefined) => {
|
||||||
if (!country) return 0
|
if (!country || country.tokens <= 0) return 0
|
||||||
const opacity = opacityScale()(country.tokens)
|
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)
|
return Math.max(0.18, opacity * 0.36)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user