Merged in feat/SW-2505-alternative-hotels-link (pull request #2065)
fix(SW-2505): hide alternative hotels link when packages are added * fix(SW-2505): hide alternative hotels link when packages are added Approved-by: Bianca Widstam
This commit is contained in:
@@ -16,13 +16,29 @@ import { AlertTypeEnum } from "@/types/enums/alert"
|
||||
export default function NoAvailabilityAlert() {
|
||||
const lang = useLang()
|
||||
const intl = useIntl()
|
||||
const bookingCode = useRatesStore((state) => state.booking.bookingCode)
|
||||
const [bookingCode, selectedRooms, activeRoom] = useRatesStore((state) => [
|
||||
state.booking.bookingCode,
|
||||
state.rooms,
|
||||
state.activeRoom,
|
||||
])
|
||||
|
||||
const { isFetchingPackages, rooms } = useRoomContext()
|
||||
|
||||
const noAvailableRooms = rooms.every(
|
||||
(roomConfig) => roomConfig.status === AvailabilityEnum.NotAvailable
|
||||
)
|
||||
|
||||
const alertLink =
|
||||
selectedRooms[activeRoom].selectedPackages.length === 0
|
||||
? {
|
||||
title: intl.formatMessage({
|
||||
defaultMessage: "See alternative hotels",
|
||||
}),
|
||||
url: `${alternativeHotels(lang)}`,
|
||||
keepSearchParams: true,
|
||||
}
|
||||
: null
|
||||
|
||||
if (isFetchingPackages) {
|
||||
return null
|
||||
}
|
||||
@@ -39,13 +55,7 @@ export default function NoAvailabilityAlert() {
|
||||
defaultMessage: "No availability",
|
||||
})}
|
||||
text={text}
|
||||
link={{
|
||||
title: intl.formatMessage({
|
||||
defaultMessage: "See alternative hotels",
|
||||
}),
|
||||
url: `${alternativeHotels(lang)}`,
|
||||
keepSearchParams: true,
|
||||
}}
|
||||
link={alertLink}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
@@ -83,13 +93,7 @@ export default function NoAvailabilityAlert() {
|
||||
defaultMessage: "No availability",
|
||||
})}
|
||||
text={bookingCodeText}
|
||||
link={{
|
||||
title: intl.formatMessage({
|
||||
defaultMessage: "See alternative hotels",
|
||||
}),
|
||||
url: `${alternativeHotels(lang)}`,
|
||||
keepSearchParams: true,
|
||||
}}
|
||||
link={alertLink}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user