import React, { useEffect, useRef } from 'react'; import { LogEntry } from '../types'; interface LogConsoleProps { logs: LogEntry[]; } const LogConsole: React.FC = ({ logs }) => { const scrollRef = useRef(null); useEffect(() => { if (scrollRef.current) { scrollRef.current.scrollTop = scrollRef.current.scrollHeight; } }, [logs]); const getColor = (type: LogEntry['type']) => { switch (type) { case 'command': return 'text-blue-600'; case 'response': return 'text-green-600'; case 'error': return 'text-red-600'; case 'success': return 'text-emerald-600'; default: return 'text-slate-500'; } }; return (
연결 로그 (Connection Log)
{logs.map((log) => (
{new Date(log.timestamp).toLocaleTimeString()} {log.type} {log.message}
))} {logs.length === 0 && (
로그 없음. 연결 대기 중...
)}
); }; export default LogConsole;