import {useEffect, useState} from 'react'; import {Link} from 'react-router-dom'; import {useTranslation} from 'react-i18next'; import {ArrowRight, Gamepad2} from 'lucide-react'; import {Card} from '@/components/ui/card'; const DURATION_MS = 1000; const SteamGameCount = ({targetCount}) => { const {t} = useTranslation(); const [count, setCount] = useState(0); useEffect(() => { let frame; let startTime; const animate = (timestamp) => { startTime ??= timestamp; const progress = Math.min((timestamp - startTime) / DURATION_MS, 1); setCount(Math.floor(progress * targetCount)); if (progress < 1) { frame = requestAnimationFrame(animate); } }; frame = requestAnimationFrame(animate); return () => cancelAnimationFrame(frame); }, [targetCount]); return (
{count}
{t('DASHBOARD.STEAM_GAMES')}
{t('DASHBOARD.TO_LIBRARY')} ); }; export default SteamGameCount;