import { useEffect, useState } from "react"; import { Card, CardContent } from "@/components/ui/card"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@/components/ui/table"; import { apiGet } from "@/lib/api"; import { useAuthStore } from "@/store/authStore"; import type { CustomerRow } from "@/lib/types"; import { formatDate } from "@/lib/format"; export function CustomersPage() { const selectedPropertyId = useAuthStore((s) => s.selectedPropertyId); const [rows, setRows] = useState([]); useEffect(() => { apiGet<{ data: CustomerRow[] }>("/customers").then((r) => setRows(r.data) ); }, [selectedPropertyId]); return (

Customers

Aggregated from bookings (read-only mock).

Name Email Bookings Last stay {rows.map((c) => ( {c.name} {c.email} {c.bookingCount} {c.lastStay ? formatDate(c.lastStay) : "—"} ))}
{rows.map((c) => (

{c.name}

{c.email}

{c.bookingCount} bookings {c.lastStay && ` · last ${formatDate(c.lastStay)}`}

))}
); }