diff --git a/app/[lang]/(live)/(public)/[contentType]/[uid]/page.tsx b/app/[lang]/(live)/(public)/[contentType]/[uid]/page.tsx index 2a623f322..c803b8159 100644 --- a/app/[lang]/(live)/(public)/[contentType]/[uid]/page.tsx +++ b/app/[lang]/(live)/(public)/[contentType]/[uid]/page.tsx @@ -1,5 +1,5 @@ import { headers } from "next/headers" -import { notFound,redirect } from "next/navigation" +import { notFound, redirect } from "next/navigation" import { overview } from "@/constants/routes/myPages" import { isSignupPage } from "@/constants/routes/signup" @@ -7,16 +7,16 @@ import { env } from "@/env/server" import { getHotelPage } from "@/lib/trpc/memoizedRequests" import { auth } from "@/auth" -import DestinationOverviewPage from "@/components/ContentType/DestinationOverviewPage" import DestinationCityPage from "@/components/ContentType/DestinationPage/DestinationCityPage" import DestinationCountryPage from "@/components/ContentType/DestinationPage/DestinationCountryPage" +import DestinationOverviewPage from "@/components/ContentType/DestinationPage/DestinationOverviewPage" import HotelPage from "@/components/ContentType/HotelPage" import HotelSubpage from "@/components/ContentType/HotelSubpage" import LoyaltyPage from "@/components/ContentType/LoyaltyPage" import StartPage from "@/components/ContentType/StartPage" import CollectionPage from "@/components/ContentType/StaticPages/CollectionPage" import ContentPage from "@/components/ContentType/StaticPages/ContentPage" -import { getLang,setLang } from "@/i18n/serverContext" +import { getLang, setLang } from "@/i18n/serverContext" import { isValidSession } from "@/utils/session" import type { diff --git a/components/ContentType/DestinationOverviewPage/OverviewMapContainer/OverviewMap/index.tsx b/components/ContentType/DestinationOverviewPage/OverviewMapContainer/OverviewMap/index.tsx deleted file mode 100644 index 2e0684967..000000000 --- a/components/ContentType/DestinationOverviewPage/OverviewMapContainer/OverviewMap/index.tsx +++ /dev/null @@ -1,62 +0,0 @@ -"use client" -import { Map, type MapProps, useMap } from "@vis.gl/react-google-maps" -import { useIntl } from "react-intl" - -import { MinusIcon, PlusIcon } from "@/components/Icons" -import Button from "@/components/TempDesignSystem/Button" - -import styles from "./overviewMap.module.css" - -import type { OverviewMapProps } from "@/types/components/destinationOverviewPage/overviewMap/overviewMap" - -export default function OverviewMap({ mapId }: OverviewMapProps) { - const map = useMap() - const intl = useIntl() - - // Placeholder value, currently these coordinates are Stockholm - const defaultCenter = { - lat: 59.3293, - lng: 18.0686, - } - - const mapOptions: MapProps = { - defaultZoom: 4, - minZoom: 3, - defaultCenter: defaultCenter, - disableDefaultUI: true, - clickableIcons: false, - mapId: mapId, - } - - function zoomIn() { - const currentZoom = map && map.getZoom() - if (currentZoom) { - map.setZoom(currentZoom + 1) - } - } - - function zoomOut() { - const currentZoom = map && map.getZoom() - if (currentZoom) { - map.setZoom(currentZoom - 1) - } - } - - const zoomControls = ( -
- - -
- ) - - return ( -
- - {zoomControls} -
- ) -} diff --git a/components/ContentType/DestinationOverviewPage/OverviewMapContainer/OverviewMap/overviewMap.module.css b/components/ContentType/DestinationOverviewPage/OverviewMapContainer/OverviewMap/overviewMap.module.css deleted file mode 100644 index f87814dd1..000000000 --- a/components/ContentType/DestinationOverviewPage/OverviewMapContainer/OverviewMap/overviewMap.module.css +++ /dev/null @@ -1,13 +0,0 @@ -.mapContainer { - position: relative; - min-width: var(--max-width-page); - min-height: 700px; /* Placeholder value */ -} - -.buttonContainer { - position: absolute; - display: flex; - gap: var(--Spacing-x1); - right: 25px; - bottom: 25px; -} diff --git a/components/ContentType/DestinationOverviewPage/OverviewMapContainer/index.tsx b/components/ContentType/DestinationOverviewPage/OverviewMapContainer/index.tsx deleted file mode 100644 index c546c8363..000000000 --- a/components/ContentType/DestinationOverviewPage/OverviewMapContainer/index.tsx +++ /dev/null @@ -1,19 +0,0 @@ -"use client" -import { APIProvider } from "@vis.gl/react-google-maps" - -import InputForm from "./InputForm" -import OverviewMap from "./OverviewMap" - -import type { OverviewMapContainerProps } from "@/types/components/destinationOverviewPage/overviewMap/overviewMapContainer" - -export default function OverviewMapContainer({ - apiKey, - mapId, -}: OverviewMapContainerProps) { - return ( - - - - - ) -} diff --git a/components/ContentType/DestinationOverviewPage/HotelsSection/DestinationsList/Destination/destination.module.css b/components/ContentType/DestinationPage/DestinationOverviewPage/HotelsSection/DestinationsList/Destination/destination.module.css similarity index 100% rename from components/ContentType/DestinationOverviewPage/HotelsSection/DestinationsList/Destination/destination.module.css rename to components/ContentType/DestinationPage/DestinationOverviewPage/HotelsSection/DestinationsList/Destination/destination.module.css diff --git a/components/ContentType/DestinationOverviewPage/HotelsSection/DestinationsList/Destination/index.tsx b/components/ContentType/DestinationPage/DestinationOverviewPage/HotelsSection/DestinationsList/Destination/index.tsx similarity index 100% rename from components/ContentType/DestinationOverviewPage/HotelsSection/DestinationsList/Destination/index.tsx rename to components/ContentType/DestinationPage/DestinationOverviewPage/HotelsSection/DestinationsList/Destination/index.tsx diff --git a/components/ContentType/DestinationOverviewPage/HotelsSection/DestinationsList/destinationsList.module.css b/components/ContentType/DestinationPage/DestinationOverviewPage/HotelsSection/DestinationsList/destinationsList.module.css similarity index 100% rename from components/ContentType/DestinationOverviewPage/HotelsSection/DestinationsList/destinationsList.module.css rename to components/ContentType/DestinationPage/DestinationOverviewPage/HotelsSection/DestinationsList/destinationsList.module.css diff --git a/components/ContentType/DestinationOverviewPage/HotelsSection/DestinationsList/index.tsx b/components/ContentType/DestinationPage/DestinationOverviewPage/HotelsSection/DestinationsList/index.tsx similarity index 100% rename from components/ContentType/DestinationOverviewPage/HotelsSection/DestinationsList/index.tsx rename to components/ContentType/DestinationPage/DestinationOverviewPage/HotelsSection/DestinationsList/index.tsx diff --git a/components/ContentType/DestinationOverviewPage/HotelsSection/hotelsSection.module.css b/components/ContentType/DestinationPage/DestinationOverviewPage/HotelsSection/hotelsSection.module.css similarity index 100% rename from components/ContentType/DestinationOverviewPage/HotelsSection/hotelsSection.module.css rename to components/ContentType/DestinationPage/DestinationOverviewPage/HotelsSection/hotelsSection.module.css diff --git a/components/ContentType/DestinationOverviewPage/HotelsSection/index.tsx b/components/ContentType/DestinationPage/DestinationOverviewPage/HotelsSection/index.tsx similarity index 100% rename from components/ContentType/DestinationOverviewPage/HotelsSection/index.tsx rename to components/ContentType/DestinationPage/DestinationOverviewPage/HotelsSection/index.tsx diff --git a/components/ContentType/DestinationOverviewPage/OverviewMapContainer/InputForm/index.tsx b/components/ContentType/DestinationPage/DestinationOverviewPage/OverviewMapContainer/InputForm/index.tsx similarity index 100% rename from components/ContentType/DestinationOverviewPage/OverviewMapContainer/InputForm/index.tsx rename to components/ContentType/DestinationPage/DestinationOverviewPage/OverviewMapContainer/InputForm/index.tsx diff --git a/components/ContentType/DestinationOverviewPage/OverviewMapContainer/InputForm/inputFrom.module.css b/components/ContentType/DestinationPage/DestinationOverviewPage/OverviewMapContainer/InputForm/inputFrom.module.css similarity index 100% rename from components/ContentType/DestinationOverviewPage/OverviewMapContainer/InputForm/inputFrom.module.css rename to components/ContentType/DestinationPage/DestinationOverviewPage/OverviewMapContainer/InputForm/inputFrom.module.css diff --git a/components/ContentType/DestinationPage/DestinationOverviewPage/OverviewMapContainer/index.tsx b/components/ContentType/DestinationPage/DestinationOverviewPage/OverviewMapContainer/index.tsx new file mode 100644 index 000000000..6fddb64d3 --- /dev/null +++ b/components/ContentType/DestinationPage/DestinationOverviewPage/OverviewMapContainer/index.tsx @@ -0,0 +1,31 @@ +import { env } from "@/env/server" +import { getAllHotels } from "@/lib/trpc/memoizedRequests" + +import DynamicMap from "../../Map/DynamicMap" +import MapContent from "../../Map/MapContent" +import MapProvider from "../../Map/MapProvider" +import { getHotelMapMarkers, mapMarkerDataToGeoJson } from "../../Map/utils" +import InputForm from "./InputForm" + +export default async function OverviewMapContainer() { + const hotelData = await getAllHotels() + + if (!hotelData) { + return null + } + + const googleMapsApiKey = env.GOOGLE_STATIC_MAP_KEY + const googleMapId = env.GOOGLE_DYNAMIC_MAP_ID + + const markers = getHotelMapMarkers(hotelData) + const geoJson = mapMarkerDataToGeoJson(markers) + + return ( + + + + + + + ) +} diff --git a/components/ContentType/DestinationOverviewPage/destinationOverviewPage.module.css b/components/ContentType/DestinationPage/DestinationOverviewPage/destinationOverviewPage.module.css similarity index 96% rename from components/ContentType/DestinationOverviewPage/destinationOverviewPage.module.css rename to components/ContentType/DestinationPage/DestinationOverviewPage/destinationOverviewPage.module.css index 7dd5c6da3..bbbced58f 100644 --- a/components/ContentType/DestinationOverviewPage/destinationOverviewPage.module.css +++ b/components/ContentType/DestinationPage/DestinationOverviewPage/destinationOverviewPage.module.css @@ -3,6 +3,7 @@ display: grid; width: 100%; max-width: var(--max-width); + height: 700px; margin: 0 auto; } diff --git a/components/ContentType/DestinationOverviewPage/index.tsx b/components/ContentType/DestinationPage/DestinationOverviewPage/index.tsx similarity index 77% rename from components/ContentType/DestinationOverviewPage/index.tsx rename to components/ContentType/DestinationPage/DestinationOverviewPage/index.tsx index 851c4a800..416d6fd3e 100644 --- a/components/ContentType/DestinationOverviewPage/index.tsx +++ b/components/ContentType/DestinationPage/DestinationOverviewPage/index.tsx @@ -1,6 +1,5 @@ import { Suspense } from "react" -import { env } from "@/env/server" import { getDestinationOverviewPage, getDestinationsList, @@ -26,16 +25,11 @@ export default async function DestinationOverviewPage() { const { tracking, destinationOverviewPage } = pageData - const googleMapsApiKey = env.GOOGLE_STATIC_MAP_KEY - const googleMapId = env.GOOGLE_DYNAMIC_MAP_ID - return ( <> - {googleMapsApiKey ? ( -
- -
- ) : null} +
+ +
diff --git a/components/ContentType/DestinationPage/Map/DynamicMap/dynamicMap.module.css b/components/ContentType/DestinationPage/Map/DynamicMap/dynamicMap.module.css index baedbf86d..5e40f1fb0 100644 --- a/components/ContentType/DestinationPage/Map/DynamicMap/dynamicMap.module.css +++ b/components/ContentType/DestinationPage/Map/DynamicMap/dynamicMap.module.css @@ -36,6 +36,7 @@ .zoomButtons { display: grid; gap: var(--Spacing-x1); + margin-top: auto; } .closeButton { diff --git a/components/ContentType/DestinationPage/Map/DynamicMap/index.tsx b/components/ContentType/DestinationPage/Map/DynamicMap/index.tsx index 5aecfef20..3c048237c 100644 --- a/components/ContentType/DestinationPage/Map/DynamicMap/index.tsx +++ b/components/ContentType/DestinationPage/Map/DynamicMap/index.tsx @@ -80,17 +80,19 @@ export default function DynamicMap({ {children}
- + {onClose && ( + + )}