feat(BOOK-414): Added hotel branding themes to hotelpages
Approved-by: Matilda Landström
This commit is contained in:
@@ -1,32 +1,23 @@
|
||||
import { notFound } from "next/navigation"
|
||||
import { type HotelData } from "@scandic-hotels/trpc/types/hotel"
|
||||
|
||||
import { env } from "@/env/server"
|
||||
import { getHotel, getHotelPage } from "@/lib/trpc/memoizedRequests"
|
||||
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
|
||||
import HotelMapPageClient from "./Client"
|
||||
|
||||
import type { HotelType } from "@scandic-hotels/common/constants/hotelType"
|
||||
|
||||
interface HotelMapPageProps {
|
||||
hotelId: string
|
||||
hotelData: HotelData
|
||||
}
|
||||
|
||||
export default async function HotelMapPage({ hotelId }: HotelMapPageProps) {
|
||||
const lang = await getLang()
|
||||
const hotelPageData = await getHotelPage()
|
||||
const hotelData = await getHotel({
|
||||
hotelId,
|
||||
isCardOnlyPayment: false,
|
||||
language: lang,
|
||||
})
|
||||
|
||||
if (!hotelPageData || !hotelData) {
|
||||
notFound()
|
||||
}
|
||||
|
||||
const { name, location, pointsOfInterest, hotelType } = hotelData.hotel
|
||||
export default async function HotelMapPage({ hotelData }: HotelMapPageProps) {
|
||||
const {
|
||||
name,
|
||||
location,
|
||||
pointsOfInterest,
|
||||
hotelType,
|
||||
operaId: hotelId,
|
||||
} = hotelData.hotel
|
||||
|
||||
const coordinates = {
|
||||
lat: location.latitude,
|
||||
|
||||
@@ -6,12 +6,9 @@ import { safeTry } from "@scandic-hotels/common/utils/safeTry"
|
||||
import { Alert } from "@scandic-hotels/design-system/Alert"
|
||||
import Link from "@scandic-hotels/design-system/Link"
|
||||
import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK"
|
||||
import { type HotelPageData } from "@scandic-hotels/trpc/types/hotelPage"
|
||||
|
||||
import {
|
||||
getHotel,
|
||||
getHotelPage,
|
||||
getMeetingRooms,
|
||||
} from "@/lib/trpc/memoizedRequests"
|
||||
import { getMeetingRooms } from "@/lib/trpc/memoizedRequests"
|
||||
|
||||
import AccordionSection from "@/components/Blocks/Accordion"
|
||||
import Breadcrumbs from "@/components/Breadcrumbs"
|
||||
@@ -52,31 +49,25 @@ import {
|
||||
import styles from "./hotelPage.module.css"
|
||||
|
||||
import type { HotelType } from "@scandic-hotels/common/constants/hotelType"
|
||||
import type { HotelData } from "@scandic-hotels/trpc/types/hotel"
|
||||
|
||||
import type { HotelPageProps } from "@/types/components/hotelPage/hotelPage"
|
||||
import { AlertName } from "@/types/enums/alert"
|
||||
import { HotelHashValues } from "@/types/enums/hotelPage"
|
||||
|
||||
export default async function HotelPage({ hotelId }: HotelPageProps) {
|
||||
interface HotelPageProps {
|
||||
hotelData: HotelData
|
||||
hotelPageData: HotelPageData
|
||||
}
|
||||
|
||||
export default async function HotelPage({
|
||||
hotelData,
|
||||
hotelPageData,
|
||||
}: HotelPageProps) {
|
||||
const lang = await getLang()
|
||||
const intl = await getIntl()
|
||||
|
||||
void getHotelPage()
|
||||
void getHotel({
|
||||
hotelId,
|
||||
isCardOnlyPayment: false,
|
||||
language: lang,
|
||||
})
|
||||
|
||||
const hotelPageData = await getHotelPage()
|
||||
const hotelData = await getHotel({
|
||||
hotelId,
|
||||
isCardOnlyPayment: false,
|
||||
language: lang,
|
||||
})
|
||||
|
||||
const [meetingRoomsData] = await safeTry(
|
||||
getMeetingRooms({ hotelId, language: lang })
|
||||
getMeetingRooms({ hotelId: hotelData.hotel.operaId, language: lang })
|
||||
)
|
||||
|
||||
if (!hotelData?.hotel || !hotelPageData) {
|
||||
@@ -106,6 +97,7 @@ export default async function HotelPage({ hotelId }: HotelPageProps) {
|
||||
ratings,
|
||||
parking,
|
||||
hotelType,
|
||||
operaId: hotelId,
|
||||
} = hotel
|
||||
const {
|
||||
healthAndWellness,
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import { notFound } from "next/navigation"
|
||||
|
||||
import { getHotel, getHotelPage } from "@/lib/trpc/memoizedRequests"
|
||||
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
|
||||
import AccessibilitySubpage from "./AccessibilitySubpage"
|
||||
import MeetingsSubpage from "./MeetingsSubpage"
|
||||
import ParkingSubpage from "./ParkingSubpage"
|
||||
@@ -11,22 +7,17 @@ import RestaurantSubpage from "./RestaurantSubpage"
|
||||
import { verifySubpageShouldExist } from "./utils"
|
||||
import WellnessSubpage from "./WellnessSubpage"
|
||||
|
||||
import type { HotelSubpageProps } from "@/types/components/hotelPage/subpage"
|
||||
import type { HotelData } from "@scandic-hotels/trpc/types/hotel"
|
||||
|
||||
interface HotelSubpageProps {
|
||||
hotelData: HotelData
|
||||
subpage: string
|
||||
}
|
||||
|
||||
export default async function HotelSubpage({
|
||||
hotelId,
|
||||
hotelData,
|
||||
subpage,
|
||||
}: HotelSubpageProps) {
|
||||
const lang = await getLang()
|
||||
const [hotelPageData, hotelData] = await Promise.all([
|
||||
getHotelPage(),
|
||||
getHotel({ hotelId, language: lang, isCardOnlyPayment: false }),
|
||||
])
|
||||
|
||||
if (!hotelData?.hotel || !hotelPageData) {
|
||||
notFound()
|
||||
}
|
||||
|
||||
if (!verifySubpageShouldExist(hotelData, subpage)) {
|
||||
notFound()
|
||||
}
|
||||
@@ -49,7 +40,7 @@ export default async function HotelSubpage({
|
||||
case additionalData.meetingRooms.nameInUrl:
|
||||
return (
|
||||
<MeetingsSubpage
|
||||
hotelId={hotelId}
|
||||
hotelId={hotel.operaId}
|
||||
hotel={hotel}
|
||||
additionalData={additionalData}
|
||||
/>
|
||||
|
||||
18
apps/scandic-web/components/ThemeUpdater/index.tsx
Normal file
18
apps/scandic-web/components/ThemeUpdater/index.tsx
Normal file
@@ -0,0 +1,18 @@
|
||||
"use client"
|
||||
|
||||
import { useEffect } from "react"
|
||||
|
||||
import { type Theme, THEMES } from "@/utils/theme/types"
|
||||
|
||||
interface ThemeUpdaterProps {
|
||||
theme: Theme
|
||||
}
|
||||
|
||||
export default function ThemeUpdater({ theme }: ThemeUpdaterProps) {
|
||||
useEffect(() => {
|
||||
document.body.classList.remove(...THEMES)
|
||||
document.body.classList.add(theme)
|
||||
}, [theme])
|
||||
|
||||
return null
|
||||
}
|
||||
Reference in New Issue
Block a user