"use client"; /** * One entry in an incident's call spine — UI_REDESIGN.md §5.2. Replaces * CallRow for this context (CallRow stays in use for the Archive table * until chunk 12). `stopNumber` is the same index the map's path stops use * (see IncidentPathLayer in MapView.tsx) — that shared index is the one * memorable thing per §2.4: "where was he when he said that" is answered * by looking, not cross-referencing timestamps. */ import { useState } from "react"; import type { CallRecord } from "@/lib/types"; import { InlinePlayer } from "@/components/InlinePlayer"; import { hasAudio as callHasAudio } from "@/lib/audioQueue"; import { isKnownSeverity, SEVERITY_COLORS } from "@/lib/severity"; function fmtTime(iso: string): string { return new Date(iso).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", second: "2-digit" }); } function StopMarker({ stopNumber, color }: { stopNumber?: number; color: string }) { if (!stopNumber) { return ; } return ( {stopNumber} ); } export function CallSpineEntry({ call, stopNumber, isAdmin, }: { call: CallRecord; stopNumber?: number; isAdmin?: boolean; }) { const [expanded, setExpanded] = useState(false); const hasAudio = callHasAudio(call); const transcript = call.transcript_corrected || call.transcript; const color = isKnownSeverity(call.severity) ? SEVERITY_COLORS[call.severity] : "var(--ink-muted)"; const substantive = !!transcript || (call.units && call.units.length > 0) || !!call.location_coords; const units = call.units ?? []; const clearedInCall = call.cleared_units ?? []; if (!substantive) { // Thin/routine calls collapse to a single line. return (
{fmtTime(call.started_at)} TG {call.talkgroup_name ?? call.talkgroup_id ?? "—"} · status only
); } return (
{fmtTime(call.started_at)} · TG {call.talkgroup_name ?? call.talkgroup_id ?? "—"} {call.node_id}
{hasAudio && (
)} {transcript && (

setExpanded((v) => !v)} > {transcript}

)}
{call.location && ( {call.location} )} {units.map((u) => ( {u} ))} {clearedInCall.map((u) => ( {u} ))}
{isAdmin && call.corr_path && (

corr: {call.corr_path}

)}
); }