import Link from "next/link" import { notFound } from "next/navigation" import { fetchQuery } from "convex/nextjs" import { ArrowLeft, ExternalLink, Phone } from "lucide-react" import { api } from "@/convex/_generated/api" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card" import { formatPhoneCallDuration, formatPhoneCallTimestamp, normalizePhoneFromIdentity, } from "@/lib/phone-calls" type PageProps = { params: Promise<{ id: string }> } export default async function AdminCallDetailPage({ params }: PageProps) { const { id } = await params const detail = await fetchQuery(api.voiceSessions.getAdminPhoneCallDetail, { callId: id, }) if (!detail) { notFound() } return (
{normalizePhoneFromIdentity(detail.call.participantIdentity) || detail.call.participantIdentity}
Started
{formatPhoneCallTimestamp(detail.call.startedAt)}
Room
{detail.call.roomName}
Duration
{formatPhoneCallDuration(detail.call.durationMs)}
Participant Identity
{detail.call.participantIdentity || "Unknown"}
Call Status
Jessica Answered
{detail.call.answered ? "Yes" : "No"}
Lead Outcome
{detail.call.leadOutcome}
Email Summary
{detail.call.notificationStatus}
Summary
{detail.call.summaryText || "No summary available yet."}
Recording Status
{detail.call.recordingStatus || "Unavailable"}
Transcript Turns
{detail.call.transcriptTurnCount}
Email Error
{detail.call.notificationError}
Contact
{detail.linkedLead.firstName} {detail.linkedLead.lastName}
Lead Type
{detail.linkedLead.type}
{detail.linkedLead.email}
Phone
{detail.linkedLead.phone}
Message
{detail.linkedLead.message || "—"}
Jessica handled the call, but it did not result in a submitted lead.
)}No transcript turns were captured for this call.
) : ( detail.turns.map((turn: any) => ({turn.text}