'use client' import { motion } from 'framer-motion' import { useState, useEffect } from 'react' import { Activity, TrendingUp, Zap, Shield } from 'lucide-react' function AnimatedNumber({ value, suffix = '' }: { value: number; suffix?: string }) { const [displayValue, setDisplayValue] = useState(0) useEffect(() => { const duration = 2000 // 2 seconds const steps = 60 const increment = value / steps const stepDuration = duration / steps let currentStep = 0 const interval = setInterval(() => { currentStep++ if (currentStep <= steps) { setDisplayValue(Math.floor(increment * currentStep)) } else { setDisplayValue(value) clearInterval(interval) } }, stepDuration) return () => clearInterval(interval) }, [value]) return ( {displayValue.toLocaleString()}{suffix} ) } function FluctuatingNumber({ base, variance }: { base: number; variance: number }) { const [value, setValue] = useState(base) useEffect(() => { const interval = setInterval(() => { const fluctuation = (Math.random() - 0.5) * variance setValue(base + fluctuation) }, 1500) return () => clearInterval(interval) }, [base, variance]) return ( {Math.round(value)}ms ) } export function LiveStatsBar() { const stats = [ { icon: , label: 'Checks performed today', value: 2847, type: 'counter' as const }, { icon: , label: 'Changes detected this hour', value: 127, type: 'counter' as const }, { icon: , label: 'Uptime', value: '99.9%', type: 'static' as const }, { icon: , label: 'Avg response time', value: '< ', type: 'fluctuating' as const, base: 42, variance: 10 } ] return ( {/* Desktop: Grid */} {stats.map((stat, i) => ( {/* Icon */} {stat.icon} {/* Value */} {stat.type === 'counter' && typeof stat.value === 'number' && ( )} {stat.type === 'static' && ( {stat.value} )} {stat.type === 'fluctuating' && stat.base && stat.variance && ( {stat.value} )} {/* Label */} {stat.label} ))} {/* Mobile: Horizontal Scroll */} {stats.map((stat, i) => ( {/* Icon */} {stat.icon} {/* Value */} {stat.type === 'counter' && typeof stat.value === 'number' && ( )} {stat.type === 'static' && ( {stat.value} )} {stat.type === 'fluctuating' && stat.base && stat.variance && ( {stat.value} )} {/* Label */} {stat.label} ))} ) }
{stat.label}