Merged in feat/SW-1573-subpage-url (pull request #1297)
Feat(SW-1573): Use pageInUrl for hotel subpages * feat(SW-1573): use pageInUrl for hotel subpages Approved-by: Erik Tiekstra Approved-by: Fredrik Thorsson
This commit is contained in:
@@ -1,11 +1,8 @@
|
||||
import { accessibilitySubPage } from "@/constants/routes/hotelSubpages"
|
||||
|
||||
import { ArrowRightIcon } from "@/components/Icons"
|
||||
import AccordionItem from "@/components/TempDesignSystem/Accordion/AccordionItem"
|
||||
import Link from "@/components/TempDesignSystem/Link"
|
||||
import Body from "@/components/TempDesignSystem/Text/Body"
|
||||
import { getIntl } from "@/i18n"
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
|
||||
import styles from "./accessibilityAmenity.module.css"
|
||||
|
||||
@@ -14,10 +11,9 @@ import { IconName } from "@/types/components/icon"
|
||||
|
||||
export default async function AccessibilityAmenity({
|
||||
elevatorPitch,
|
||||
hasExtraAccessibilityPage,
|
||||
accessibilityPageUrl,
|
||||
}: AccessibilityAmenityProps) {
|
||||
const intl = await getIntl()
|
||||
const lang = getLang()
|
||||
|
||||
return (
|
||||
<AccordionItem
|
||||
@@ -30,9 +26,9 @@ export default async function AccessibilityAmenity({
|
||||
{elevatorPitch && (
|
||||
<Body color="uiTextHighContrast">{elevatorPitch}</Body>
|
||||
)}
|
||||
{hasExtraAccessibilityPage && (
|
||||
{accessibilityPageUrl && (
|
||||
<Link
|
||||
href={`/${accessibilitySubPage[lang]}`}
|
||||
href={`/${accessibilityPageUrl}`}
|
||||
color="burgundy"
|
||||
textDecoration="underline"
|
||||
variant="icon"
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import { parkingSubPage } from "@/constants/routes/hotelSubpages"
|
||||
|
||||
import ParkingInformation from "@/components/ParkingInformation"
|
||||
import AccordionItem from "@/components/TempDesignSystem/Accordion/AccordionItem"
|
||||
import Button from "@/components/TempDesignSystem/Button"
|
||||
import Link from "@/components/TempDesignSystem/Link"
|
||||
import { getIntl } from "@/i18n"
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
|
||||
import styles from "./parkingAmenity.module.css"
|
||||
|
||||
@@ -15,9 +12,8 @@ import { IconName } from "@/types/components/icon"
|
||||
export default async function ParkingAmenity({
|
||||
parking,
|
||||
parkingElevatorPitch,
|
||||
hasExtraParkingPage,
|
||||
parkingPageUrl,
|
||||
}: ParkingAmenityProps) {
|
||||
const lang = getLang()
|
||||
const intl = await getIntl()
|
||||
|
||||
return (
|
||||
@@ -32,16 +28,15 @@ export default async function ParkingAmenity({
|
||||
{parking.map((data) => (
|
||||
<ParkingInformation key={data.type} parking={data} />
|
||||
))}
|
||||
{hasExtraParkingPage && (
|
||||
{parkingPageUrl && (
|
||||
<Button
|
||||
className={styles.parkingPageLink}
|
||||
theme="base"
|
||||
intent="secondary"
|
||||
asChild
|
||||
>
|
||||
{/* TODO: URL Should possibly be something more dynamic */}
|
||||
<Link
|
||||
href={`/${parkingSubPage[lang]}`}
|
||||
href={`/${parkingPageUrl}`}
|
||||
color="burgundy"
|
||||
weight="bold"
|
||||
appendToCurrentPath
|
||||
|
||||
@@ -61,7 +61,7 @@ export default async function AmenitiesSidePeek({
|
||||
<ParkingAmenity
|
||||
parking={parking.parking}
|
||||
parkingElevatorPitch={parking.parkingElevatorPitch}
|
||||
hasExtraParkingPage={parking.hasExtraParkingPage}
|
||||
parkingPageUrl={parking.parkingPageUrl}
|
||||
/>
|
||||
{breakfastOpeningHours && (
|
||||
<BreakfastAmenity
|
||||
@@ -71,9 +71,9 @@ export default async function AmenitiesSidePeek({
|
||||
)}
|
||||
<CheckInAmenity checkInInformation={checkInInformation} />
|
||||
{(accessibility.elevatorPitch ||
|
||||
accessibility.hasExtraAccessibilityPage) && (
|
||||
accessibility.accessibilityPageUrl) && (
|
||||
<AccessibilityAmenity
|
||||
hasExtraAccessibilityPage={accessibility.hasExtraAccessibilityPage}
|
||||
accessibilityPageUrl={accessibility.accessibilityPageUrl}
|
||||
elevatorPitch={accessibility.elevatorPitch}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { wellnessAndExercise } from "@/constants/routes/hotelPageParams"
|
||||
import { wellnessSubPage } from "@/constants/routes/hotelSubpages"
|
||||
|
||||
import Button from "@/components/TempDesignSystem/Button"
|
||||
import Link from "@/components/TempDesignSystem/Link"
|
||||
@@ -15,7 +14,7 @@ import type { WellnessAndExerciseSidePeekProps } from "@/types/components/hotelP
|
||||
|
||||
export default async function WellnessAndExerciseSidePeek({
|
||||
healthFacilities,
|
||||
wellnessExerciseButton = false,
|
||||
wellnessExercisePageUrl,
|
||||
spaPage,
|
||||
}: WellnessAndExerciseSidePeekProps) {
|
||||
const intl = await getIntl()
|
||||
@@ -31,7 +30,7 @@ export default async function WellnessAndExerciseSidePeek({
|
||||
<Facility key={facility.type} data={facility} />
|
||||
))}
|
||||
</div>
|
||||
{(spaPage || wellnessExerciseButton) && (
|
||||
{(spaPage || wellnessExercisePageUrl) && (
|
||||
<div className={styles.buttonContainer}>
|
||||
{spaPage && (
|
||||
<Button fullWidth theme="base" intent="tertiary" asChild>
|
||||
@@ -40,10 +39,10 @@ export default async function WellnessAndExerciseSidePeek({
|
||||
</Link>
|
||||
</Button>
|
||||
)}
|
||||
{wellnessExerciseButton && (
|
||||
{wellnessExercisePageUrl && (
|
||||
<Button fullWidth theme="base" intent="secondary" asChild>
|
||||
<Link
|
||||
href={`/${wellnessSubPage[lang]}`}
|
||||
href={`/${wellnessExercisePageUrl}`}
|
||||
weight="bold"
|
||||
color="burgundy"
|
||||
appendToCurrentPath
|
||||
|
||||
@@ -82,6 +82,7 @@ export default async function HotelPage({ hotelId }: HotelPageProps) {
|
||||
const roomCategories = hotelData.roomCategories
|
||||
const {
|
||||
healthAndWellness,
|
||||
healthAndFitness,
|
||||
restaurantImages,
|
||||
conferencesAndMeetings,
|
||||
hotelRoomElevatorPitchText,
|
||||
@@ -217,12 +218,16 @@ export default async function HotelPage({ hotelId }: HotelPageProps) {
|
||||
parking={{
|
||||
parking: parking,
|
||||
parkingElevatorPitch: hotelParking.elevatorPitch,
|
||||
hasExtraParkingPage: displayWebPage.parking,
|
||||
parkingPageUrl: displayWebPage.parking
|
||||
? hotelParking.nameInUrl
|
||||
: undefined,
|
||||
}}
|
||||
checkInInformation={hotelFacts.checkin}
|
||||
accessibility={{
|
||||
elevatorPitch: hotelSpecialNeeds.elevatorPitch,
|
||||
hasExtraAccessibilityPage: displayWebPage.specialNeeds,
|
||||
accessibilityPageUrl: displayWebPage.specialNeeds
|
||||
? hotelSpecialNeeds.nameInUrl
|
||||
: undefined,
|
||||
}}
|
||||
restaurants={restaurants}
|
||||
/>
|
||||
@@ -237,7 +242,9 @@ export default async function HotelPage({ hotelId }: HotelPageProps) {
|
||||
<WellnessAndExerciseSidePeek
|
||||
healthFacilities={healthFacilities}
|
||||
spaPage={spaPage?.spa_page}
|
||||
wellnessExerciseButton={displayWebPage.healthGym}
|
||||
wellnessExercisePageUrl={
|
||||
displayWebPage.healthGym ? healthAndFitness.nameInUrl : undefined
|
||||
}
|
||||
/>
|
||||
<RestaurantBarSidePeek restaurants={restaurants} />
|
||||
{activitiesCards.map((card) => (
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
import {
|
||||
accessibilitySubPage,
|
||||
parkingSubPage,
|
||||
wellnessSubPage,
|
||||
} from "@/constants/routes/hotelSubpages"
|
||||
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
|
||||
import AccessibilityAdditionalContent from "./Accessibility"
|
||||
@@ -22,14 +16,12 @@ export default function HotelSubpageAdditionalContent({
|
||||
hotel,
|
||||
additionalData,
|
||||
}: HotelSubpageAdditionalContentProps) {
|
||||
const lang = getLang()
|
||||
|
||||
switch (subpage) {
|
||||
case parkingSubPage[lang]:
|
||||
case additionalData.hotelParking.nameInUrl:
|
||||
return <ParkingAdditionalContent hotel={hotel} />
|
||||
case wellnessSubPage[lang]:
|
||||
case additionalData.healthAndFitness.nameInUrl:
|
||||
return null
|
||||
case accessibilitySubPage[lang]:
|
||||
case additionalData.hotelSpecialNeeds.nameInUrl:
|
||||
return <AccessibilityAdditionalContent additionalData={additionalData} />
|
||||
default:
|
||||
return null
|
||||
|
||||
@@ -1,32 +1,25 @@
|
||||
import {
|
||||
accessibilitySubPage,
|
||||
parkingSubPage,
|
||||
wellnessSubPage,
|
||||
} from "@/constants/routes/hotelSubpages"
|
||||
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
|
||||
import ParkingSidebar from "./ParkingSidebar"
|
||||
import WellnessSidebar from "./WellnessSidebar"
|
||||
|
||||
import type { Hotel } from "@/types/hotel"
|
||||
import type { AdditionalData, Hotel } from "@/types/hotel"
|
||||
|
||||
interface HotelSubpageSidebarProps {
|
||||
subpage: string
|
||||
hotel: Hotel
|
||||
additionalData: AdditionalData
|
||||
}
|
||||
|
||||
export default function HotelSubpageSidebar({
|
||||
subpage,
|
||||
hotel,
|
||||
additionalData,
|
||||
}: HotelSubpageSidebarProps) {
|
||||
const lang = getLang()
|
||||
switch (subpage) {
|
||||
case parkingSubPage[lang]:
|
||||
case additionalData.hotelParking.nameInUrl:
|
||||
return <ParkingSidebar hotel={hotel} />
|
||||
case wellnessSubPage[lang]:
|
||||
case additionalData.healthAndFitness.nameInUrl:
|
||||
return <WellnessSidebar hotel={hotel} />
|
||||
case accessibilitySubPage[lang]:
|
||||
case additionalData.hotelSpecialNeeds.nameInUrl:
|
||||
return null
|
||||
default:
|
||||
return null
|
||||
|
||||
@@ -78,7 +78,11 @@ export default async function HotelSubpage({
|
||||
/>
|
||||
</main>
|
||||
|
||||
<HotelSubpageSidebar subpage={subpage} hotel={hotelData.hotel} />
|
||||
<HotelSubpageSidebar
|
||||
subpage={subpage}
|
||||
hotel={hotelData.hotel}
|
||||
additionalData={hotelData.additionalData}
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
{/* Tracking */}
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
import {
|
||||
accessibilitySubPage,
|
||||
parkingSubPage,
|
||||
wellnessSubPage,
|
||||
} from "@/constants/routes/hotelSubpages"
|
||||
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
|
||||
import type { IntlShape } from "react-intl"
|
||||
|
||||
import type { HotelData } from "@/types/hotel"
|
||||
@@ -15,11 +7,11 @@ export function getSubpageData(
|
||||
subpage: string,
|
||||
hotelData: HotelData
|
||||
) {
|
||||
const lang = getLang()
|
||||
const additionalData = hotelData.additionalData
|
||||
const hotel = hotelData.hotel
|
||||
|
||||
switch (subpage) {
|
||||
case parkingSubPage[lang]:
|
||||
case additionalData.hotelParking.nameInUrl:
|
||||
const parkingImage = additionalData.parkingImages?.heroImages[0]
|
||||
return {
|
||||
...additionalData.hotelParking,
|
||||
@@ -31,7 +23,7 @@ export function getSubpageData(
|
||||
}
|
||||
: null,
|
||||
}
|
||||
case wellnessSubPage[lang]:
|
||||
case additionalData.healthAndFitness.nameInUrl:
|
||||
const wellnessImage = hotel.healthFacilities.find(
|
||||
(fac) => fac.content.images.length
|
||||
)?.content.images[0]
|
||||
@@ -45,7 +37,7 @@ export function getSubpageData(
|
||||
}
|
||||
: null,
|
||||
}
|
||||
case accessibilitySubPage[lang]:
|
||||
case additionalData.hotelSpecialNeeds.nameInUrl:
|
||||
const accessibilityImage = additionalData.accessibility?.heroImages[0]
|
||||
return {
|
||||
...additionalData.hotelSpecialNeeds,
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
export const parkingSubPage = {
|
||||
en: "parking",
|
||||
sv: "parkering",
|
||||
no: "parkering",
|
||||
da: "parkering",
|
||||
fi: "parkkipaikka",
|
||||
de: "Parkplatz",
|
||||
}
|
||||
|
||||
export const wellnessSubPage = {
|
||||
en: "wellness",
|
||||
sv: "spa",
|
||||
no: "spa",
|
||||
da: "spa",
|
||||
fi: "spa",
|
||||
de: "Wellness",
|
||||
}
|
||||
|
||||
export const accessibilitySubPage = {
|
||||
en: "accessibility",
|
||||
sv: "tillganglighet",
|
||||
no: "tilgjengelighet",
|
||||
da: "tilgaengelighed",
|
||||
fi: "saavutettavuus",
|
||||
de: "barrierefreiheit",
|
||||
}
|
||||
@@ -32,6 +32,7 @@ export const restaurantsOverviewPageSchema = z.object({
|
||||
export const extraPageSchema = z.object({
|
||||
elevatorPitch: z.string().default(""),
|
||||
mainBody: z.string().optional(),
|
||||
nameInUrl: z.string().optional(),
|
||||
})
|
||||
|
||||
export const accessibilitySchema = z.object({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export type AccessibilityAmenityProps = {
|
||||
elevatorPitch?: string
|
||||
hasExtraAccessibilityPage: boolean
|
||||
accessibilityPageUrl?: string
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ export enum Periods {
|
||||
}
|
||||
|
||||
export type ParkingAmenityProps = {
|
||||
hasExtraParkingPage: boolean
|
||||
parkingPageUrl?: string
|
||||
parking: Hotel["parking"]
|
||||
parkingElevatorPitch?: string
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { Hotel } from "@/types/hotel"
|
||||
|
||||
export type WellnessAndExerciseSidePeekProps = {
|
||||
healthFacilities: Hotel["healthFacilities"]
|
||||
wellnessExerciseButton: boolean
|
||||
wellnessExercisePageUrl?: string
|
||||
spaPage?: {
|
||||
buttonCTA: string
|
||||
url: string
|
||||
|
||||
Reference in New Issue
Block a user