"use client"; import { SubCard } from "@/components/molecules/SubCard/SubCard"; import { MapPinIcon, PencilIcon, CheckIcon, XMarkIcon } from "@heroicons/react/24/outline"; import { AddressForm, type AddressFormProps } from "@/features/services/components"; import type { Address } from "@customer-portal/domain/customer"; import { getCountryName } from "@/shared/constants"; interface AddressCardProps { address: Address; isEditing: boolean; isSaving: boolean; error?: string | null; onEdit: () => void; onCancel: () => void; onSave: () => void; onAddressChange: NonNullable; } export function AddressCard({ address, isEditing, isSaving, error, onEdit, onCancel, onSave, onAddressChange, }: AddressCardProps) { const countryLabel = address.country ? (getCountryName(address.country) ?? address.country) : null; return (

Address Information

{!isEditing && ( )}
{isEditing ? (
onAddressChange(addr, true)} /> {error &&
{error}
}
) : (
{(address.address2 || address.address1) && (

{address.address2 || address.address1}

)} {address.address2 && address.address1 && (

{address.address1}

)} {(address.city || address.state || address.postcode) && (

{[address.city, address.state, address.postcode].filter(Boolean).join(", ")}

)} {countryLabel &&

{countryLabel}

}
)}
); }