"use client" import { useState } from "react" import { useIntl } from "react-intl" import { selectRate } from "@scandic-hotels/common/constants/routes/hotelReservation" import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import { FacilityToIcon } from "@scandic-hotels/design-system/FacilityToIcon" import { HotelCardDialogImage } from "@scandic-hotels/design-system/HotelCard/HotelCardDialogImage" import { HotelPointsRow } from "@scandic-hotels/design-system/HotelCard/HotelPointsRow" import { NoPriceAvailableCard } from "@scandic-hotels/design-system/HotelCard/NoPriceAvailableCard" import { IconButton } from "@scandic-hotels/design-system/IconButton" import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton" import Link from "@scandic-hotels/design-system/OldDSLink" import { Typography } from "@scandic-hotels/design-system/Typography" import { useGetPointsCurrency } from "../../bookingFlowConfig/bookingFlowConfigContext" import { useIsLoggedIn } from "../../hooks/useIsLoggedIn" import useLang from "../../hooks/useLang" import styles from "./listingHotelCardDialog.module.css" import type { HotelPin } from "../HotelCardDialogListing/utils" interface ListingHotelCardProps { data: HotelPin handleClose: () => void } export default function ListingHotelCardDialog({ data, handleClose, }: ListingHotelCardProps) { const intl = useIntl() const lang = useLang() const pointsCurrency = useGetPointsCurrency() const [imageError, setImageError] = useState(false) const isUserLoggedIn = useIsLoggedIn() const { bookingCode, name, publicPrice, memberPrice, currency, amenities, images, ratings, operaId, redemptionPrice, chequePrice, voucherPrice, hasEnoughPoints, } = data const imageSrc = images[0]?.src const altText = images[0]?.altText || images[0]?.altText_En const notEnoughPointsLabel = intl.formatMessage({ id: "booking.notEnoughPoints", defaultMessage: "Not enough points", }) const shouldShowNotEnoughPoints = redemptionPrice && !hasEnoughPoints const label = redemptionPrice ? intl.formatMessage({ id: "hotelCard.availableRates", defaultMessage: "Available rates", }) : chequePrice || voucherPrice ? intl.formatMessage({ id: "common.from", defaultMessage: "From", }) : intl.formatMessage({ id: "listingHotelCardDialog.perNightFrom", defaultMessage: "Per night from", }) return (
{name}
{label}
{publicPrice} {currency}
/
{publicPrice} {currency}
{intl.formatMessage( { id: "common.priceCurrency", defaultMessage: "{price} {currency}", }, { price: memberPrice, currency, } )}
{formatPrice(intl, voucherPrice, currency)}