'use client'; import { motion, useReducedMotion, useMotionValue, useSpring, useTransform } from 'framer-motion'; import { useEffect, useState } from 'react'; import { Box } from '@/ui/Box'; import { Text } from '@/ui/Text'; import { Stack } from '@/ui/Stack'; export function DriverProfileMockup() { const shouldReduceMotion = useReducedMotion(); const [isMobile, setIsMobile] = useState(false); useEffect(() => { const checkMobile = () => setIsMobile(window.innerWidth < 768); checkMobile(); window.addEventListener('resize', checkMobile); return () => window.removeEventListener('resize', checkMobile); }, []); const stats = [ { label: 'Wins', value: 24 }, { label: 'Podiums', value: 48 }, { label: 'Championships', value: 3 }, { label: 'Races', value: 156 }, { label: 'Finish Rate', value: 94, suffix: '%' } ]; const formData = [85, 72, 68, 91, 88, 95, 88, 79, 82, 91]; if (isMobile) { return ( 🏎️ Driver Profile CROSS-LEAGUE #33 2150 GP RATING Career Stats {stats.slice(0, 3).map((stat) => ( {stat.value}{stat.suffix} {stat.label} ))} ); } const containerVariants = { hidden: { opacity: 0 }, visible: { opacity: 1, transition: { staggerChildren: shouldReduceMotion ? 0 : 0.1 } } }; const itemVariants = { hidden: { opacity: 0, y: shouldReduceMotion ? 0 : 10 }, visible: { opacity: 1, y: 0, transition: { type: 'spring' as const, stiffness: 200, damping: 20 } } }; return ( 🏎️ Driver Profile Cross-league racing identity #33 GP RATING: iRATING: Career Statistics {stats.map((stat, index) => ( {stat.label} ))} Recent Form {formData.map((value, i) => ( ))} ); } function AnimatedRating({ shouldReduceMotion, value }: { shouldReduceMotion: boolean; value: number }) { const count = useMotionValue(0); const spring = useSpring(count, { stiffness: 50, damping: 25 }); const rounded = useTransform(spring, (v: number) => Math.round(v)); useEffect(() => { if (shouldReduceMotion) { count.set(value); } else { const timeout = setTimeout(() => count.set(value), 200); return () => clearTimeout(timeout); } }, [shouldReduceMotion, count, value]); return ( {shouldReduceMotion ? value : {rounded}} ); } function AnimatedCounter({ value, shouldReduceMotion, delay, suffix = '' }: { value: number; shouldReduceMotion: boolean; delay: number; suffix?: string; }) { const count = useMotionValue(0); const rounded = useTransform(count, (v: number) => Math.round(v)); useEffect(() => { if (shouldReduceMotion) { count.set(value); } else { const timeout = setTimeout(() => count.set(value), delay * 1000 + 400); return () => clearTimeout(timeout); } }, [shouldReduceMotion, count, value, delay]); return ( {shouldReduceMotion ? value : {rounded}}{suffix} ); }