import { motion, AnimatePresence } from "framer-motion"; import { Radio, Clock, GitCommit, GitPullRequest, GitFork, Star, MessageSquare } from "lucide-react"; import { useEffect, useState } from "react"; interface LogEntry { id: string; timestamp: string; type: string; message: string; user: string; repo: string; } interface Props { logs: LogEntry[]; } const getTypeIcon = (type: string) => { const iconClass = "w-3 h-3"; switch (type.toLowerCase()) { case "push": return ; case "pr_open": return ; case "fork": return ; case "star": return ; case "comment": return ; default: return ; } }; const getTypeColor = (type: string) => { switch (type.toLowerCase()) { case "push": return "text-green-400"; case "pr_open": return "text-blue-400"; case "fork": return "text-purple-400"; case "star": return "text-yellow-400"; case "comment": return "text-cyan-400"; default: return "text-muted-foreground"; } }; const getTypeBg = (type: string) => { switch (type.toLowerCase()) { case "push": return "from-green-500/10 to-transparent"; case "pr_open": return "from-blue-500/10 to-transparent"; case "fork": return "from-purple-500/10 to-transparent"; case "star": return "from-yellow-500/10 to-transparent"; case "comment": return "from-cyan-500/10 to-transparent"; default: return "from-gray-500/10 to-transparent"; } }; export default function LiveLogStream({ logs }: Props) { const [currentTime, setCurrentTime] = useState(new Date().toLocaleTimeString()); useEffect(() => { const interval = setInterval(() => { setCurrentTime(new Date().toLocaleTimeString()); }, 1000); return () => clearInterval(interval); }, []); return (
{/* Header */}

Data Stream

Real-Time
{currentTime}
{/* Log entries */}
{logs.map((log, index) => ( {/* Timestamp */}
{log.timestamp}
{/* Content */}
{/* Icon */}
{getTypeIcon(log.type)}
{/* Details */}
#{log.id.substring(0, 7)} : {log.type.toUpperCase().replace("_", " ")}
{log.message}
{/* Animated line for new entries */} {index === 0 && ( )} ))}
{/* Fade effect at bottom */}
); }