feat: update getHotel to use real hotel api endpoint, support for service tokens, type modifications
This commit is contained in:
@@ -18,12 +18,18 @@ export default async function HotelPage() {
|
||||
return null
|
||||
}
|
||||
const lang = getLang()
|
||||
const { attributes, roomCategories } = await serverClient().hotel.getHotel({
|
||||
|
||||
const hotelData = await serverClient().hotel.getHotel({
|
||||
hotelId: hotelPageIdentifierData.hotel_page_id,
|
||||
language: lang,
|
||||
include: ["RoomCategories"],
|
||||
})
|
||||
|
||||
if (!hotelData) {
|
||||
return null
|
||||
}
|
||||
const { attributes, roomCategories } = hotelData
|
||||
|
||||
return (
|
||||
<div className={styles.pageContainer}>
|
||||
<TabNavigation />
|
||||
@@ -34,7 +40,7 @@ export default async function HotelPage() {
|
||||
hotelDescription={attributes.hotelContent.texts.descriptions.short}
|
||||
location={attributes.location}
|
||||
address={attributes.address}
|
||||
tripAdvisor={attributes.ratings.tripAdvisor}
|
||||
tripAdvisor={attributes.ratings?.tripAdvisor}
|
||||
/>
|
||||
<SidePeeks />
|
||||
<AmenitiesList detailedFacilities={attributes.detailedFacilities} />
|
||||
|
||||
@@ -30,10 +30,14 @@ export default async function IntroSection({
|
||||
)
|
||||
const lang = getLang()
|
||||
const formattedLocationText = `${streetAddress}, ${city} (${formattedDistanceText})`
|
||||
const formattedTripAdvisorText = intl.formatMessage(
|
||||
{ id: "Tripadvisor reviews" },
|
||||
{ rating: tripAdvisor.rating, count: tripAdvisor.numberOfReviews }
|
||||
)
|
||||
const hasTripAdvisorData =
|
||||
tripAdvisor?.rating && tripAdvisor?.numberOfReviews && tripAdvisor?.webUrl
|
||||
const formattedTripAdvisorText = hasTripAdvisorData
|
||||
? intl.formatMessage(
|
||||
{ id: "Tripadvisor reviews" },
|
||||
{ rating: tripAdvisor.rating, count: tripAdvisor.numberOfReviews }
|
||||
)
|
||||
: ""
|
||||
|
||||
return (
|
||||
<section className={styles.introSection}>
|
||||
@@ -45,17 +49,19 @@ export default async function IntroSection({
|
||||
<Title level="h2">{hotelName}</Title>
|
||||
</div>
|
||||
<Body color="textMediumContrast">{formattedLocationText}</Body>
|
||||
<Link
|
||||
className={styles.introLink}
|
||||
target="_blank"
|
||||
variant="icon"
|
||||
textDecoration="underline"
|
||||
color="peach80"
|
||||
href={tripAdvisor.webUrl}
|
||||
>
|
||||
<TripAdvisorIcon color="peach80" />
|
||||
{formattedTripAdvisorText}
|
||||
</Link>
|
||||
{hasTripAdvisorData && (
|
||||
<Link
|
||||
className={styles.introLink}
|
||||
target="_blank"
|
||||
variant="icon"
|
||||
textDecoration="underline"
|
||||
color="peach80"
|
||||
href={tripAdvisor.webUrl}
|
||||
>
|
||||
<TripAdvisorIcon color="peach80" />
|
||||
{formattedTripAdvisorText}
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
<div className={styles.subtitleContent}>
|
||||
<Preamble>{hotelDescription}</Preamble>
|
||||
|
||||
Reference in New Issue
Block a user