File size: 2,091 Bytes
390536f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | import { useEffect, useRef } from "react";
import { motion, AnimatePresence } from "framer-motion";
interface ScanningLogProps {
logs: string[];
isScanning: boolean;
}
export function ScanningLog({ logs, isScanning }: ScanningLogProps) {
const scrollRef = useRef<HTMLDivElement>(null);
useEffect(() => {
if (scrollRef.current) {
scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
}
}, [logs]);
return (
<div className="h-full flex flex-col font-mono text-xs bg-black relative overflow-hidden">
<div className="px-4 py-3 border-b border-white/[0.06]">
<div className="flex items-center gap-2">
<span className={`block w-1.5 h-1.5 rounded-full transition-colors ${isScanning ? 'bg-emerald-400 animate-pulse' : 'bg-white/20'}`} />
<span className="text-[11px] text-white/35 font-mono uppercase tracking-[0.08em]">
{isScanning ? "Processing" : "System Log"}
</span>
</div>
</div>
<div ref={scrollRef} className="flex-1 overflow-y-auto px-4 py-3 space-y-1 scrollbar-none">
<AnimatePresence initial={false}>
{logs.map((log, i) => (
<motion.div
key={i}
initial={{ opacity: 0, x: -4 }}
animate={{ opacity: 1, x: 0 }}
transition={{ duration: 0.12 }}
className="flex gap-2 text-white/30 hover:text-white/50 transition-colors"
>
<span className="text-white/15 select-none text-[10px] leading-[18px] w-4 text-right shrink-0 tabular-nums">
{String(i + 1).padStart(2, "0")}
</span>
<span className="text-[11px] leading-[18px]">
{log.startsWith('>') ? (
<span className="text-white/70">{log}</span>
) : (
log
)}
</span>
</motion.div>
))}
</AnimatePresence>
<div className="h-3 w-[5px] bg-white/15 animate-pulse ml-6 mt-1.5 rounded-sm" />
</div>
</div>
);
}
|