Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 68x 1224x 118x 28x 1224x 1224x 68x | interface TokenDisplayProps {
value: number
label?: string
}
function abbreviate(n: number): string {
if (n < 1000) return String(n)
if (n < 1_000_000) return `${(n / 1000).toFixed(n % 1000 === 0 ? 0 : 1)}K`
return `${(n / 1_000_000).toFixed(n % 1_000_000 === 0 ? 0 : 1)}M`
}
export function TokenDisplay({ value, label }: TokenDisplayProps) {
const text = abbreviate(value)
return <span>{label ? `${label}: ${text}` : text}</span>
}
|