diff --git a/src/pages/BookingWidgetPage.tsx b/src/pages/BookingWidgetPage.tsx index db4c9a5..b9d3ac1 100644 --- a/src/pages/BookingWidgetPage.tsx +++ b/src/pages/BookingWidgetPage.tsx @@ -76,6 +76,7 @@ interface MockRoom { area: number // m² description: string photos: { bg: string; emoji: string; label: string }[] + photoUrls: string[] // real photo URLs (empty for mock rooms) amenities: string[] has3dTour: boolean } @@ -90,7 +91,7 @@ const MOCK_ROOMS: MockRoom[] = [ { bg: 'from-amber-100 to-amber-200', emoji: '🪟', label: 'Окно' }, ], amenities: ['Wi-Fi', 'TV', 'Кондиционер', 'Фен', 'Мини-холодильник', 'Сейф'], - has3dTour: false, + photoUrls: [], has3dTour: false, }, { id: 'r2', name: 'Комфорт', beds: 1, guests: 2, price: 6500, area: 30, @@ -102,7 +103,7 @@ const MOCK_ROOMS: MockRoom[] = [ { bg: 'from-lime-100 to-lime-200', emoji: '🛋️', label: 'Зона отдыха' }, ], amenities: ['Wi-Fi', 'TV', 'Кондиционер', 'Мини-бар', 'Халат', 'Фен', 'Сейф', 'Кофемашина'], - has3dTour: false, + photoUrls: [], has3dTour: false, }, { id: 'r3', name: 'Делюкс', beds: 2, guests: 3, price: 8900, area: 45, @@ -115,7 +116,7 @@ const MOCK_ROOMS: MockRoom[] = [ { bg: 'from-cyan-100 to-cyan-200', emoji: '🍽️', label: 'Мини-кухня' }, ], amenities: ['Wi-Fi', 'Smart TV', 'Кондиционер', 'Джакузи', 'Мини-бар', 'Халат', 'Тапочки', 'Кофемашина', 'Сейф', 'Балкон'], - has3dTour: true, + photoUrls: [], has3dTour: true, }, { id: 'r4', name: 'Пентхаус', beds: 2, guests: 4, price: 15000, area: 80, @@ -129,7 +130,7 @@ const MOCK_ROOMS: MockRoom[] = [ { bg: 'from-amber-100 to-yellow-100', emoji: '🍸', label: 'Бар' }, ], amenities: ['Wi-Fi 1Гбит', 'Smart TV 75"', 'Кондиционер', 'Сауна', 'Мини-бар', 'Джакузи', 'Терраса', 'Дворецкий', 'Кофемашина', 'Халат', 'Тапочки', 'Сейф'], - has3dTour: true, + photoUrls: [], has3dTour: true, }, ] @@ -239,9 +240,12 @@ export function WidgetPreview({ settings, slug, realRooms, realCategories, realR // Use real rooms if available, otherwise mock const displayRooms = realRooms && realRooms.length > 0 ? realRooms.map(r => ({ - id: r.id, name: r.name || `Номер ${r.number}`, beds: 1, + id: r.id, name: r.name || `Номер ${r.number}`, beds: 0, guests: r.maxGuests, price: r.baseRate, area: 0, - description: r.description, photos: [], amenities: r.amenities, + description: r.description ?? '', + photos: [] as { bg: string; emoji: string; label: string }[], + photoUrls: r.photos ?? [], + amenities: r.amenities ?? [], has3dTour: false, })) : MOCK_ROOMS @@ -966,8 +970,11 @@ export function WidgetPreview({ settings, slug, realRooms, realCategories, realR {displayRooms.map(room => { const isExpanded = expandedRoom === room.id const isSelected = selected === room.id - const curPhoto = photoIndex[room.id] ?? 0 + const hasRealPhotos = room.photoUrls.length > 0 + const totalPhotos = hasRealPhotos ? room.photoUrls.length : room.photos.length + const curPhoto = Math.min(photoIndex[room.id] ?? 0, Math.max(0, totalPhotos - 1)) const photo = room.photos[curPhoto] ?? { bg: 'from-slate-200 to-slate-300', emoji: '🛏️', label: 'Фото' } + const curPhotoUrl = hasRealPhotos ? room.photoUrls[curPhoto] : null return (
{room.name}
@@ -997,13 +1008,14 @@ export function WidgetPreview({ settings, slug, realRooms, realCategories, realR