"use client"; import { useEffect, useState, useRef } from "react"; import { Target, Zap, Shield, Lock, TrendingUp, Award, Check, } from "lucide-react"; import { BentoGrid } from "@/components/ui/bento-grid"; import { Spotlight } from "@/components/ui/spotlight-new"; import { GlowingEffect } from "@/components/ui/glowing-effect"; 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); const nextValue = end * easeOut; const formattedValue = Number.isInteger(end) ? Math.floor(nextValue) : Number(nextValue.toFixed(1)); setCount(formattedValue); 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; className?: string; cardColor?: string; glowColor?: string; spotlight?: { gradientFirst?: string; gradientSecond?: string; gradientThird?: string; duration?: number; xOffset?: number; }; delay: number; additional?: string; isText?: boolean; } function StatCard({ value, numericValue, suffix = "", prefix = "", label, icon: Icon, gradient, className, cardColor, glowColor, spotlight, delay, additional, isText = false, }: StatCardProps) { const { ref: scrollRef, isVisible } = useScrollAnimation({ threshold: 0.3, }); const { count, ref: countRef } = useCountUp(numericValue || 0, 2000); return (
{/* Glowing Effect */}
{/* Hover Glow */} {glowColor && (
)} {/* Background Icon */}
{/* Content */}
{/* Icon */}
Performance
{/* Value */}
{isText ? ( {value} ) : ( {prefix} {numericValue !== undefined && !Number.isInteger(numericValue) ? count.toFixed(1) : numericValue !== undefined ? count : value} {suffix} )}
{/* Label */}

{label}

{/* Additional Info */} {additional && (
{additional}
)}
); } 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; className?: string; cardColor?: string; glowColor?: string; spotlight?: { gradientFirst?: string; gradientSecond?: string; gradientThird?: string; duration?: number; xOffset?: number; }; additional?: string; isText?: boolean; } const stats: StatItem[] = [ { value: "99.9", numericValue: 99.9, suffix: "%", label: "OCR + AI Accuracy", icon: Target, gradient: "bg-gradient-to-r from-blue-500 to-indigo-600", cardColor: "bg-gradient-to-br from-blue-50/80 to-indigo-50/80 dark:from-blue-950/30 dark:to-indigo-950/30", glowColor: "bg-blue-500", className: "md:col-span-2", spotlight: { gradientFirst: "radial-gradient(68.54% 68.72% at 55.02% 31.46%, hsla(217, 91%, 60%, .28) 0, hsla(217, 91%, 60%, .12) 55%, hsla(217, 91%, 60%, 0) 80%)", gradientSecond: "radial-gradient(50% 50% at 50% 50%, hsla(258, 90%, 66%, .24) 0, hsla(258, 90%, 66%, .08) 80%, transparent 100%)", gradientThird: "radial-gradient(50% 50% at 50% 50%, hsla(217, 91%, 60%, .18) 0, hsla(217, 91%, 60%, .06) 80%, transparent 100%)", }, additional: "+0.3% this month", }, { value: "< 3", label: "Average AI Response Time", icon: Zap, gradient: "bg-gradient-to-r from-amber-500 to-orange-600", cardColor: "bg-gradient-to-br from-amber-50/80 to-orange-50/80 dark:from-amber-950/30 dark:to-orange-950/30", glowColor: "bg-amber-500", spotlight: { gradientFirst: "radial-gradient(68.54% 68.72% at 55.02% 31.46%, hsla(48, 96%, 53%, .28) 0, hsla(48, 96%, 53%, .12) 55%, hsla(48, 96%, 53%, 0) 80%)", }, additional: "Average under 3 seconds", isText: true, }, { value: "100", numericValue: 100, suffix: "%", label: "Blockchain Verified", icon: Shield, gradient: "bg-gradient-to-r from-emerald-500 to-teal-600", cardColor: "bg-gradient-to-br from-emerald-50/80 to-teal-50/80 dark:from-emerald-950/30 dark:to-teal-950/30", glowColor: "bg-emerald-500", spotlight: { gradientFirst: "radial-gradient(68.54% 68.72% at 55.02% 31.46%, hsla(158, 64%, 52%, .28) 0, hsla(158, 64%, 52%, .12) 55%, hsla(158, 64%, 52%, 0) 80%)", }, additional: "All documents certified", }, { value: "GDPR", label: "Full European Compliance", icon: Lock, gradient: "bg-gradient-to-r from-violet-500 to-purple-600", cardColor: "bg-gradient-to-br from-violet-50/80 to-purple-50/80 dark:from-violet-950/30 dark:to-purple-950/30", glowColor: "bg-violet-500", className: "md:col-span-2", spotlight: { gradientFirst: "radial-gradient(68.54% 68.72% at 55.02% 31.46%, hsla(258, 90%, 66%, .28) 0, hsla(258, 90%, 66%, .12) 55%, hsla(258, 90%, 66%, 0) 80%)", }, additional: "ISO 27001 certified", isText: true, }, ]; return (
{/* Gradient Background */}
{/* Grid Pattern Overlay */}
{/* Radial Glow */}
{/* Section Header */}
Platform Metrics

Corporate-Grade Results, Measured.

Transparent performance benchmarks that prove reliability, accuracy, and compliance at enterprise scale.

{/* Stats Grid */} {stats.map((stat, index) => ( ))}
); }