"use client" import { useIntl } from "react-intl" import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert" import { alternativeHotels } from "@scandic-hotels/common/constants/routes/hotelReservation" import { Alert } from "@scandic-hotels/design-system/Alert" import useLang from "../../hooks/useLang" import type { Hotel } from "@scandic-hotels/trpc/types/hotel" type NoAvailabilityAlertProps = { hotelsLength: number bookingCode?: string isAllUnavailable: boolean isAlternative?: boolean isBookingCodeRateNotAvailable?: boolean operaId: Hotel["operaId"] } export default function NoAvailabilityAlert({ hotelsLength, bookingCode, isAllUnavailable, isAlternative, isBookingCodeRateNotAvailable, operaId, }: NoAvailabilityAlertProps) { const intl = useIntl() const lang = useLang() if (bookingCode && isBookingCodeRateNotAvailable && hotelsLength > 0) { const bookingCodeText = intl.formatMessage( { defaultMessage: "We found no available rooms using this booking code ({bookingCode}). See available rates below.", }, { bookingCode } ) return ( ) } if (!isAllUnavailable) { return null } if (hotelsLength === 1 && !isAlternative && operaId) { return ( ) } return ( ) }