Merged in fix/BOOK-130-booking-code-filtering (pull request #2868)
fix(BOOK-130): update booking code filtering on map view and filter and sort modal * fix(BOOK-130): update booking code filtering on map view and filter and sort modal * fix(BOOK-130): change name of filteredIds * fix(BOOK-130): add initial value reduce Approved-by: Joakim Jäderberg Approved-by: Anton Gunnarsson
This commit is contained in:
@@ -38,14 +38,12 @@ export enum HotelCardListingTypeEnum {
|
||||
|
||||
type HotelCardListingProps = {
|
||||
hotelData: HotelResponse[]
|
||||
unfilteredHotelCount: number
|
||||
type?: HotelCardListingTypeEnum
|
||||
isAlternative?: boolean
|
||||
}
|
||||
|
||||
export default function HotelCardListing({
|
||||
hotelData,
|
||||
unfilteredHotelCount,
|
||||
type = HotelCardListingTypeEnum.PageListing,
|
||||
isAlternative,
|
||||
}: HotelCardListingProps) {
|
||||
@@ -82,6 +80,10 @@ export default function HotelCardListing({
|
||||
isBookingCodeRateAvailable &&
|
||||
activeCodeFilter === BookingCodeFilterEnum.Discounted
|
||||
|
||||
const unfilteredHotelCount = showOnlyBookingCodeRates
|
||||
? hotelData.filter((hotel) => hotel.availability.bookingCode).length
|
||||
: hotelData.length
|
||||
|
||||
const hotels = useMemo(() => {
|
||||
const sortedHotels = getSortedHotels({
|
||||
hotels: hotelData,
|
||||
@@ -124,8 +126,10 @@ export default function HotelCardListing({
|
||||
}, [activeHotel, type])
|
||||
|
||||
useEffect(() => {
|
||||
setResultCount(hotels.length, unfilteredHotelCount)
|
||||
}, [hotels, setResultCount, unfilteredHotelCount])
|
||||
if (type === HotelCardListingTypeEnum.PageListing) {
|
||||
setResultCount(hotels.length, unfilteredHotelCount)
|
||||
}
|
||||
}, [hotels, setResultCount, type, unfilteredHotelCount])
|
||||
|
||||
function isHotelActiveInMapView(hotelName: string): boolean {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user