mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-22 13:33:29 +00:00
fix(stats): hide zero-usage countries (#40400)
This commit is contained in:
parent
c387fe190b
commit
6c97a46dae
3 changed files with 8 additions and 6 deletions
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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"] {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue