import { useState } from 'react'; import { ChevronDown, ChevronRight, Copy, Image as ImageIcon, Radio, RefreshCw } from 'lucide-react'; import { toast } from 'sonner'; import type { EventLogEntry } from '../../../shared/api-types'; import { Badge } from '@/components/ui/badge'; import { formatBytes, formatClock, prettyCursor, shortId } from '@/lib/format'; export function EventRow({ entry, onPreviewImage, }: { entry: EventLogEntry; onPreviewImage: (title: string, subtitle: string, url: string) => void; }) { const [expanded, setExpanded] = useState(false); const copy = async (label: string, value: string) => { try { await navigator.clipboard.writeText(value); toast.success(`Copied ${label}`); } catch { toast.error('Clipboard copy failed'); } }; const wirePayload = { eventId: entry.eventId, timestamp: entry.timestamp, source: entry.source, ...(entry.message ? { message: entry.message } : {}), ...(entry.snapshot ? { snapshot: { eventId: entry.snapshot.eventId, mimeType: entry.snapshot.mimeType, width: entry.snapshot.width, height: entry.snapshot.height, bytes: entry.snapshot.bytes, frozen: entry.snapshot.frozen, resourceUri: `webcam://events/${entry.snapshot.eventId}/snapshot`, tool: 'get_event_snapshot', }, } : {}), }; return (
{entry.message}
)}
{JSON.stringify(wirePayload, null, 2)}