"use client"; import React, { useEffect, useRef } from "react"; import { t } from "@/content/locales"; // Import der Locales export interface LogEntry { id: string; message: string; type: "info" | "success" | "danger" | "warning"; timestamp: string; } interface EventLogProps { logs: LogEntry[]; } export default function EventLog({ logs }: EventLogProps) { const scrollRef = useRef(null); // Auto-Scroll nach unten bei neuen Einträgen useEffect(() => { if (scrollRef.current) { scrollRef.current.scrollTop = scrollRef.current.scrollHeight; } }, [logs]); const getTypeStyles = (type: LogEntry["type"]) => { switch (type) { case "success": return "text-green-400"; case "danger": return "text-red-500 font-bold animate-pulse"; case "warning": return "text-orange-400"; default: return "text-yellow-500/80"; } }; return (
{/* Header */}
{t.EVENT_LOG.TITLE}
{/* Scrollable Content */}
{logs.length === 0 && (

{t.EVENT_LOG.EMPTY_STATE}

)} {logs.map((log) => (
{log.timestamp} {log.type === "danger" && "⚠ "} {log.message}
))}
); }