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:
Hrishikesh Vaipurkar
2025-06-27 08:05:26 +00:00
parent 01ca2b4897
commit edca03decf
9 changed files with 29 additions and 7 deletions

View File

@@ -15,7 +15,10 @@ import { Divider } from "@scandic-hotels/design-system/Divider"
import HotelLogoIcon from "@scandic-hotels/design-system/Icons/HotelLogoIcon"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { selectHotelMap } from "@/constants/routes/hotelReservation"
import {
alternativeHotelsMap,
selectHotelMap,
} from "@/constants/routes/hotelReservation"
import { useHotelsMapStore } from "@/stores/hotels-map"
import BookingCodeChip from "@/components/BookingCodeChip"
@@ -49,6 +52,7 @@ function HotelCard({
state = "default",
type = HotelCardListingTypeEnum.PageListing,
bookingCode = "",
isAlternative,
}: HotelCardProps) {
const params = useParams()
const searchParams = useSearchParams()
@@ -65,11 +69,14 @@ function HotelCard({
state,
})
const mapUrl = isAlternative
? alternativeHotelsMap(lang)
: selectHotelMap(lang)
const handleAddressClick = (event: React.MouseEvent) => {
event.preventDefault()
disengage() // Disengage the current hotel to avoid the hover state from being active when clicking on the address
activate(hotel.name)
router.push(`${selectHotelMap(lang)}?${searchParams.toString()}`)
router.push(`${mapUrl}?${searchParams.toString()}`)
}
const addressStr = `${hotel.address.streetAddress}, ${hotel.address.city}`
@@ -126,7 +133,7 @@ function HotelCard({
size="small"
textDecoration="underline"
onClick={handleAddressClick}
href={selectHotelMap(lang)}
href={mapUrl}
keepSearchParams
aria-label={intl.formatMessage({
defaultMessage: "See on map",