fix(stats): format market share tokens

This commit is contained in:
Adam
2026-06-22 07:46:11 -05:00
parent 7b750a8f20
commit 36264ccf90
2 changed files with 6 additions and 5 deletions
+4 -3
View File
@@ -1450,9 +1450,7 @@ function formatCountryName(country: string) {
}
function formatGeoTokens(value: number) {
if (value >= 1) return formatTrillions(value)
if (value >= 0.001) return `${Number((value * 1000).toFixed(value >= 0.01 ? 0 : 1))}B`
return `${Math.round(value * 1_000_000)}M`
return formatTrillions(value)
}
function formatGeoShare(value: number) {
@@ -1508,6 +1506,9 @@ function formatMarketMobileDate(label: string) {
}
function formatTrillions(value: number) {
if (value === 0) return "0"
if (value < 0.001) return `${Number((value * 1_000_000).toFixed(value >= 0.00001 ? 0 : 1))}M`
if (value < 1) return `${Number((value * 1_000).toFixed(value >= 0.01 ? 0 : 1))}B`
return `${value.toFixed(value >= 10 ? 0 : 1)}T`
}