"use client"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { cn, formatTime } from "@/lib/utils"; import Link from "next/link"; interface Booking { id: string; startTime: string; endTime: string; status: string; court: { id: string; name: string; }; client: { id: string; name: string; } | null; } interface RecentBookingsProps { bookings: Booking[]; isLoading?: boolean; } const statusConfig: Record = { PENDING: { label: "Pendiente", className: "bg-yellow-100 text-yellow-700", }, CONFIRMED: { label: "Confirmada", className: "bg-blue-100 text-blue-700", }, COMPLETED: { label: "Completada", className: "bg-green-100 text-green-700", }, CANCELLED: { label: "Cancelada", className: "bg-red-100 text-red-700", }, NO_SHOW: { label: "No asistio", className: "bg-gray-100 text-gray-700", }, }; export function RecentBookings({ bookings, isLoading = false }: RecentBookingsProps) { if (isLoading) { return ; } return (
Reservas de Hoy
{bookings.length === 0 ? (

No hay reservas para hoy

) : (
{bookings.map((booking) => { const status = statusConfig[booking.status] || statusConfig.PENDING; const startTime = new Date(booking.startTime); const endTime = new Date(booking.endTime); return (
{/* Time */}

{formatTime(startTime)}

- {formatTime(endTime)}

{/* Divider */}
{/* Details */}

{booking.client?.name || "Sin cliente"}

{booking.court.name}

{/* Status badge */} {status.label}
); })}
)}
); } // Loading skeleton export function RecentBookingsSkeleton() { return (
{[1, 2, 3, 4, 5].map((i) => (
))}
); }