"use client" import { useSession } from "next-auth/react" import { useState } from "react" import { useIntl } from "react-intl" import { selectRate } from "@scandic-hotels/common/constants/routes/hotelReservation" import Caption from "@scandic-hotels/design-system/Caption" import { IconButton } from "@scandic-hotels/design-system/IconButton" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import Link from "@scandic-hotels/design-system/Link" import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton" import Subtitle from "@scandic-hotels/design-system/Subtitle" import { Typography } from "@scandic-hotels/design-system/Typography" import { FacilityToIcon } from "@/components/ContentType/HotelPage/data" import useLang from "@/hooks/useLang" import { isValidClientSession } from "@/utils/clientSession" import HotelPointsRow from "../../HotelCard/HotelPointsRow" import NoPriceAvailableCard from "../../HotelCard/NoPriceAvailableCard" import HotelCardDialogImage from "../HotelCardDialogImage" import styles from "./listingHotelCardDialog.module.css" import type { HotelPin } from "@/types/components/hotelReservation/selectHotel/map" interface ListingHotelCardProps { data: HotelPin handleClose: () => void } export default function ListingHotelCardDialog({ data, handleClose, }: ListingHotelCardProps) { const intl = useIntl() const lang = useLang() const [imageError, setImageError] = useState(false) const { data: session } = useSession() const isUserLoggedIn = isValidClientSession(session) const { bookingCode, name, publicPrice, memberPrice, currency, amenities, images, ratings, operaId, redemptionPrice, chequePrice, voucherPrice, hasEnoughPoints, } = data const firstImage = images[0]?.imageSizes?.small const altText = images[0]?.metaData?.altText const notEnoughPointsLabel = intl.formatMessage({ defaultMessage: "Not enough points", }) const shouldShowNotEnoughPoints = redemptionPrice && !hasEnoughPoints return (