"use client" import { useState } from "react" import { useIntl } from "react-intl" import { IconButton } from "../../../IconButton" import { Typography } from "../../../Typography" import { HotelCardDialogImage } from "../../HotelCardDialogImage" import { NoPriceAvailableCard } from "../../NoPriceAvailableCard" import { Lang } from "@scandic-hotels/common/constants/language" import { selectRate } from "@scandic-hotels/common/constants/routes/hotelReservation" import { useUrlWithSearchParam } from "@scandic-hotels/common/hooks/useUrlWithSearchParam" import ButtonLink from "../../../ButtonLink" import { FacilityToIcon } from "../../../FacilityToIcon" import { HotelPin } from "../../../Map/types" import { HotelPointsRow } from "../../HotelPointsRow" import { RoomPrice } from "../../RoomPrice" import styles from "./standaloneHotelCardDialog.module.css" interface StandaloneHotelCardProps { lang: Lang data: HotelPin isUserLoggedIn: boolean handleClose: () => void onClick?: () => void } export function StandaloneHotelCardDialog({ data, lang, handleClose, isUserLoggedIn, onClick, }: StandaloneHotelCardProps) { const intl = useIntl() const [imageError, setImageError] = useState(false) const { name, chequePrice, publicPrice, memberPrice, redemptionPrice, pointsType, voucherPrice, currency, amenities, image, ratings, operaId, hasEnoughPoints, } = data const notEnoughPointsLabel = intl.formatMessage({ id: "booking.notEnoughPoints", defaultMessage: "Not enough points", }) const shouldShowNotEnoughPoints = redemptionPrice && !hasEnoughPoints const selectRateUrl = useUrlWithSearchParam( { key: "hotel", value: operaId }, selectRate(lang) ) const showPriceCard = !!( publicPrice || memberPrice || redemptionPrice || voucherPrice || chequePrice ) return (

{name}

{amenities.slice(0, 3).map((facility) => { const Icon = ( ) return (
{Icon && Icon} {facility.name}
) })}
{showPriceCard ? ( <>

{redemptionPrice ? intl.formatMessage({ id: "hotelCard.availableRates", defaultMessage: "Available rates", }) : intl.formatMessage({ id: "common.from", defaultMessage: "From", })}

{chequePrice ? ( {chequePrice.additionalPricePerStay > 0 ? ( <> {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} + {chequePrice.additionalPricePerStay} {chequePrice.currency} ) : null} ) : null} {voucherPrice ? ( ) : null} {/* Show public price if: 1) user is not logged in, or 2) user is logged in but no member price is available (use of booking codes) */} {publicPrice && (!isUserLoggedIn || !memberPrice) ? ( ) : null} {memberPrice ? ( ) : null} {redemptionPrice ? ( ) : null}
{shouldShowNotEnoughPoints ? (
{notEnoughPointsLabel}
) : ( {intl.formatMessage({ id: "common.seeRooms", defaultMessage: "See rooms", })} )} ) : ( )}
) }