import type { Metadata } from "next"; import type { HTMLAttributes } from "react"; import { redirect } from "next/navigation"; import { Container, SectionHeading, Button, FormPanel } from "@/components/ui"; import { HexMark } from "@/components/honeycomb"; import { BackLink } from "@/components/back-link"; import { AccountEmptyState, AddressIcon } from "@/components/account-ui"; import { getCurrentCustomer } from "@/lib/auth"; import { getAddressesForCustomer } from "@/lib/account-data"; import { addAddressAction, deleteAddressAction, setDefaultAddressAction } from "../actions"; import { getLocale } from "@/i18n/locale"; import { getDictionary } from "@/i18n/get-dictionary"; export const metadata: Metadata = { title: "Meine Adressen" }; export const dynamic = "force-dynamic"; export default async function KontoAdressenPage() { const t = getDictionary(await getLocale()); const customer = await getCurrentCustomer(); if (!customer) redirect("/konto"); const addresses = await getAddressesForCustomer(customer.id); return (
{addresses.map((address) => (
{address.isDefault ? ( {t.addressesPage.standard} ) : null}

{address.label}

{address.firstName} {address.lastName}
{address.street}
{address.zip} {address.city}

{!address.isDefault ? (
) : null}
))} {addresses.length === 0 ? ( } title={t.addressesPage.emptyTitle} description={t.addressesPage.emptyDescription} /> ) : null}

{t.addressesPage.addNewHeading}

); } function Field({ name, label, defaultValue, autoComplete, inputMode, required = false, }: { name: string; label: string; defaultValue?: string; /** Browser-/Mobil-Autofill fuer Adressfelder — dieselben Tokens wie im Checkout-Formular. */ autoComplete?: string; inputMode?: HTMLAttributes["inputMode"]; required?: boolean; }) { return ( ); }