import { useState } from "react"; import { PawPrint, Heart, Scissors, Syringe, AlertTriangle, CheckCircle, Clock, Upload, Edit3 } from "lucide-react"; import { PETS, PAST_APPOINTMENTS } from "../mockData.js"; import type { Pet } from "../mockData.js"; import { PetForm } from "./PetForm.js"; interface Props { readOnly: boolean; } type VaxStatus = "valid" | "expiring" | "expired"; const VAX_STATUS_STYLES: Record = { valid: { bg: "bg-green-100", text: "text-green-700", icon: CheckCircle }, expiring: { bg: "bg-amber-100", text: "text-amber-700", icon: Clock }, expired: { bg: "bg-red-100", text: "text-red-700", icon: AlertTriangle }, }; export function PetProfiles({ readOnly }: Props) { const [selectedPetId, setSelectedPetId] = useState(PETS[0]?.id ?? ""); const [activeTab, setActiveTab] = useState<"info" | "medical" | "grooming" | "vaccinations" | "history">("info"); const [editingPetId, setEditingPetId] = useState(null); const pet = PETS.find(p => p.id === selectedPetId)!; const petHistory = PAST_APPOINTMENTS.filter(a => a.petId === selectedPetId); const editingPet = editingPetId ? PETS.find(p => p.id === editingPetId) ?? undefined : undefined; if (editingPet) { return ( setEditingPetId(null)} onCancel={() => setEditingPetId(null)} /> ); } return (
{/* Pet Selector */}
{PETS.map(p => ( ))}
{/* Profile Header */}
{pet.photo}

{pet.name}

{pet.breed} · {pet.weight} lbs · {pet.sex === "male" ? "♂" : "♀"} {pet.spayedNeutered ? "(spayed/neutered)" : ""}

Born {new Date(pet.dob).toLocaleDateString("en-US", { month: "long", day: "numeric", year: "numeric" })}

{!readOnly && ( )}
{/* Tabs */}
{([ { id: "info", label: "Basic Info", icon: PawPrint }, { id: "medical", label: "Medical", icon: Heart }, { id: "grooming", label: "Grooming", icon: Scissors }, { id: "vaccinations", label: "Vaccinations", icon: Syringe }, { id: "history", label: "History", icon: Clock }, ] as const).map(({ id, label, icon: Icon }) => ( ))}
{/* Tab Content */}
{activeTab === "info" && } {activeTab === "medical" && } {activeTab === "grooming" && } {activeTab === "vaccinations" && } {activeTab === "history" && }
); } function InfoRow({ label, value }: { label: string; value: string }) { return (
{label} {value}
); } function BasicInfoTab({ pet, readOnly }: { pet: Pet; readOnly: boolean }) { return (
{!readOnly && ( )}
); } function MedicalTab({ pet, readOnly }: { pet: Pet; readOnly: boolean }) { return (
{!readOnly && (

Changes to medical notes will be flagged for staff review.

)}
); } function GroomingTab({ pet, readOnly }: { pet: Pet; readOnly: boolean }) { return (
{!readOnly && ( )}
); } function VaccinationsTab({ pet, readOnly }: { pet: Pet; readOnly: boolean }) { return (
{pet.vaccinations.map(vax => { const style = VAX_STATUS_STYLES[vax.status]; const StatusIcon = style.icon; return ( ); })}
Vaccine Administered Expires Status Proof
{vax.name} {new Date(vax.lastAdministered).toLocaleDateString()} {new Date(vax.expirationDate).toLocaleDateString()} {vax.status} {vax.documentUploaded ? ( Uploaded ) : !readOnly ? ( ) : ( Missing )}
); } function HistoryTab({ petHistory }: { petHistory: typeof PAST_APPOINTMENTS }) { return (
{petHistory.length === 0 ? (

No history yet

) : ( petHistory.map(appt => (

{appt.services.join(", ")}

with {appt.groomerName} · ${appt.price}

{new Date(appt.date).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" })} {appt.reportCardId && ( Report → )}
)) )}
); }