import { useState, useEffect } from "react"; import { motion, AnimatePresence } from "framer-motion"; import { Code2, GitCommit, MessageSquare, Users, TrendingUp, TrendingDown, Sparkles, Globe } from "lucide-react"; interface Props { stats: any; } // Animated number component function AnimatedNumber({ value, className, prefix = "", suffix = "" }: { value: number; className?: string; prefix?: string; suffix?: string; }) { const [displayValue, setDisplayValue] = useState(0); useEffect(() => { const duration = 1200; const startTime = Date.now(); const startValue = displayValue; const animate = () => { const now = Date.now(); const progress = Math.min((now - startTime) / duration, 1); const eased = 1 - Math.pow(1 - progress, 3); setDisplayValue(Math.floor(startValue + (value - startValue) * eased)); if (progress < 1) { requestAnimationFrame(animate); } }; requestAnimationFrame(animate); }, [value]); return {prefix}{displayValue.toLocaleString()}{suffix}; } export default function BottomPanel({ stats }: Props) { const [activeSlide, setActiveSlide] = useState(0); const SLIDES = 4; useEffect(() => { const interval = setInterval(() => { setActiveSlide((prev) => (prev + 1) % SLIDES); }, 15000); return () => clearInterval(interval); }, []); const variants = { enter: { opacity: 0, y: 30, filter: "blur(10px)" }, center: { opacity: 1, y: 0, filter: "blur(0px)" }, exit: { opacity: 0, y: -30, filter: "blur(10px)" }, }; return (
{/* Animated gradient border */}
{/* Content */}
{/* VIEW 1: Code Frequency */} {activeSlide === 0 && (
{/* Glow effect */}
Code Lines Added / Deleted
Global repository statistics (Last 24h)
{/* Contribution bars */}
{Array.from({ length: 45 }).map((_, i) => { const height = Math.random() * 100; return ( ); })}
)} {/* VIEW 2: Contribution Graph */} {activeSlide === 1 && (
System-wide Contribution Graph
{Array.from({ length: 168 }).map((_, i) => { const level = Math.floor(Math.random() * 5); const colors = ['#161b22', '#0e4429', '#006d32', '#26a641', '#39d353']; return ( ); })}
)} {/* VIEW 3: User Engagement */} {activeSlide === 2 && (
Users Reviewing & Commenting
Active participants in code review
{/* Timeline */}
{Array.from({ length: 6 }).map((_, i) => { const colors = ['#8957e5', '#238636', '#da3633', '#e3b341', '#3fb950', '#f778ba']; return (
); })}
{/* Avatars */}
{(stats.reviewStats?.activeReviewers || Array.from({ length: 4 })).slice(0, 5).map((u: any, i: number) => ( {u?.avatar ? ( ) : ( {String.fromCharCode(65 + i)} )} ))}
)} {/* VIEW 4: Languages */} {activeSlide === 3 && (
Usage by Language
{(stats.languages || []).map((lang: any, i: number) => (
{lang.name}
{/* Shimmer effect */}
{lang.percentage}%
))}
)} {/* Progress indicators with glow */}
{[0, 1, 2, 3].map(i => ( ))}
); }