"use client"; import { useEffect, useState, useRef } from "react"; import { Target, Zap, Shield, Lock, TrendingUp, Award, Check, } from "lucide-react"; import { useScrollAnimation } from "@/hooks/useScrollAnimation"; // Count Up Hook function useCountUp( end: number, duration: number = 2000, startOnView: boolean = true, ) { const [count, setCount] = useState(0); const [hasStarted, setHasStarted] = useState(!startOnView); const ref = useRef(null); useEffect(() => { if (!startOnView) { return; } const observer = new IntersectionObserver( ([entry]) => { if (entry.isIntersecting && !hasStarted) { setHasStarted(true); } }, { threshold: 0.5 }, ); if (ref.current) { observer.observe(ref.current); } return () => observer.disconnect(); }, [hasStarted, startOnView]); useEffect(() => { if (!hasStarted) return; let startTime: number | null = null; let animationFrame: number; const animate = (timestamp: number) => { if (!startTime) startTime = timestamp; const progress = Math.min((timestamp - startTime) / duration, 1); // Ease out cubic const easeOut = 1 - Math.pow(1 - progress, 3); setCount(Math.floor(end * easeOut)); if (progress < 1) { animationFrame = requestAnimationFrame(animate); } }; animationFrame = requestAnimationFrame(animate); return () => { if (animationFrame) { cancelAnimationFrame(animationFrame); } }; }, [hasStarted, end, duration]); return { count, ref }; } // Stat Card Component interface StatCardProps { value: string; numericValue?: number; suffix?: string; prefix?: string; label: string; icon: React.ElementType; gradient: string; delay: number; additional?: string; isText?: boolean; } function StatCard({ value, numericValue, suffix = "", prefix = "", label, icon: Icon, gradient, delay, additional, isText = false, }: StatCardProps) { const { ref: scrollRef, isVisible } = useScrollAnimation({ threshold: 0.3, }); const { count, ref: countRef } = useCountUp(numericValue || 0, 2000); return (
{/* Background Icon */}
{/* Content */}
{/* Icon */}
{/* Value */}
{isText ? ( {value} ) : ( {prefix} {numericValue !== undefined ? count : value} {suffix} )}
{/* Label */}

{label}

{/* Additional Info */} {additional && (
{additional}
)}
{/* Glow Effect */}
); } // Floating Badge Component function FloatingBadge({ text, icon: Icon, delay, position, }: { text: string; icon: React.ElementType; delay: number; position: { top?: string; bottom?: string; left?: string; right?: string }; }) { const { ref, isVisible } = useScrollAnimation({ threshold: 0.5, }); return (
{text}
); } export function Stats() { const { ref: headerRef, isVisible: headerVisible } = useScrollAnimation(); interface StatItem { value: string; numericValue?: number; suffix?: string; prefix?: string; label: string; icon: React.ElementType; gradient: string; additional?: string; isText?: boolean; } const stats: StatItem[] = [ { value: "99.9", numericValue: 99, suffix: "%", label: "OCR + AI Accuracy", icon: Target, gradient: "bg-gradient-to-br from-blue-500 to-blue-600", additional: "+0.3% this month", }, { value: "< 3", label: "Average AI Response Time", icon: Zap, gradient: "bg-gradient-to-br from-amber-500 to-orange-600", additional: "Lightning fast", isText: true, }, { value: "100", numericValue: 100, suffix: "%", label: "Blockchain Verified", icon: Shield, gradient: "bg-gradient-to-br from-violet-500 to-purple-600", additional: "All documents certified", }, { value: "GDPR", label: "Full European Compliance", icon: Lock, gradient: "bg-gradient-to-br from-emerald-500 to-green-600", additional: "ISO 27001 Certified", isText: true, }, ]; const floatingBadges = [ { text: "+1 Verified", icon: Check, position: { top: "10%", left: "5%" }, delay: 0.8, }, { text: "99.9% Uptime", icon: Shield, position: { top: "20%", right: "8%" }, delay: 1, }, { text: "AI Powered", icon: Zap, position: { bottom: "15%", left: "10%" }, delay: 1.2, }, { text: "Secure", icon: Lock, position: { bottom: "25%", right: "5%" }, delay: 1.4, }, ]; return (
{/* Gradient Background */}
{/* Grid Pattern Overlay */}
{/* Radial Glow */}
{/* Floating Badges */} {floatingBadges.map((badge, i) => ( ))}
{/* Section Header */}
By The Numbers

Results That{" "} Speak

{/* Stats Grid */}
{stats.map((stat, index) => ( ))}
{/* Bottom Awards Row */}
{[ { icon: Award, text: "Best AI Solution 2024" }, { icon: Shield, text: "SOC 2 Type II Certified" }, { icon: Lock, text: "GDPR Compliant" }, { icon: Check, text: "ISO 27001 Certified" }, ].map((award, i) => (
{award.text}
))}
); }