import type { Metadata } from "next"; import Link from "next/link"; import { getCurrentCustomer } from "@/lib/auth/customer"; import { getCustomerBookings } from "@/lib/booking/queries"; import { BookingCard } from "@/components/booking/BookingCard"; export const metadata: Metadata = { title: "Mein Konto" }; export default async function KontoOverviewPage() { const customer = await getCurrentCustomer(); if (!customer) return null; // Layout already redirects; keeps TS happy. const bookings = await getCustomerBookings(customer.id); const pending = bookings.filter((b) => b.status === "pending"); const confirmed = bookings.filter((b) => b.status === "confirmed" && new Date(b.date) >= new Date()); const past = bookings.filter((b) => new Date(b.date) < new Date() || b.status === "rejected" || b.status === "cancelled"); return (

Deine Daten

Name
{customer.name}
E-Mail
{customer.email}

Offene Buchungsanfragen

{pending.length === 0 ? (

Keine offenen Anfragen.

) : (
{pending.map((b) => ( ))}
)}

Bestätigte Termine

{confirmed.length === 0 ? (

Noch keine bestätigten Termine.

) : (
{confirmed.map((b) => ( ))}
)}
{past.length > 0 && (
Alle Termine (inkl. vergangene) ansehen →
)}
); }