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