"use client"; import { useEffect, useState } from "react"; import { CountrySelect } from "@/components/CountrySelect"; type Address = { id: string; first_name: string; last_name: string; address_1: string; address_2?: string; city: string; province?: string; postal_code: string; country_code: string; phone?: string; }; const inputClass = "no-ring w-full rounded-xl border border-lightline px-6 py-3 shadow-lg text-lighttext transition-all duration-200 ease-in-out placeholder:text-lightsec hover:border-lightline-hover focus:border-lightline-focus dark:border-darkline dark:text-darktext dark:placeholder:text-darksec dark:hover:border-darkline-hover dark:focus:border-darkline-focus"; const emptyForm = { first_name: "", last_name: "", address_1: "", address_2: "", city: "", province: "", postal_code: "", country_code: "nl", phone: "", }; export function AddressesTab() { const [address, setAddress] = useState
(null); const [loading, setLoading] = useState(true); const [editing, setEditing] = useState(false); const [form, setForm] = useState(emptyForm); const [submitting, setSubmitting] = useState(false); const [error, setError] = useStateLoading address…
; } // Display mode: show the saved address (or empty state) with an Edit / Add button if (!editing) { if (address) { return ({address.first_name} {address.last_name}
{address.address_1} {address.address_2 ? `, ${address.address_2}` : ""}
{address.city} {address.province ? `, ${address.province}` : ""}, {address.postal_code},{" "} {address.country_code.toUpperCase()}
{address.phone && ({address.phone}
)}No address saved. Add one to speed up checkout.