import type { FC } from 'react'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faArrowRight } from '@fortawesome/pro-duotone-svg-icons'; import { Badge } from '@/components/base/badges/badges'; import { Button } from '@/components/base/buttons/button'; const ArrowRight: FC<{ className?: string }> = ({ className }) => ; import { formatShortDate } from '@/lib/format'; import type { Call, CallDisposition } from '@/types/entities'; interface CallLogProps { calls: Call[]; } const dispositionConfig: Record = { APPOINTMENT_BOOKED: { label: 'Booked', color: 'success' }, FOLLOW_UP_SCHEDULED: { label: 'Follow-up', color: 'brand' }, INFO_PROVIDED: { label: 'Info', color: 'blue-light' }, NO_ANSWER: { label: 'No Answer', color: 'warning' }, WRONG_NUMBER: { label: 'Wrong #', color: 'gray' }, CALLBACK_REQUESTED: { label: 'Not Interested', color: 'error' }, }; const formatDuration = (seconds: number | null): string => { if (seconds === null || seconds === 0) return '0 min'; const minutes = Math.round(seconds / 60); return `${minutes} min`; }; export const CallLog = ({ calls }: CallLogProps) => { return ( Today's Calls {calls.length} {calls.length > 0 ? ( {calls.map((call) => { const config = call.disposition !== null ? dispositionConfig[call.disposition] : null; return ( {call.startedAt !== null ? formatShortDate(call.startedAt) : '—'} {call.leadName ?? call.callerNumber?.[0]?.number ?? 'Unknown'} {config !== null && ( {config.label} )} {formatDuration(call.durationSeconds)} ); })} ) : ( No calls handled today )} View Full History ); };
No calls handled today