diff --git a/apps/scandic-web/components/ContentType/DestinationPage/DestinationOverviewPage/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/DestinationOverviewPage/index.tsx
index b6f7ba336..498107cc0 100644
--- a/apps/scandic-web/components/ContentType/DestinationPage/DestinationOverviewPage/index.tsx
+++ b/apps/scandic-web/components/ContentType/DestinationPage/DestinationOverviewPage/index.tsx
@@ -32,7 +32,7 @@ export default async function DestinationOverviewPage() {
- }>
+ }>
@@ -53,15 +53,15 @@ export function DestinationOverviewPageLoading() {
return (
<>
-
+
-
+
>
)
diff --git a/apps/scandic-web/components/Maps/InteractiveMap/index.tsx b/apps/scandic-web/components/Maps/InteractiveMap/index.tsx
index 4047fa32b..4d9779397 100644
--- a/apps/scandic-web/components/Maps/InteractiveMap/index.tsx
+++ b/apps/scandic-web/components/Maps/InteractiveMap/index.tsx
@@ -1,5 +1,7 @@
"use client"
+
import { Map, type MapProps, useMap } from "@vis.gl/react-google-maps"
+import { useEffect, useState } from "react"
import { useIntl } from "react-intl"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
@@ -20,11 +22,13 @@ export default function InteractiveMap({
hotelPins,
mapId,
closeButton,
+ fitBounds = true,
onTilesLoaded,
onActivePoiChange,
}: InteractiveMapProps) {
const intl = useIntl()
const map = useMap()
+ const [hasFittedBounds, setHasFittedBounds] = useState(false)
const mapOptions: MapProps = {
defaultZoom: 14,
@@ -47,6 +51,17 @@ export default function InteractiveMap({
}
}
+ useEffect(() => {
+ if (map && fitBounds && hotelPins?.length && !hasFittedBounds) {
+ const bounds = new google.maps.LatLngBounds()
+ hotelPins.forEach((marker) => {
+ bounds.extend(marker.coordinates)
+ })
+ map.fitBounds(bounds, 100)
+ setHasFittedBounds(true)
+ }
+ }, [map, fitBounds, hotelPins, hasFittedBounds])
+
return (