Merged in fix/SW-2884-select-hotel-page-users-are-di (pull request #2438)
fix: SW-2884 Fixed Alternative hotels map navigation issues * fix: SW-2884 Fixed Alternative hotels map navigation issues * fix: SW-2884 Optmized code Approved-by: Arvid Norlin
This commit is contained in:
@@ -6,7 +6,10 @@ import { useMediaQuery } from "usehooks-ts"
|
||||
|
||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||
|
||||
import { selectHotel } from "@/constants/routes/hotelReservation"
|
||||
import {
|
||||
alternativeHotels,
|
||||
selectHotel,
|
||||
} from "@/constants/routes/hotelReservation"
|
||||
import { useBookingCodeFilterStore } from "@/stores/bookingCode-filter"
|
||||
import { useHotelFilterStore } from "@/stores/hotel-filters"
|
||||
import { useHotelsMapStore } from "@/stores/hotels-map"
|
||||
@@ -41,6 +44,7 @@ export default function SelectHotelContent({
|
||||
filterList,
|
||||
bookingCode,
|
||||
isBookingCodeRateAvailable,
|
||||
isAlternativeHotels,
|
||||
}: Omit<SelectHotelMapProps, "apiKey">) {
|
||||
const lang = useLang()
|
||||
const intl = useIntl()
|
||||
@@ -122,6 +126,9 @@ export default function SelectHotelContent({
|
||||
[map, getHotelCards, isAboveMobile]
|
||||
)
|
||||
|
||||
const closeMapUrl = isAlternativeHotels
|
||||
? alternativeHotels(lang)
|
||||
: selectHotel(lang)
|
||||
const closeButton = (
|
||||
<Button
|
||||
intent="inverted"
|
||||
@@ -130,7 +137,7 @@ export default function SelectHotelContent({
|
||||
className={styles.closeButton}
|
||||
asChild
|
||||
>
|
||||
<Link href={selectHotel(lang)} keepSearchParams prefetch>
|
||||
<Link href={closeMapUrl} keepSearchParams prefetch>
|
||||
<MaterialIcon icon="close" size={20} color="CurrentColor" />
|
||||
{intl.formatMessage({
|
||||
defaultMessage: "Close the map",
|
||||
@@ -164,7 +171,7 @@ export default function SelectHotelContent({
|
||||
className={styles.filterContainerCloseButton}
|
||||
asChild
|
||||
>
|
||||
<Link href={selectHotel(lang)} keepSearchParams>
|
||||
<Link href={closeMapUrl} keepSearchParams>
|
||||
<MaterialIcon icon="arrow_back" color="CurrentColor" size={20} />
|
||||
{intl.formatMessage({ defaultMessage: "Back" })}
|
||||
</Link>
|
||||
|
||||
Reference in New Issue
Block a user