Merged in feat/SW-1333-hotel-endpoint (pull request #1206)

Feat(SW-133): Add additionalData endpoint

Approved-by: Erik Tiekstra
Approved-by: Fredrik Thorsson
This commit is contained in:
Matilda Landström
2025-01-27 11:39:13 +00:00
parent bf76c6277f
commit 577a4ca35e
17 changed files with 239 additions and 50 deletions

View File

@@ -5,7 +5,7 @@ export function getTypeSpecificInformation(
contentType: HotelListing["contentType"],
hotel: Hotel
) {
const { restaurantsOverviewPage, images } = hotel.hotelContent
const { images } = hotel.hotelContent
const { descriptions, meetingDescription } = hotel.hotelContent.texts
const hotelData = {
description: descriptions.short,
@@ -24,8 +24,8 @@ export function getTypeSpecificInformation(
const restaurantImage = hotel.restaurantImages?.heroImages[0]
return {
description:
restaurantsOverviewPage.restaurantsContentDescriptionShort ||
hotelData.description,
hotel.hotelContent.restaurantsOverviewPage
.restaurantsContentDescriptionShort || hotelData.description,
imageSrc: restaurantImage?.imageSizes.small || hotelData.imageSrc,
altText: restaurantImage?.metaData.altText || hotelData.altText,
}

View File

@@ -41,7 +41,7 @@ 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 type { AdditionalData, Facility } from "@/types/hotel"
import { PageContentTypeEnum } from "@/types/requests/contentType"
export default async function HotelPage({ hotelId }: HotelPageProps) {
@@ -63,12 +63,7 @@ export default async function HotelPage({ hotelId }: HotelPageProps) {
name,
address,
pointsOfInterest,
gallery,
specialAlerts,
healthAndWellness,
restaurantImages,
conferencesAndMeetings,
hotelRoomElevatorPitchText,
hotelContent,
detailedFacilities,
healthFacilities,
@@ -79,8 +74,18 @@ export default async function HotelPage({ hotelId }: HotelPageProps) {
ratings,
parking,
} = hotelData.data.attributes
const roomCategories = hotelData.included?.rooms || []
const restaurants = hotelData.included?.restaurants || []
const roomCategories = hotelData.included.rooms || []
const restaurants = hotelData.included.restaurants || []
const additionalData =
hotelData.included.additionalData || ({} as AdditionalData)
const {
healthAndWellness,
restaurantImages,
conferencesAndMeetings,
hotelRoomElevatorPitchText,
gallery,
} = additionalData
const images = gallery?.smallerImages
const description = hotelContent.texts.descriptions.medium

View File

@@ -95,7 +95,7 @@ export async function RoomsContainer({
<Rooms
availablePackages={packages ?? []}
roomsAvailability={roomsAvailability}
roomCategories={hotelData?.included?.rooms ?? []}
roomCategories={hotelData?.included.rooms ?? []}
hotelType={hotelData?.data.attributes?.hotelType}
isUserLoggedIn={isUserLoggedIn}
/>

View File

@@ -32,7 +32,7 @@ export default function HotelReservationSidePeek({
}
)
const selectedRoom = hotelData?.included?.rooms?.find((room) =>
const selectedRoom = hotelData?.included.rooms?.find((room) =>
room.roomTypes.some((type) => type.code === roomTypeCode)
)
@@ -42,6 +42,7 @@ export default function HotelReservationSidePeek({
{hotelData && (
<HotelSidePeek
hotel={hotelData.data?.attributes}
additionalHotelData={hotelData.included.additionalData}
activeSidePeek={activeSidePeek}
close={close}
showCTA={showCTA}

View File

@@ -4,7 +4,6 @@ import { mapFacilityToIcon } from "@/components/ContentType/HotelPage/data"
import Contact from "@/components/HotelReservation/Contact"
import Accordion from "@/components/TempDesignSystem/Accordion"
import SidePeek from "@/components/TempDesignSystem/SidePeek"
import Body from "@/components/TempDesignSystem/Text/Body"
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
import Accessibility from "./Accordions/Accessibility"
@@ -20,6 +19,7 @@ import { SidePeekEnum } from "@/types/components/hotelReservation/sidePeek"
export default function HotelSidePeek({
hotel,
additionalHotelData,
activeSidePeek,
close,
showCTA,
@@ -45,19 +45,19 @@ export default function HotelSidePeek({
<Contact hotel={hotel} />
<Accordion>
{parking?.length > 0 && <Parking parking={parking} />}
{hotel.hotelContent?.restaurantsOverviewPage
{additionalHotelData?.restaurantsOverviewPage
?.restaurantsContentDescriptionMedium && (
<Restaurant
restaurantsContentDescriptionMedium={
hotel.hotelContent.restaurantsOverviewPage
additionalHotelData.restaurantsOverviewPage
.restaurantsContentDescriptionMedium
}
/>
)}
{hotel?.accessibilityElevatorPitchText && (
{additionalHotelData?.accessibilityElevatorPitchText && (
<Accessibility
accessibilityElevatorPitchText={
hotel.accessibilityElevatorPitchText
additionalHotelData.accessibilityElevatorPitchText
}
/>
)}