'use client' import { Phone, User, Droplets, AlertTriangle, Activity, Stethoscope } from 'lucide-react' import { format } from 'date-fns' interface EmergencyInfo { patientName: string | null patientDOB: string | null bloodType: string | null allergies: string | null medicalConditions: string | null primaryPhysician: string | null physicianPhone: string | null clinicPhone: string | null emergencyPhone: string | null } interface EmergencyCardProps { info: EmergencyInfo medications?: { name: string; instructions: string | null }[] variant?: 'full' | 'compact' } export function EmergencyCard({ info, medications, variant = 'full' }: EmergencyCardProps) { const formatDate = (dateStr: string | null) => { if (!dateStr) return null try { return format(new Date(dateStr), 'MMMM d, yyyy') } catch { return dateStr } } const hasEmergencyInfo = info.patientName || info.bloodType || info.allergies || info.medicalConditions || info.primaryPhysician if (!hasEmergencyInfo && variant === 'compact') { return null } return (
{/* Header */}

Emergency Information

{/* Patient Info */} {info.patientName && (

Patient Name

{info.patientName}

{info.patientDOB && (

DOB: {formatDate(info.patientDOB)}

)}
)} {/* Blood Type */} {info.bloodType && (

Blood Type

{info.bloodType}

)} {/* Allergies - High visibility */} {info.allergies && (

Allergies

{info.allergies}

)} {/* Medical Conditions */} {info.medicalConditions && (

Medical Conditions

{info.medicalConditions}

)} {/* Current Medications */} {variant === 'full' && medications && medications.length > 0 && (

Current Medications

    {medications.map((med, i) => (
  • {med.name} {med.instructions && ( - {med.instructions} )}
  • ))}
)} {/* Doctor Info */} {info.primaryPhysician && (

Primary Physician

{info.primaryPhysician}

{info.physicianPhone && ( {info.physicianPhone} )}
)} {/* Emergency Contacts */} {(info.clinicPhone || info.emergencyPhone) && (

Emergency Contacts

{info.clinicPhone && (

Call Clinic

{info.clinicPhone}

)} {info.emergencyPhone && (

Emergency Contact

{info.emergencyPhone}

)}
)}
) }