fix the capacity and NaN participants issue

This commit is contained in:
Asya Vee
2025-08-27 02:50:13 +04:00
parent 459289df2d
commit ff6de00988
9 changed files with 248 additions and 68 deletions

View File

@@ -4,7 +4,7 @@ import { useTranslations } from 'next-intl';
import { TimeSlot } from '@/types/bookings';
interface TimeSlotSelectorProps {
timeSlots: TimeSlot[];
timeSlots: (TimeSlot & { availableCapacity?: number })[];
selectedTimeSlot: string;
onTimeSlotChange: (slotId: string) => void;
loading?: boolean;
@@ -85,6 +85,11 @@ const TimeSlotSelector: React.FC<TimeSlotSelectorProps> = ({
<div className="font-medium">
{formattedTime}
</div>
{slot.availableCapacity !== undefined && slot.availableCapacity > 0 && (
<div className="text-xs mt-1 text-green-600">
{slot.availableCapacity} spots left
</div>
)}
{!isAvailable && (
<div className="text-xs mt-1">Unavailable</div>
)}