diff --git a/src/app/rooms/page.tsx b/src/app/rooms/page.tsx index 82b433b..a678c47 100644 --- a/src/app/rooms/page.tsx +++ b/src/app/rooms/page.tsx @@ -150,7 +150,22 @@ export default function RoomsPage() { const getPhoto = (room: Room, index: number): string | null => { if (!room.photos || room.photos.length === 0) return null; - return room.photos[Math.min(index, room.photos.length - 1)] || null; + const photo = room.photos[Math.min(index, room.photos.length - 1)]; + if (!photo) return null; + // If it's a URL with id= param, extract id; if it's base64, return as-is + if (photo.includes('id=')) { + return photo; + } + return photo; + }; + + const getPhotoId = (photo: string): number | null => { + if (!photo) return null; + if (photo.includes('id=')) { + const match = photo.match(/id=(\d+)/); + return match ? parseInt(match[1]) : null; + } + return null; }; const getActiveIndex = (room: Room): number => { @@ -317,13 +332,21 @@ export default function RoomsPage() { {/* ─── Main Image ─── */}
{activeSrc ? ( - + activeSrc.startsWith('data:') ? ( + {room.name} + ) : ( + + ) ) : (
No photo @@ -392,13 +415,21 @@ export default function RoomsPage() { }} > {p ? ( - + p.startsWith('data:') ? ( + + ) : ( + + ) ) : (
)} @@ -432,10 +463,12 @@ export default function RoomsPage() { whiteSpace: 'nowrap', }} > - + {amenity.icon_svg ? ( + + ) : null} {amenity.name}
))}