Merged in feat/SW-1469-facility-cards (pull request #1393)

Feat(SW-1469): Add check if we should create facility cards

* fix(SW-1469): only create facility cards if supposed to


Approved-by: Erik Tiekstra
Approved-by: Fredrik Thorsson
This commit is contained in:
Matilda Landström
2025-02-24 08:19:26 +00:00
parent ec00a598d2
commit dda236aa82
7 changed files with 141 additions and 74 deletions

View File

@@ -1,5 +1,4 @@
import { meetingsAndConferences } from "@/constants/routes/hotelPageParams"
import { getMeetingRooms } from "@/lib/trpc/memoizedRequests"
import Image from "@/components/Image"
import Button from "@/components/TempDesignSystem/Button"
@@ -20,15 +19,11 @@ import type { MeetingsAndConferencesSidePeekProps } from "@/types/components/hot
export default async function MeetingsAndConferencesSidePeek({
meetingFacilities,
descriptions,
hotelId,
meetingRooms,
meetingPageUrl,
}: MeetingsAndConferencesSidePeekProps) {
const lang = getLang()
const [intl, meetingRooms] = await Promise.all([
getIntl(),
getMeetingRooms({ hotelId, language: lang }),
])
const intl = await getIntl()
const { seatingText, roomText } = await getConferenceRoomTexts(meetingRooms)
const fallbackAlt = intl.formatMessage({ id: "Creative spaces for meetings" })

View File

@@ -22,6 +22,9 @@ import {
export default function TabNavigation({
hasActivities,
hasFAQ,
hasMeetingRooms,
hasRestaurants,
hasWellness,
tabValues,
}: TabNavigationProps) {
const hash = useHash()
@@ -43,24 +46,36 @@ export default function TabNavigation({
hash: HotelHashValues.rooms,
text: tabValues?.rooms || intl.formatMessage({ id: "Rooms" }),
},
{
hash: HotelHashValues.restaurant,
text:
tabValues?.restaurant_bar ||
intl.formatMessage({ id: "Restaurant & Bar" }),
},
{
hash: HotelHashValues.meetings,
text:
tabValues?.conferences_meetings ||
intl.formatMessage({ id: "Meetings & Conferences" }),
},
{
hash: HotelHashValues.wellness,
text:
tabValues?.health_wellness ||
intl.formatMessage({ id: "Wellness & Exercise" }),
},
...(hasRestaurants
? [
{
hash: HotelHashValues.restaurant,
text:
tabValues?.restaurant_bar ||
intl.formatMessage({ id: "Restaurant & Bar" }),
},
]
: []),
...(hasMeetingRooms
? [
{
hash: HotelHashValues.meetings,
text:
tabValues?.conferences_meetings ||
intl.formatMessage({ id: "Meetings & Conferences" }),
},
]
: []),
...(hasWellness
? [
{
hash: HotelHashValues.wellness,
text:
tabValues?.health_wellness ||
intl.formatMessage({ id: "Wellness & Exercise" }),
},
]
: []),
...(hasActivities
? [
{

View File

@@ -2,7 +2,11 @@ import { notFound } from "next/navigation"
import { Suspense } from "react"
import { env } from "@/env/server"
import { getHotel, getHotelPage } from "@/lib/trpc/memoizedRequests"
import {
getHotel,
getHotelPage,
getMeetingRooms,
} from "@/lib/trpc/memoizedRequests"
import AccordionSection from "@/components/Blocks/Accordion"
import Breadcrumbs from "@/components/Breadcrumbs"
@@ -11,6 +15,7 @@ import Alert from "@/components/TempDesignSystem/Alert"
import BreadcrumbsSkeleton from "@/components/TempDesignSystem/Breadcrumbs/BreadcrumbsSkeleton"
import TrackingSDK from "@/components/TrackingSDK"
import { getLang } from "@/i18n/serverContext"
import { setFacilityCards } from "@/utils/facilityCards"
import { generateHotelSchema } from "@/utils/jsonSchemas"
import DynamicMap from "./Map/DynamicMap"
@@ -37,22 +42,22 @@ import { getTrackingHotelData, getTrackingPageData } from "./utils"
import styles from "./hotelPage.module.css"
import { FacilityCardTypeEnum } from "@/types/components/hotelPage/facilities"
import type { HotelPageProps } from "@/types/components/hotelPage/hotelPage"
import { HotelHashValues } from "@/types/components/hotelPage/tabNavigation"
import type { Facility } from "@/types/hotel"
import { PageContentTypeEnum } from "@/types/requests/contentType"
export default async function HotelPage({ hotelId }: HotelPageProps) {
const lang = getLang()
const [hotelPageData, hotelData] = await Promise.all([
const [hotelPageData, hotelData, meetingRoomsData] = await Promise.all([
getHotelPage(),
getHotel({
hotelId,
isCardOnlyPayment: false,
language: lang,
}),
getMeetingRooms({ hotelId, language: lang }),
])
const googleMapsApiKey = env.GOOGLE_STATIC_MAP_KEY
const googleMapId = env.GOOGLE_DYNAMIC_MAP_ID
@@ -97,26 +102,18 @@ export default async function HotelPage({ hotelId }: HotelPageProps) {
const { spaPage, activitiesCards } = content
const facilities: Facility[] = [
{
...restaurantImages,
id: FacilityCardTypeEnum.restaurant,
headingText: restaurantImages?.headingText ?? "",
heroImages: restaurantImages?.heroImages ?? [],
},
{
...conferencesAndMeetings,
id: FacilityCardTypeEnum.conference,
headingText: conferencesAndMeetings?.headingText ?? "",
heroImages: conferencesAndMeetings?.heroImages ?? [],
},
{
...healthAndWellness,
id: FacilityCardTypeEnum.wellness,
headingText: healthAndWellness?.headingText ?? "",
heroImages: healthAndWellness?.heroImages ?? [],
},
]
const hasRestaurants = restaurants.length > 0
const hasMeetingRooms = meetingRoomsData.length > 0
const hasWellness = healthFacilities.length > 0
const facilities = setFacilityCards(
restaurantImages,
conferencesAndMeetings,
healthAndWellness,
hasRestaurants,
hasMeetingRooms,
hasWellness
)
const topThreePois = pointsOfInterest.slice(0, 3)
@@ -151,6 +148,9 @@ export default async function HotelPage({ hotelId }: HotelPageProps) {
<TabNavigation
hasActivities={activitiesCards.length > 0}
hasFAQ={!!faq?.accordions.length}
hasWellness={hasWellness}
hasRestaurants={hasRestaurants}
hasMeetingRooms={hasMeetingRooms}
tabValues={tabValues}
/>
@@ -183,12 +183,14 @@ export default async function HotelPage({ hotelId }: HotelPageProps) {
) : null}
</div>
<Rooms rooms={roomCategories} preamble={hotelRoomElevatorPitchText} />
<Facilities
facilities={facilities}
activitiesCards={activitiesCards}
amenities={detailedFacilities}
healthFacilities={healthFacilities}
/>
{facilities && (
<Facilities
facilities={facilities}
activitiesCards={activitiesCards}
amenities={detailedFacilities}
healthFacilities={healthFacilities}
/>
)}
{faq && faq.accordions.length > 0 && (
<AccordionSection accordion={faq.accordions} title={faq.title} />
)}
@@ -238,14 +240,18 @@ export default async function HotelPage({ hotelId }: HotelPageProps) {
ecoLabels={hotelFacts.ecoLabels}
descriptions={hotelContent.texts}
/>
<WellnessAndExerciseSidePeek
healthFacilities={healthFacilities}
spaPage={spaPage?.spa_page}
wellnessExercisePageUrl={
displayWebPage.healthGym ? healthAndFitness.nameInUrl : undefined
}
/>
<RestaurantBarSidePeek restaurants={restaurants} />
{hasWellness ? (
<WellnessAndExerciseSidePeek
healthFacilities={healthFacilities}
spaPage={spaPage?.spa_page}
wellnessExercisePageUrl={
displayWebPage.healthGym ? healthAndFitness.nameInUrl : undefined
}
/>
) : null}
{hasRestaurants ? (
<RestaurantBarSidePeek restaurants={restaurants} />
) : null}
{activitiesCards.map((card) => (
<ActivitiesSidePeek
key={card.upcoming_activities_card.heading}
@@ -254,14 +260,16 @@ export default async function HotelPage({ hotelId }: HotelPageProps) {
sidepeekSlug={card.upcoming_activities_card.sidepeekSlug}
/>
))}
<MeetingsAndConferencesSidePeek
meetingFacilities={conferencesAndMeetings}
descriptions={hotelContent.texts.meetingDescription}
hotelId={hotelId}
meetingPageUrl={
displayWebPage.meetingRoom ? meetingRooms.nameInUrl : undefined
}
/>
{hasMeetingRooms && (
<MeetingsAndConferencesSidePeek
meetingFacilities={conferencesAndMeetings}
descriptions={hotelContent.texts.meetingDescription}
meetingRooms={meetingRoomsData}
meetingPageUrl={
displayWebPage.meetingRoom ? meetingRooms.nameInUrl : undefined
}
/>
)}
{roomCategories.map((room) => (
<RoomSidePeek key={room.name} room={room} />
))}