'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 { CurrencyEnum } from '@scandic-hotels/common/constants/currency' 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 pointsCurrency?: CurrencyEnum } export function StandaloneHotelCardDialog({ data, lang, handleClose, isUserLoggedIn, onClick, pointsCurrency, }: StandaloneHotelCardProps) { const intl = useIntl() const [imageError, setImageError] = useState(false) const { name, chequePrice, publicPrice, memberPrice, redemptionPrice, 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 (
{redemptionPrice ? intl.formatMessage({ id: 'hotelCard.availableRates', defaultMessage: 'Available rates', }) : intl.formatMessage({ id: 'common.from', defaultMessage: 'From', })}