@bailierich/booking-components 2.1.3 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -469,6 +469,7 @@ export function BookingFlow({
|
|
|
469
469
|
onDateSelect(date);
|
|
470
470
|
}
|
|
471
471
|
}}
|
|
472
|
+
isPreview={isPreview}
|
|
472
473
|
cyclePhases={cyclePhases} // NEW: Pass cycle phases for cycle-aware booking
|
|
473
474
|
selectedService={selectedServiceData} // NEW: Pass selected service for summary card
|
|
474
475
|
addons={addons} // NEW: Pass addons for selection
|
|
@@ -16,6 +16,7 @@ interface DateSelectionProps {
|
|
|
16
16
|
secondary: string;
|
|
17
17
|
};
|
|
18
18
|
cyclePhases?: Record<string, string>; // Map of date -> phase ('avoid', 'caution', 'optimal', 'neutral')
|
|
19
|
+
isPreview?: boolean; // true = admin preview with mock dates, false/undefined = live mode
|
|
19
20
|
selectedService?: any; // Selected service object with name, price, description, duration
|
|
20
21
|
addons?: any[]; // Available addons
|
|
21
22
|
selectedAddons?: string[]; // Selected addon IDs
|
|
@@ -68,6 +69,7 @@ export function DateSelection({
|
|
|
68
69
|
settings,
|
|
69
70
|
colors,
|
|
70
71
|
cyclePhases,
|
|
72
|
+
isPreview,
|
|
71
73
|
selectedService,
|
|
72
74
|
addons = [],
|
|
73
75
|
selectedAddons = [],
|
|
@@ -87,12 +89,14 @@ export function DateSelection({
|
|
|
87
89
|
const calendarView = settings.calendarView || 'month';
|
|
88
90
|
const headerText = settings.headerContent?.value || 'Select a Date';
|
|
89
91
|
|
|
90
|
-
//
|
|
91
|
-
const isPreviewMode =
|
|
92
|
+
// Preview mode: admin studio shows mock dates. Live mode: show real dates or loading.
|
|
93
|
+
const isPreviewMode = isPreview === true;
|
|
94
|
+
const isLoadingDates = !isPreview && (!availableDates || availableDates.length === 0);
|
|
92
95
|
|
|
93
|
-
// Use mock dates in preview mode, real dates
|
|
96
|
+
// Use mock dates only in preview mode, otherwise use real dates
|
|
94
97
|
const effectiveDates = useMemo(() => {
|
|
95
|
-
|
|
98
|
+
if (isPreviewMode) return generateMockDates();
|
|
99
|
+
return availableDates || [];
|
|
96
100
|
}, [isPreviewMode, availableDates]);
|
|
97
101
|
|
|
98
102
|
// Determine initial month from first available date (today or later)
|
|
@@ -375,7 +379,27 @@ export function DateSelection({
|
|
|
375
379
|
</motion.div>
|
|
376
380
|
)}
|
|
377
381
|
|
|
378
|
-
{
|
|
382
|
+
{isLoadingDates ? (
|
|
383
|
+
<div className="space-y-4 animate-pulse">
|
|
384
|
+
<div className="border border-gray-200 rounded-lg p-4">
|
|
385
|
+
<div className="flex items-center justify-between mb-4">
|
|
386
|
+
<div className="h-4 w-4 rounded" style={{ backgroundColor: '#e5e7eb' }} />
|
|
387
|
+
<div className="h-5 rounded w-32" style={{ backgroundColor: '#e5e7eb' }} />
|
|
388
|
+
<div className="h-4 w-4 rounded" style={{ backgroundColor: '#e5e7eb' }} />
|
|
389
|
+
</div>
|
|
390
|
+
<div className="grid grid-cols-7 gap-2">
|
|
391
|
+
{['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'].map(day => (
|
|
392
|
+
<div key={day} className="text-center text-xs font-medium py-2 opacity-60">
|
|
393
|
+
{day}
|
|
394
|
+
</div>
|
|
395
|
+
))}
|
|
396
|
+
{Array.from({ length: 35 }).map((_, i) => (
|
|
397
|
+
<div key={i} className="aspect-square rounded-lg" style={{ backgroundColor: '#e5e7eb', opacity: 0.3 + (i % 3) * 0.2 }} />
|
|
398
|
+
))}
|
|
399
|
+
</div>
|
|
400
|
+
</div>
|
|
401
|
+
</div>
|
|
402
|
+
) : calendarView === 'month' ? (
|
|
379
403
|
<div className="border border-gray-200 rounded-lg p-4">
|
|
380
404
|
<div className="flex items-center justify-between mb-4">
|
|
381
405
|
<button
|