Merged in fix/SW-2964-hide-booking-code-switcher (pull request #2345)

fix: as a temporary fix hide booking code switcher and add a way to do a search without bookingcode

* fix: as a temporary fix hide booking code switcher and add a way to do a search without bookingcode


Approved-by: Linus Flood
This commit is contained in:
Joakim Jäderberg
2025-06-13 07:07:22 +00:00
parent ad3be1b4f4
commit 180a100140
7 changed files with 130 additions and 9 deletions

View File

@@ -0,0 +1,33 @@
import { usePathname, useRouter, useSearchParams } from "next/navigation"
import { useRatesStore } from "@/stores/select-rate"
import BookingCodeChip from "@/components/BookingCodeChip"
export function RemoveBookingCodeButton() {
const bookingCode = useRatesStore((state) => state.booking.bookingCode)
const router = useRouter()
const searchParams = useSearchParams()
const pathname = usePathname()
if (!bookingCode) {
return null
}
return (
<BookingCodeChip
bookingCode={bookingCode}
filledIcon
withCloseButton={true}
withText={false}
onClose={() => {
const newSearchParams = new URLSearchParams(searchParams)
newSearchParams.delete("bookingCode")
const url = `${pathname}?${newSearchParams.toString()}`
router.replace(url)
}}
/>
)
}

View File

@@ -11,6 +11,7 @@ import RoomPackageFilter from "./RoomPackageFilter"
import styles from "./roomsHeader.module.css"
import { AvailabilityEnum } from "@/types/components/hotelReservation/selectHotel/selectHotel"
import { RemoveBookingCodeButton } from "./RemoveBookingCodeButton/RemoveBookingCodeButton"
export default function RoomsHeader() {
const { isFetchingPackages, rooms, totalRooms } = useRoomContext()
@@ -55,8 +56,9 @@ export default function RoomsHeader() {
)}
</Typography>
<div className={styles.filters}>
<RemoveBookingCodeButton />
<RoomPackageFilter />
<BookingCodeFilter />
{/* <BookingCodeFilter /> */}
</div>
</div>
)