import { MessageSquare, Terminal } from "lucide-react"; import Link from "@/components/link"; import { Badge } from "@/components/ui/badge"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; interface ChatMessage { id: number; roomId: number; timestamp: number; message: string; } interface CommandEntry { id: number; timestamp: number; command: string; params: string; succes: string; } interface UserActivityLogProps { chatLogs: ChatMessage[]; commandLogs: CommandEntry[]; } function formatTime(ts: number) { if (!ts) return "-"; const d = new Date(ts * 1000); return d.toLocaleString(undefined, { day: "2-digit", month: "short", hour: "2-digit", minute: "2-digit", }); } export function UserActivityLog({ chatLogs, commandLogs, }: UserActivityLogProps) { return (
{/* Chat Messages */} Recent Messages ({chatLogs.length}) {chatLogs.length === 0 ? (

No recent messages.

) : (
{chatLogs.map((log) => (
Room #{log.roomId} {formatTime(log.timestamp)}

{log.message}

))}
)}
{/* Commands */} Recent Commands ({commandLogs.length}) {commandLogs.length === 0 ? (

No recent commands.

) : (
{commandLogs.map((log) => (
:{log.command}
{log.succes === "yes" ? "OK" : "FAIL"} {formatTime(log.timestamp)}
{log.params && (

{log.params}

)}
))}
)}
); }