({value})
| 654 | } |
| 655 | |
| 656 | function StatNumber({value}) { |
| 657 | const [n, setN] = useState(0); |
| 658 | useEffect(() => { |
| 659 | if (value === null) return; |
| 660 | let raf; |
| 661 | const start = performance.now(); |
| 662 | const dur = 1200; |
| 663 | const tick = (t) => { |
| 664 | const p = Math.min((t - start) / dur, 1); |
| 665 | setN(Math.floor(p * value)); |
| 666 | if (p < 1) { |
| 667 | raf = requestAnimationFrame(tick); |
| 668 | } else { |
| 669 | setN(value); |
| 670 | } |
| 671 | }; |
| 672 | raf = requestAnimationFrame(tick); |
| 673 | return () => cancelAnimationFrame(raf); |
| 674 | }, [value]); |
| 675 | return value === null ? '—' : n.toLocaleString(); |
| 676 | } |
| 677 | |
| 678 | function StatsBlock() { |
| 679 | const dark = useTheme().palette.mode === 'dark'; |
nothing calls this directly
no outgoing calls
no test coverage detected