import { getTranslations, setRequestLocale } from 'next-intl/server' import { Link } from '@/i18n/routing' import Image from 'next/image' import { Users, Square, Info } from 'lucide-react' import { db } from '@/lib/db' import openinaryLoader from '@/lib/openinary-loader' export default async function RoomsPage({ params }: { params: Promise<{ locale: string }> }) { const { locale } = await params setRequestLocale(locale) const tNav = await getTranslations('nav') const tRooms = await getTranslations('rooms') const dbRooms = await db.room.findMany({ where: { available: true }, orderBy: { createdAt: 'asc' } }) // Size helper mapping based on room type const getRoomSize = (type: string) => { if (type === 'STUDIO_1_0') return '25m²' if (type === 'SUITE_1_1') return '45m²' return '20m²' } return (

{tRooms('title')}

{tRooms('description')}

{dbRooms.map((room) => { const name = locale === 'tr' ? room.nameTr : locale === 'de' ? room.nameDe : room.nameEn const description = locale === 'tr' ? room.descriptionTr : locale === 'de' ? room.descriptionDe : room.descriptionEn const image = room.imageUrl || 'https://images.unsplash.com/photo-1631049307264-da0ec9d70304?auto=format&fit=crop&q=80' const isExternal = image.startsWith('http') && !image.includes('media.ayris.tech') return (
{isExternal ? ( {name} ) : ( {name} )}

{name}

{description}

{room.capacity} {tRooms('capacity')}
{getRoomSize(room.type)}
{room.amenities.length} {tRooms('amenities')}
{room.price ? `${room.price}₺` : tRooms('ask_price')} {room.price ? '' : tRooms('per_night')}
{tRooms('details_btn')}
) })}
) }