import { Button, DataTable, ScrollArea } from '@rozenite/ui'; import { Trash2 } from 'lucide-react'; import { useMemo } from 'react'; import type { DataTableColumn } from '@rozenite/ui'; import type { MessageEntry } from '../types.js'; import { formatMessageTableDate, formatPayloadPreview } from '../utils.js'; type MessageLogPaneProps = { messages: MessageEntry[]; onSelectMessage: (messageId: string) => void; onClearMessages: () => void; }; export const MessageLogPane = ({ messages, onSelectMessage, onClearMessages, }: MessageLogPaneProps) => { const columns = useMemo[]>( () => [ { accessorKey: 'direction', header: 'Dir', cell: ({ getValue }) => { const direction = getValue(); const isSent = direction === 'in'; return ( {isSent ? '↑' : '↓'} ); }, }, { accessorKey: 'date', header: 'Date', cell: ({ row }) => ( {formatMessageTableDate(row.original.date)} ), }, { accessorKey: 'type', header: 'Type', cell: ({ getValue }) => ( {getValue()} ), }, { id: 'payload', accessorFn: (message) => formatPayloadPreview(message.payload), header: 'Payload', cell: ({ getValue }) => ( {getValue()} ), }, ], [], ); return (

Message Log

message.id} onRowClick={(message) => onSelectMessage(message.id)} />
); };