Merged in fix/BOOK-130-filter-booking-code-count (pull request #2856)

fix(BOOK-130): update filter counts when using booking code

* fix(BOOK-130): update filter counts when using booking code

* fix(BOOK-130): change message


Approved-by: Erik Tiekstra
Approved-by: Matilda Landström
This commit is contained in:
Bianca Widstam
2025-09-24 08:50:30 +00:00
parent 490013be62
commit aa99a5d4f6
4 changed files with 56 additions and 9 deletions

View File

@@ -7,6 +7,7 @@ import { alternativeHotels } from "@scandic-hotels/common/constants/routes/hotel
import { Alert } from "@scandic-hotels/design-system/Alert"
import useLang from "../../hooks/useLang"
import { useHotelFilterStore } from "../../stores/hotel-filters"
import type { Hotel } from "@scandic-hotels/trpc/types/hotel"
@@ -30,6 +31,26 @@ export default function NoAvailabilityAlert({
const intl = useIntl()
const lang = useLang()
const { resultCount, activeFilters } = useHotelFilterStore((state) => ({
resultCount: state.resultCount,
activeFilters: state.activeFilters,
}))
if (activeFilters.length > 0 && resultCount === 0) {
return (
<Alert
type={AlertTypeEnum.Info}
heading={intl.formatMessage({
defaultMessage: "No hotels match your filters",
})}
text={intl.formatMessage({
defaultMessage:
"It looks like no hotels match your filters. Try adjusting your search to find the perfect stay.",
})}
/>
)
}
if (bookingCode && isBookingCodeRateNotAvailable && hotelsLength > 0) {
const bookingCodeText = intl.formatMessage(
{