import { useEffect, useRef } from "react"; import { Terminal } from "lucide-react"; import { cn } from "@/lib/utils"; import { useTranslate } from "ra-core"; import { LogEntry } from "./types"; interface TerminalLogsProps { logs: LogEntry[]; className?: string; } export function TerminalLogs({ logs, className }: TerminalLogsProps) { const translate = useTranslate(); const logEndRef = useRef(null); useEffect(() => { logEndRef.current?.scrollIntoView({ behavior: "smooth" }); }, [logs]); return (
{logs.length === 0 ? (
{translate("setup.awaitingSignals")}
) : ( <> {logs.map((log, i) => (
[ {new Date(log.timestamp).toLocaleTimeString([], { hour12: false, hour: "2-digit", minute: "2-digit", second: "2-digit", })} ] {log.message}
))}
)}
); }