import { useState } from "react"; import { User, Lock, PawPrint, FileCheck, Plus, Archive } from "lucide-react"; import { CUSTOMER, PETS, SIGNED_AGREEMENTS } from "../mockData.js"; import { PetForm } from "./PetForm.js"; interface Props { readOnly: boolean; } export function AccountSettings({ readOnly }: Props) { const [tab, setTab] = useState<"personal" | "password" | "pets" | "agreements">("personal"); return (
{([ { id: "personal" as const, label: "Personal Info", icon: User }, { id: "password" as const, label: "Password", icon: Lock }, { id: "pets" as const, label: "Manage Pets", icon: PawPrint }, { id: "agreements" as const, label: "Agreements", icon: FileCheck }, ]).map(({ id, label, icon: Icon }) => ( ))}
{tab === "personal" && } {tab === "password" && } {tab === "pets" && } {tab === "agreements" && }
); } function PersonalInfo({ readOnly }: { readOnly: boolean }) { const [form, setForm] = useState({ name: CUSTOMER.name, email: CUSTOMER.email, phone: CUSTOMER.phone, address: CUSTOMER.address, }); return (

Personal Information

{([ { key: "name" as const, label: "Full Name", type: "text" }, { key: "email" as const, label: "Email", type: "email" }, { key: "phone" as const, label: "Phone", type: "tel" }, { key: "address" as const, label: "Address", type: "text" }, ]).map(({ key, label, type }) => (
!readOnly && setForm({ ...form, [key]: e.target.value })} disabled={readOnly} className="w-full border border-stone-300 rounded-lg px-3 py-2 text-sm disabled:bg-stone-50 disabled:text-stone-500" />
))} {!readOnly && ( )}
); } function PasswordChange({ readOnly }: { readOnly: boolean }) { if (readOnly) { return (

Password changes are not available during staff impersonation.

); } return (

Change Password

); } function ManagePets({ readOnly }: { readOnly: boolean }) { const [editingPetId, setEditingPetId] = useState(null); const [showAddForm, setShowAddForm] = useState(false); const editingPet = editingPetId ? PETS.find(p => p.id === editingPetId) ?? undefined : undefined; if (editingPet || showAddForm) { return ( { setEditingPetId(null); setShowAddForm(false); }} onCancel={() => { setEditingPetId(null); setShowAddForm(false); }} /> ); } return (
{PETS.map(pet => (
{pet.photo}

{pet.name}

{pet.breed} ยท {pet.weight} lbs

{!readOnly && (
)}
))} {!readOnly && ( )}
); } function Agreements() { return (
{SIGNED_AGREEMENTS.map(agr => ( ))}
Document Date Signed
{agr.name} {new Date(agr.dateSigned).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" })}
); }