import { useEffect, useMemo, useRef } from 'react'; import { Activity } from 'lucide-react'; import { motion, AnimatePresence } from 'framer-motion'; const IDLE_LOGS = [ "SalesCode Recapture Detector initialized.", "Loading Phone-Adapted XGBoost weights...", "System ready. Awaiting image input." ]; const LOADING_LOGS = [ "Uploading image to analysis engine...", "Waiting for backend response..." ]; export function TerminalLogs({ logs, isLoading = false, isIdle = false }) { const scrollRef = useRef(null); const displayLogs = useMemo(() => { if (isIdle) return IDLE_LOGS; if (logs?.length > 0) return logs; return LOADING_LOGS; }, [logs, isIdle]); useEffect(() => { if (scrollRef.current) { scrollRef.current.scrollTop = scrollRef.current.scrollHeight; } }, [displayLogs]); return (
{displayLogs.map((log, i) => ( {String(i + 1).padStart(2, '0')} {log} ))} {isLoading && displayLogs.length > 0 && ( -- Processing... )} {/* Blinking Cursor */}
00
{/* Scanline overlay */}
); }