feat: SW-2398 UI updates booking codes * feat: SW-2398 UI updates booking codes * feat: SW-2398 Rate cards UI changes * feat: SW-2398 Optimized css with vars and chip code * feat: SW-2398 Optimized code as review comments * feat: SW-2398 Optimized code * feat: SW-2398 Optimized code and mobile UX * feat: SW-2398 Optimized code * feat: SW-2398 Fixed UI * feat: SW-2398 Updated animation Approved-by: Erik Tiekstra
78 lines
2.0 KiB
TypeScript
78 lines
2.0 KiB
TypeScript
import { alternativeHotels } from "@/constants/routes/hotelReservation"
|
|
|
|
import Alert from "@/components/TempDesignSystem/Alert"
|
|
import { getIntl } from "@/i18n"
|
|
import { getLang } from "@/i18n/serverContext"
|
|
|
|
import type { NoAvailabilityAlertProp } from "@/types/components/hotelReservation/selectHotel/noAvailabilityAlert"
|
|
import { AlertTypeEnum } from "@/types/enums/alert"
|
|
|
|
export default async function NoAvailabilityAlert({
|
|
hotelsLength,
|
|
bookingCode,
|
|
isAllUnavailable,
|
|
isAlternative,
|
|
isBookingCodeRateNotAvailable,
|
|
operaId,
|
|
}: NoAvailabilityAlertProp) {
|
|
const intl = await getIntl()
|
|
const lang = getLang()
|
|
|
|
if (isBookingCodeRateNotAvailable) {
|
|
const bookingCodeText = intl.formatMessage(
|
|
{
|
|
defaultMessage:
|
|
"We found no available rooms using this booking code ({bookingCode}). See available rates below.",
|
|
},
|
|
{ bookingCode }
|
|
)
|
|
return (
|
|
<Alert
|
|
type={AlertTypeEnum.Info}
|
|
heading={intl.formatMessage({
|
|
defaultMessage: "No availability",
|
|
})}
|
|
text={bookingCodeText}
|
|
/>
|
|
)
|
|
}
|
|
|
|
if (!isAllUnavailable) {
|
|
return null
|
|
}
|
|
|
|
if (hotelsLength === 1 && !isAlternative && operaId) {
|
|
return (
|
|
<Alert
|
|
type={AlertTypeEnum.Info}
|
|
heading={intl.formatMessage({
|
|
defaultMessage: "No availability",
|
|
})}
|
|
text={intl.formatMessage({
|
|
defaultMessage:
|
|
"Please try and change your search for this destination or see alternative hotels.",
|
|
})}
|
|
link={{
|
|
title: intl.formatMessage({
|
|
defaultMessage: "See alternative hotels",
|
|
}),
|
|
url: `${alternativeHotels(lang)}?hotel=${operaId}`,
|
|
keepSearchParams: true,
|
|
}}
|
|
/>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<Alert
|
|
type={AlertTypeEnum.Info}
|
|
heading={intl.formatMessage({
|
|
defaultMessage: "No availability",
|
|
})}
|
|
text={intl.formatMessage({
|
|
defaultMessage: "There are no rooms available that match your request.",
|
|
})}
|
|
/>
|
|
)
|
|
}
|