feat(SW-1464): Added meeting url instead of hotel url for hotellisting with meeting information
Approved-by: Matilda Landström
This commit is contained in:
@@ -18,20 +18,24 @@ import type { HotelListingItemProps } from "@/types/components/contentPage/hotel
|
|||||||
|
|
||||||
export default async function HotelListingItem({
|
export default async function HotelListingItem({
|
||||||
hotel,
|
hotel,
|
||||||
|
additionalData,
|
||||||
contentType = "hotel",
|
contentType = "hotel",
|
||||||
url,
|
url,
|
||||||
}: HotelListingItemProps) {
|
}: HotelListingItemProps) {
|
||||||
const intl = await getIntl()
|
const intl = await getIntl()
|
||||||
const { description, imageSrc, altText } = getTypeSpecificInformation(
|
const { description, image, cta } = getTypeSpecificInformation(
|
||||||
|
intl,
|
||||||
contentType,
|
contentType,
|
||||||
hotel
|
hotel.hotelContent,
|
||||||
|
additionalData,
|
||||||
|
url
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<article className={styles.container}>
|
<article className={styles.container}>
|
||||||
<Image
|
<Image
|
||||||
src={imageSrc}
|
src={image.src}
|
||||||
alt={altText}
|
alt={image.alt}
|
||||||
width={300}
|
width={300}
|
||||||
height={200}
|
height={200}
|
||||||
className={styles.image}
|
className={styles.image}
|
||||||
@@ -62,7 +66,8 @@ export default async function HotelListingItem({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Body>{description}</Body>
|
<Body>{description}</Body>
|
||||||
{url && (
|
|
||||||
|
{cta.url && (
|
||||||
<Button
|
<Button
|
||||||
intent="primary"
|
intent="primary"
|
||||||
theme="base"
|
theme="base"
|
||||||
@@ -70,8 +75,12 @@ export default async function HotelListingItem({
|
|||||||
className={styles.button}
|
className={styles.button}
|
||||||
asChild
|
asChild
|
||||||
>
|
>
|
||||||
<Link href={url} color="white">
|
<Link
|
||||||
{intl.formatMessage({ id: "See hotel details" })}
|
href={cta.url}
|
||||||
|
color="white"
|
||||||
|
target={cta.openInNewTab ? "_blank" : "_self"}
|
||||||
|
>
|
||||||
|
{cta.text}
|
||||||
</Link>
|
</Link>
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,36 +1,67 @@
|
|||||||
import type { Hotel } from "@/types/hotel"
|
import type { IntlShape } from "react-intl"
|
||||||
|
|
||||||
|
import type { AdditionalData, Hotel } from "@/types/hotel"
|
||||||
import type { HotelListing } from "@/types/trpc/routers/contentstack/blocks"
|
import type { HotelListing } from "@/types/trpc/routers/contentstack/blocks"
|
||||||
|
|
||||||
export function getTypeSpecificInformation(
|
export function getTypeSpecificInformation(
|
||||||
|
intl: IntlShape,
|
||||||
contentType: HotelListing["contentType"],
|
contentType: HotelListing["contentType"],
|
||||||
hotel: Hotel
|
hotelContent: Hotel["hotelContent"],
|
||||||
|
additionalData: AdditionalData,
|
||||||
|
url: string | null
|
||||||
) {
|
) {
|
||||||
const { images } = hotel.hotelContent
|
const { images, texts } = hotelContent
|
||||||
const { descriptions, meetingDescription } = hotel.hotelContent.texts
|
const { descriptions, meetingDescription } = texts
|
||||||
const hotelData = {
|
const { conferencesAndMeetings, restaurantsOverviewPage, restaurantImages } =
|
||||||
|
additionalData
|
||||||
|
const data = {
|
||||||
description: descriptions?.short,
|
description: descriptions?.short,
|
||||||
imageSrc: images.imageSizes.small,
|
image: {
|
||||||
altText: images.metaData.altText,
|
src: images.imageSizes.small,
|
||||||
|
alt: images.metaData.altText,
|
||||||
|
},
|
||||||
|
cta: {
|
||||||
|
text: intl.formatMessage({ id: "See hotel details" }),
|
||||||
|
url,
|
||||||
|
openInNewTab: false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
switch (contentType) {
|
switch (contentType) {
|
||||||
case "meeting":
|
case "meeting":
|
||||||
const meetingImage = hotel.conferencesAndMeetings?.heroImages[0]
|
const meetingImage = conferencesAndMeetings?.heroImages[0]
|
||||||
return {
|
const meetingUrl = additionalData.meetingRooms.meetingOnlineLink
|
||||||
description: meetingDescription?.short || hotelData.description,
|
if (meetingDescription?.short) {
|
||||||
imageSrc: meetingImage?.imageSizes.small || hotelData.imageSrc,
|
data.description = meetingDescription.short
|
||||||
altText: meetingImage?.metaData.altText || hotelData.altText,
|
|
||||||
}
|
}
|
||||||
|
if (meetingImage) {
|
||||||
|
data.image = {
|
||||||
|
src: meetingImage.imageSizes.small,
|
||||||
|
alt: meetingImage.metaData.altText,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (meetingUrl) {
|
||||||
|
data.cta = {
|
||||||
|
text: intl.formatMessage({ id: "Book a meeting" }),
|
||||||
|
url: meetingUrl,
|
||||||
|
openInNewTab: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return data
|
||||||
case "restaurant":
|
case "restaurant":
|
||||||
const restaurantImage = hotel.restaurantImages?.heroImages[0]
|
const restaurantImage = restaurantImages?.heroImages[0]
|
||||||
return {
|
if (restaurantsOverviewPage.restaurantsContentDescriptionShort) {
|
||||||
description:
|
data.description =
|
||||||
hotel.hotelContent.restaurantsOverviewPage
|
restaurantsOverviewPage.restaurantsContentDescriptionShort
|
||||||
.restaurantsContentDescriptionShort || hotelData.description,
|
|
||||||
imageSrc: restaurantImage?.imageSizes.small || hotelData.imageSrc,
|
|
||||||
altText: restaurantImage?.metaData.altText || hotelData.altText,
|
|
||||||
}
|
}
|
||||||
|
if (restaurantImage) {
|
||||||
|
data.image = {
|
||||||
|
src: restaurantImage.imageSizes.small,
|
||||||
|
alt: restaurantImage.metaData.altText,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return data
|
||||||
case "hotel":
|
case "hotel":
|
||||||
default:
|
default:
|
||||||
return hotelData
|
return data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export default async function HotelListing({
|
|||||||
}: HotelListingProps) {
|
}: HotelListingProps) {
|
||||||
const hotels = await getHotelsByCSFilter({
|
const hotels = await getHotelsByCSFilter({
|
||||||
locationFilter,
|
locationFilter,
|
||||||
hotelsToInclude: hotelsToInclude,
|
hotelsToInclude,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!hotels.length) {
|
if (!hotels.length) {
|
||||||
@@ -27,10 +27,11 @@ export default async function HotelListing({
|
|||||||
<Title level="h4" as="h3" textTransform="capitalize">
|
<Title level="h4" as="h3" textTransform="capitalize">
|
||||||
{heading}
|
{heading}
|
||||||
</Title>
|
</Title>
|
||||||
{hotels.map(({ url, ...data }) => (
|
{hotels.map(({ url, hotel, additionalData }) => (
|
||||||
<HotelListingItem
|
<HotelListingItem
|
||||||
key={data.hotel.name}
|
key={hotel.name}
|
||||||
hotel={data.hotel}
|
hotel={hotel}
|
||||||
|
additionalData={additionalData}
|
||||||
contentType={contentType}
|
contentType={contentType}
|
||||||
url={url}
|
url={url}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -93,6 +93,7 @@
|
|||||||
"Boardroom": "Boardroom",
|
"Boardroom": "Boardroom",
|
||||||
"Book": "Book",
|
"Book": "Book",
|
||||||
"Book Reward Night": "Book bonusnat",
|
"Book Reward Night": "Book bonusnat",
|
||||||
|
"Book a meeting": "Book et møde",
|
||||||
"Book a table online": "Book et bord online",
|
"Book a table online": "Book et bord online",
|
||||||
"Book another stay": "Book another stay",
|
"Book another stay": "Book another stay",
|
||||||
"Book parking": "Book parkering",
|
"Book parking": "Book parkering",
|
||||||
|
|||||||
@@ -94,6 +94,7 @@
|
|||||||
"Boardroom": "Boardroom",
|
"Boardroom": "Boardroom",
|
||||||
"Book": "Buchen",
|
"Book": "Buchen",
|
||||||
"Book Reward Night": "Bonusnacht buchen",
|
"Book Reward Night": "Bonusnacht buchen",
|
||||||
|
"Book a meeting": "Buchen Sie ein Meeting",
|
||||||
"Book a table online": "Tisch online buchen",
|
"Book a table online": "Tisch online buchen",
|
||||||
"Book another stay": "Book another stay",
|
"Book another stay": "Book another stay",
|
||||||
"Book parking": "Parkplatz buchen",
|
"Book parking": "Parkplatz buchen",
|
||||||
|
|||||||
@@ -92,6 +92,7 @@
|
|||||||
"Boardroom": "Boardroom",
|
"Boardroom": "Boardroom",
|
||||||
"Book": "Book",
|
"Book": "Book",
|
||||||
"Book Reward Night": "Book Reward Night",
|
"Book Reward Night": "Book Reward Night",
|
||||||
|
"Book a meeting": "Book a meeting",
|
||||||
"Book a table online": "Book a table online",
|
"Book a table online": "Book a table online",
|
||||||
"Book another stay": "Book another stay",
|
"Book another stay": "Book another stay",
|
||||||
"Book parking": "Book parking",
|
"Book parking": "Book parking",
|
||||||
|
|||||||
@@ -92,6 +92,7 @@
|
|||||||
"Boardroom": "Boardroom",
|
"Boardroom": "Boardroom",
|
||||||
"Book": "Varaa",
|
"Book": "Varaa",
|
||||||
"Book Reward Night": "Kirjapalkinto-ilta",
|
"Book Reward Night": "Kirjapalkinto-ilta",
|
||||||
|
"Book a meeting": "Varaa kokous",
|
||||||
"Book a table online": "Varaa pöytä verkossa",
|
"Book a table online": "Varaa pöytä verkossa",
|
||||||
"Book another stay": "Book another stay",
|
"Book another stay": "Book another stay",
|
||||||
"Book parking": "Varaa pysäköinti",
|
"Book parking": "Varaa pysäköinti",
|
||||||
|
|||||||
@@ -92,6 +92,7 @@
|
|||||||
"Boardroom": "Boardroom",
|
"Boardroom": "Boardroom",
|
||||||
"Book": "Bestill",
|
"Book": "Bestill",
|
||||||
"Book Reward Night": "Bestill belønningskveld",
|
"Book Reward Night": "Bestill belønningskveld",
|
||||||
|
"Book a meeting": "Bestill et møte",
|
||||||
"Book a table online": "Bestill bord online",
|
"Book a table online": "Bestill bord online",
|
||||||
"Book another stay": "Book another stay",
|
"Book another stay": "Book another stay",
|
||||||
"Book parking": "Bestill parkering",
|
"Book parking": "Bestill parkering",
|
||||||
|
|||||||
@@ -92,6 +92,7 @@
|
|||||||
"Boardroom": "Boardroom",
|
"Boardroom": "Boardroom",
|
||||||
"Book": "Boka",
|
"Book": "Boka",
|
||||||
"Book Reward Night": "Boka frinatt",
|
"Book Reward Night": "Boka frinatt",
|
||||||
|
"Book a meeting": "Boka ett möte",
|
||||||
"Book a table online": "Boka ett bord online",
|
"Book a table online": "Boka ett bord online",
|
||||||
"Book another stay": "Book another stay",
|
"Book another stay": "Book another stay",
|
||||||
"Book parking": "Boka parkering",
|
"Book parking": "Boka parkering",
|
||||||
|
|||||||
@@ -27,7 +27,11 @@ export const additionalDataSchema = z.object({
|
|||||||
hotelRoomElevatorPitchText: nullableStringValidator,
|
hotelRoomElevatorPitchText: nullableStringValidator,
|
||||||
hotelSpecialNeeds: extraPageSchema,
|
hotelSpecialNeeds: extraPageSchema,
|
||||||
id: nullableStringValidator,
|
id: nullableStringValidator,
|
||||||
meetingRooms: extraPageSchema,
|
meetingRooms: extraPageSchema.merge(
|
||||||
|
z.object({
|
||||||
|
meetingOnlineLink: z.string().nullish(),
|
||||||
|
})
|
||||||
|
),
|
||||||
name: nullableStringValidator,
|
name: nullableStringValidator,
|
||||||
parkingImages: facilitySchema.nullish(),
|
parkingImages: facilitySchema.nullish(),
|
||||||
restaurantImages: facilitySchema.nullish(),
|
restaurantImages: facilitySchema.nullish(),
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import type { Hotel } from "@/types/hotel"
|
import type { AdditionalData, Hotel } from "@/types/hotel"
|
||||||
import type { HotelListing } from "@/types/trpc/routers/contentstack/blocks"
|
import type { HotelListing } from "@/types/trpc/routers/contentstack/blocks"
|
||||||
|
|
||||||
export interface HotelListingItemProps {
|
export interface HotelListingItemProps {
|
||||||
hotel: Hotel
|
hotel: Hotel
|
||||||
|
additionalData: AdditionalData
|
||||||
contentType: HotelListing["contentType"]
|
contentType: HotelListing["contentType"]
|
||||||
url: string | null
|
url: string | null
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user