"use client"; import { useState, useEffect } from "react"; import Link from "next/link"; import { ESCALATION_RULES } from "@/lib/ai/medical-triggers"; const RULE_META: Record = { fever: { icon: "🌡️", title: "Fever", color: "bg-orange-50 dark:bg-orange-900/20 border-orange-200 dark:border-orange-800" }, breathing: { icon: "💨", title: "Breathing Issues", color: "bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800" }, feeding: { icon: "🍼", title: "Feeding / Diapers", color: "bg-yellow-50 dark:bg-yellow-900/20 border-yellow-200 dark:border-yellow-800" }, lethargy: { icon: "😴", title: "Lethargy / Unresponsive", color: "bg-purple-50 dark:bg-purple-900/20 border-purple-200 dark:border-purple-800" }, vomiting: { icon: "🤢", title: "Vomiting", color: "bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800" }, rash: { icon: "🔴", title: "Rash", color: "bg-rose-50 dark:bg-rose-900/20 border-rose-200 dark:border-rose-800" }, injury: { icon: "🩹", title: "Injury / Fall", color: "bg-red-50 dark:bg-red-900/20 border-red-200 dark:border-red-800" }, default: { icon: "⚠️", title: "General Concern", color: "bg-gray-50 dark:bg-gray-800 border-gray-200 dark:border-gray-700" }, }; export default function EmergencyPage() { const [phone, setPhone] = useState(null); useEffect(() => { fetch("/api/family").then(r => r.json()).then(d => { setPhone(d.family?.pediatrician_phone || null); }).catch(() => {}); }, []); return (
{/* Header */}

Emergency Guide

When to call the doctor immediately

{/* Call button */}
{phone ? ( 📞 Call Pediatrician Now ) : ( + Add pediatrician phone in Settings )}
{/* Emergency rules */}

Seek care if you see any of these

{(Object.entries(ESCALATION_RULES) as [string, string][]).map(([key, text]) => { const meta = RULE_META[key] || RULE_META.default; return (
{meta.icon} {meta.title}

{text}

); })}

When in doubt, call your pediatrician.

It's always better to check than to wait.

); }