feat(ui): show GitHub stars

This commit is contained in:
Shantur Rathore
2026-01-25 00:21:06 +00:00
parent 8fa0175b98
commit bb4e3815d1
4 changed files with 93 additions and 1 deletions

View File

@@ -10,3 +10,20 @@ export function formatTokenTotal(value: number): string {
}
return value.toLocaleString()
}
export function formatCompactCount(value: number): string {
if (value >= 1_000_000_000) {
return `${(value / 1_000_000_000).toFixed(1)}B`
}
if (value >= 1_000_000) {
return `${(value / 1_000_000).toFixed(1)}M`
}
if (value >= 10_000) {
return `${Math.round(value / 1_000)}K`
}
if (value >= 1_000) {
const label = `${(value / 1_000).toFixed(1)}K`
return label.replace(/\.0K$/, "K")
}
return value.toLocaleString()
}