MCPcopy Create free account
hub / github.com/OpenSIST/OpenSIST.github.io / StatNumber

Function StatNumber

src/Components/Home/home.jsx:656–676  ·  view source on GitHub ↗
({value})

Source from the content-addressed store, hash-verified

654}
655
656function 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
678function StatsBlock() {
679 const dark = useTheme().palette.mode === 'dark';

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected