import {Phone} from 'lucide-react'; import type {ChannelLink} from '@o2o/shared'; import {useSite} from '@site/lib/site-context'; import {bookingActionLabel, bookingLinks, sectionName, unitSpec, unitViews, type UnitView} from '@site/lib/derive'; import {Carousel, CarouselSlide} from '@site/lib/ui'; import {SectionHead} from './SectionHead'; export function Rooms() { const payload = useSite(); const units = unitViews(payload); const spec = unitSpec(payload); const booking = bookingLinks(payload)[0]; if (units.length === 0) return null; return (
{units.map((unit, i) => ( ))}
); } function UnitPanel({ unit, no, booking, phone, }: { unit: UnitView; no: number; booking?: ChannelLink; phone?: string; }) { return (
{unit.images.length > 0 && ( {unit.images.map((image) => (
{image.alt}
))}
)}

{String(no).padStart(2, '0')}

{unit.name}

{unit.intro && (

{unit.intro}

)} {unit.rows.length > 0 && (
{unit.rows.map((row) => (
{row.label}
{row.value}
))}
)} {unit.chips.length > 0 && ( )} {(booking || phone) && (
{booking && ( {bookingActionLabel(booking)} )} {phone && ( {phone} )}
)}
); }