import { useState } from 'react'; import { ChevronDown, ChevronRight } from 'lucide-react'; import type { CallerView } from '../../../shared/api-types'; import { Badge } from '@/components/ui/badge'; import { relativeTime } from '@/lib/format'; import { ClientBadge } from './ClientBadge'; import { EraBadge } from './EraBadge'; import { cn } from '@/lib/utils'; export function CallerRow({ caller, nowMs }: { caller: CallerView; nowMs: number }) { const [expanded, setExpanded] = useState(false); const dotClass = caller.status === 'active' ? 'bg-emerald-400' : caller.status === 'idle' ? 'bg-event' : 'bg-zinc-500'; const methodEntries = Object.entries(caller.methods).sort((a, b) => b[1] - a[1]); return (
{caller.client.transport} {caller.client.eventsCapable && ( events-capable )}
{caller.lastMethod} {caller.lastDetail ? ` · ${caller.lastDetail}` : ''} {caller.lastResponse && ( {caller.lastResponse} )}
last seen {relativeTime(caller.lastSeenAt, nowMs)} {caller.open && stdio open}
{expanded && methodEntries.length > 0 && (
{methodEntries.map(([method, count]) => ( {method} ×{count} ))}
)}
); }