import { Suspense } from "react" import { getHotelData } from "@/lib/trpc/memoizedRequests" import { mapFacilityToIcon } from "@/components/ContentType/HotelPage/data" import ImageGallery from "@/components/ImageGallery" import Alert from "@/components/TempDesignSystem/Alert" import Divider from "@/components/TempDesignSystem/Divider" import Body from "@/components/TempDesignSystem/Text/Body" import Caption from "@/components/TempDesignSystem/Text/Caption" import Title from "@/components/TempDesignSystem/Text/Title" import { getIntl } from "@/i18n" import { getSingleDecimal } from "@/utils/numberFormatting" import ReadMore from "../../ReadMore" import TripAdvisorChip from "../../TripAdvisorChip" import { NoRoomsAlert } from "./NoRoomsAlert" import styles from "./hotelInfoCard.module.css" import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate" import type { Lang } from "@/constants/languages" type Props = { hotelId: number lang: Lang fromDate: Date toDate: Date adultCount: number childArray?: Child[] } export default async function HotelInfoCard({ hotelId, lang, ...props }: Props) { const hotelData = await getHotelData({ hotelId: hotelId.toString(), language: lang, }) const hotelAttributes = hotelData?.data.attributes const intl = await getIntl() const sortedFacilities = hotelAttributes?.detailedFacilities .sort((a, b) => b.sortOrder - a.sortOrder) .slice(0, 5) return (
{hotelAttributes && (
{hotelAttributes.ratings?.tripAdvisor && ( )}
{hotelAttributes.name}
{intl.formatMessage( { id: "{address}, {city} ∙ {distanceToCityCentreInKm} km to city center", }, { address: hotelAttributes.address.streetAddress, city: hotelAttributes.address.city, distanceToCityCentreInKm: getSingleDecimal( hotelAttributes.location.distanceToCentre / 1000 ), } )} {hotelAttributes.hotelContent.texts.descriptions.medium}
{intl.formatMessage({ id: "At the hotel" })} {sortedFacilities?.map((facility) => { const IconComponent = mapFacilityToIcon(facility.id) return (
{IconComponent && ( )} {facility.name}
) })}
)} {hotelAttributes?.specialAlerts.map((alert) => { return (
) })}
) }