import { mapFacilityToIcon } from "@/components/ContentType/HotelPage/data" import ImageGallery from "@/components/ImageGallery" import SkeletonShimmer from "@/components/SkeletonShimmer" 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 { mapApiImagesToGalleryImages } from "@/utils/imageGallery" import { getSingleDecimal } from "@/utils/numberFormatting" import ReadMore from "../../ReadMore" import TripAdvisorChip from "../../TripAdvisorChip" import styles from "./hotelInfoCard.module.css" import type { HotelInfoCardProps } from "@/types/components/hotelReservation/selectRate/hotelInfoCard" export default async function HotelInfoCard({ hotelData }: HotelInfoCardProps) { const hotel = hotelData?.hotel const intl = await getIntl() const sortedFacilities = hotel?.detailedFacilities .sort((a, b) => b.sortOrder - a.sortOrder) .slice(0, 5) const galleryImages = mapApiImagesToGalleryImages(hotel?.galleryImages || []) return (
{hotel && (
{hotel.ratings?.tripAdvisor && ( )}
{hotel.name}
{intl.formatMessage( { id: "{address}, {city} ∙ {distanceToCityCenterInKm} km to city center", }, { address: hotel.address.streetAddress, city: hotel.address.city, distanceToCityCenterInKm: getSingleDecimal( hotel.location.distanceToCentre / 1000 ), } )} {hotel.hotelContent.texts.descriptions?.medium}
{intl.formatMessage({ id: "At the hotel" })} {sortedFacilities?.map((facility) => { const IconComponent = mapFacilityToIcon(facility.id) return (
{IconComponent && ( )} {facility.name}
) })}
)} {hotel?.specialAlerts.map((alert) => { return (
) })}
) } export function HotelInfoCardSkeleton() { return (
{[1, 2, 3, 4, 5]?.map((id) => { return (
) })}
) }