import type { CallRecord } from "@/lib/types"; interface Props { call: CallRecord; systemName?: string; } function duration(started: string, ended: string | null): string { if (!ended) return "active"; const ms = new Date(ended).getTime() - new Date(started).getTime(); const s = Math.floor(ms / 1000); return s < 60 ? `${s}s` : `${Math.floor(s / 60)}m ${s % 60}s`; } export function CallRow({ call, systemName }: Props) { const isActive = call.status === "active"; return ( {new Date(call.started_at).toLocaleTimeString()} {call.talkgroup_name || call.talkgroup_id || "—"} {systemName ?? call.system_id ?? "—"} {call.node_id} {isActive ? ( ● live ) : ( {duration(call.started_at, call.ended_at)} )} {call.audio_url ? ( audio ) : ( )} ); }