"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: "Pending", className: "bg-yellow-100 text-yellow-700", }, CONFIRMED: { label: "Confirmed", className: "bg-blue-100 text-blue-700", }, COMPLETED: { label: "Completed", className: "bg-green-100 text-green-700", }, CANCELLED: { label: "Cancelled", className: "bg-red-100 text-red-700", }, NO_SHOW: { label: "No Show", className: "bg-gray-100 text-gray-700", }, }; export function RecentBookings({ bookings, isLoading = false }: RecentBookingsProps) { if (isLoading) { return ; } return (
Today's Bookings
{bookings.length === 0 ? (

No bookings for today

) : (
{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 || "Walk-in"}

{booking.court.name}

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