From 8180271b0fb4ed1f62971660ccf19c6bc2c58adc Mon Sep 17 00:00:00 2001 From: Erik Tiekstra Date: Tue, 26 Aug 2025 05:58:25 +0000 Subject: [PATCH] fix(SW-3203): Added property id to pointOfInterestSchema to handle identical names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Approved-by: Matilda Landström Approved-by: Chuma Mcphoy (We Ahead) --- .../HotelMapPage/Sidebar/index.tsx | 36 ++++++++++--------- .../types/components/hotelPage/map/sidebar.ts | 10 ------ .../InteractiveMap/PoiMapMarkers/index.tsx | 16 ++++----- .../lib/routers/hotels/schemas/hotel/poi.ts | 1 + 4 files changed, 29 insertions(+), 34 deletions(-) delete mode 100644 apps/scandic-web/types/components/hotelPage/map/sidebar.ts diff --git a/apps/scandic-web/components/ContentType/HotelMapPage/Sidebar/index.tsx b/apps/scandic-web/components/ContentType/HotelMapPage/Sidebar/index.tsx index a60865ce5..64e8d29ac 100644 --- a/apps/scandic-web/components/ContentType/HotelMapPage/Sidebar/index.tsx +++ b/apps/scandic-web/components/ContentType/HotelMapPage/Sidebar/index.tsx @@ -13,9 +13,18 @@ import { translatePOIGroup } from "./util" import styles from "./sidebar.module.css" -import type { SidebarProps } from "@/types/components/hotelPage/map/sidebar" +import type { PointOfInterest } from "@scandic-hotels/trpc/types/hotel" + import type { Coordinates } from "@/types/components/maps/coordinates" +interface SidebarProps { + hotelName: string + pointsOfInterest: PointOfInterest[] + activePoi: PointOfInterest["name"] | null + onActivePoiChange: (poi: PointOfInterest["name"] | null) => void + coordinates: Coordinates +} + export default function Sidebar({ activePoi, hotelName, @@ -62,23 +71,23 @@ export default function Sidebar({ } } - function handleMouseEnter(poiName: string | undefined) { - if (!poiName) return + function handleMouseEnter(poiId: string | undefined) { + if (!poiId) return if (!isClicking) { - onActivePoiChange(poiName) + onActivePoiChange(poiId) } } function handlePoiClick( - poiName: string | undefined, + poiId: string | undefined, poiCoordinates: Coordinates ) { - if (!poiName || !poiCoordinates) return + if (!poiId || !poiCoordinates) return setIsClicking(true) toggleFullScreenSidebar() - onActivePoiChange(poiName) + onActivePoiChange(poiId) moveToPoi(poiCoordinates) setTimeout(() => { setIsClicking(false) @@ -130,18 +139,13 @@ export default function Sidebar({