import { serverClient } from "@/lib/trpc/server" import tempHotelData from "@/server/routers/hotels/tempHotelData.json" import { mapFacilityToIcon } from "@/components/ContentType/HotelPage/data" import { ChevronRightIcon, PriceTagIcon, ScandicLogoIcon, } from "@/components/Icons" import TripAdvisorIcon from "@/components/Icons/TripAdvisor" import Image from "@/components/Image" import Button from "@/components/TempDesignSystem/Button" import Chip from "@/components/TempDesignSystem/Chip" import Link from "@/components/TempDesignSystem/Link" import Caption from "@/components/TempDesignSystem/Text/Caption" import Footnote from "@/components/TempDesignSystem/Text/Footnote" import Title from "@/components/TempDesignSystem/Text/Title" import { getIntl } from "@/i18n" import { getLang } from "@/i18n/serverContext" import styles from "./hotelCard.module.css" import { HotelCardProps } from "@/types/components/hotelReservation/selectHotel/hotelCardProps" export default async function HotelCard({ checkInDate, checkOutDate, hotelId, price, }: HotelCardProps) { const intl = await getIntl() // TODO: Use real endpoint. const hotel = tempHotelData.data.attributes const hotelResponse = await serverClient().hotel.hotel.get({ hotelId: hotelId.toString(), language: getLang(), }) if (!hotelResponse) return null const { data } = hotelResponse const sortedAmenities = data.attributes.detailedFacilities .sort((a, b) => b.sortOrder - a.sortOrder) .slice(0, 5) return (
{data.attributes.hotelContent.images.metaData.altText}
{data.attributes.ratings?.tripAdvisor.rating}
{hotel.name} {`${data.attributes.address.streetAddress}, ${data.attributes.address.city}`} {`${data.attributes.location.distanceToCentre} ${intl.formatMessage({ id: "km to city center" })}`}
{sortedAmenities.map((facility) => { const IconComponent = mapFacilityToIcon(facility.name) return (
{IconComponent && } {facility.name}
) })}
{intl.formatMessage({ id: "See hotel details" })}
{intl.formatMessage({ id: "Public price from" })} {price?.regularAmount} {price?.currency} / {intl.formatMessage({ id: "night" })} approx 280 eur
{intl.formatMessage({ id: "Member price from" })} {price?.memberAmount} {price?.currency} / {intl.formatMessage({ id: "night" })} approx 280 eur
) }