Merged in fix/hotel-pages-fix (pull request #1346)
fix: HotelPage restaurant navigation + translation * fix: hotelPage restaurant navigation + translation Approved-by: Erik Tiekstra
This commit is contained in:
@@ -4,9 +4,10 @@ import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
|||||||
import Title from "@/components/TempDesignSystem/Text/Title"
|
import Title from "@/components/TempDesignSystem/Text/Title"
|
||||||
import { getIntl } from "@/i18n"
|
import { getIntl } from "@/i18n"
|
||||||
|
|
||||||
|
import { translateWellnessType } from "../../../utils"
|
||||||
|
|
||||||
import styles from "./facility.module.css"
|
import styles from "./facility.module.css"
|
||||||
|
|
||||||
import { HealthFacilitiesEnum } from "@/types/components/hotelPage/facilities"
|
|
||||||
import type { FacilityProps } from "@/types/components/hotelPage/sidepeek/facility"
|
import type { FacilityProps } from "@/types/components/hotelPage/sidepeek/facility"
|
||||||
|
|
||||||
export default async function Facility({ data }: FacilityProps) {
|
export default async function Facility({ data }: FacilityProps) {
|
||||||
@@ -15,26 +16,6 @@ export default async function Facility({ data }: FacilityProps) {
|
|||||||
const ordinaryOpeningTimes = data.openingDetails.openingHours.ordinary
|
const ordinaryOpeningTimes = data.openingDetails.openingHours.ordinary
|
||||||
const weekendOpeningTimes = data.openingDetails.openingHours.weekends
|
const weekendOpeningTimes = data.openingDetails.openingHours.weekends
|
||||||
|
|
||||||
function translateWellnessType(type: string) {
|
|
||||||
switch (type) {
|
|
||||||
case HealthFacilitiesEnum.Gym:
|
|
||||||
return intl.formatMessage({ id: "Gym" })
|
|
||||||
case HealthFacilitiesEnum.IndoorPool:
|
|
||||||
return intl.formatMessage({ id: "Indoor pool" })
|
|
||||||
case HealthFacilitiesEnum.Jacuzzi:
|
|
||||||
return intl.formatMessage({ id: "Jacuzzi" })
|
|
||||||
case HealthFacilitiesEnum.OutdoorPool:
|
|
||||||
return intl.formatMessage({ id: "Outdoor pool" })
|
|
||||||
case HealthFacilitiesEnum.Relax:
|
|
||||||
return intl.formatMessage({ id: "Relax" })
|
|
||||||
case HealthFacilitiesEnum.Sauna:
|
|
||||||
return intl.formatMessage({ id: "Sauna" })
|
|
||||||
default:
|
|
||||||
console.warn(`Unsupported group given: ${type}`)
|
|
||||||
return intl.formatMessage({ id: "Wellness" })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.content}>
|
<div className={styles.content}>
|
||||||
{image?.imageSizes.medium && (
|
{image?.imageSizes.medium && (
|
||||||
@@ -48,7 +29,7 @@ export default async function Facility({ data }: FacilityProps) {
|
|||||||
)}
|
)}
|
||||||
<div className={styles.information}>
|
<div className={styles.information}>
|
||||||
<Subtitle color="burgundy" asChild type="one">
|
<Subtitle color="burgundy" asChild type="one">
|
||||||
<Title level="h3">{translateWellnessType(data.type)}</Title>
|
<Title level="h3">{translateWellnessType(data.type, intl)}</Title>
|
||||||
</Subtitle>
|
</Subtitle>
|
||||||
<div>
|
<div>
|
||||||
<Subtitle type="two" color="uiTextHighContrast">
|
<Subtitle type="two" color="uiTextHighContrast">
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import {
|
|||||||
} from "@/types/components/hotelPage/tabNavigation"
|
} from "@/types/components/hotelPage/tabNavigation"
|
||||||
|
|
||||||
export default function TabNavigation({
|
export default function TabNavigation({
|
||||||
restaurantTitle,
|
|
||||||
hasActivities,
|
hasActivities,
|
||||||
hasFAQ,
|
hasFAQ,
|
||||||
tabValues,
|
tabValues,
|
||||||
@@ -48,7 +47,7 @@ export default function TabNavigation({
|
|||||||
hash: HotelHashValues.restaurant,
|
hash: HotelHashValues.restaurant,
|
||||||
text:
|
text:
|
||||||
tabValues?.restaurant_bar ||
|
tabValues?.restaurant_bar ||
|
||||||
intl.formatMessage({ id: restaurantTitle }, { count: 1 }),
|
intl.formatMessage({ id: "Restaurant & Bar" }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
hash: HotelHashValues.meetings,
|
hash: HotelHashValues.meetings,
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import Alert from "@/components/TempDesignSystem/Alert"
|
|||||||
import BreadcrumbsSkeleton from "@/components/TempDesignSystem/Breadcrumbs/BreadcrumbsSkeleton"
|
import BreadcrumbsSkeleton from "@/components/TempDesignSystem/Breadcrumbs/BreadcrumbsSkeleton"
|
||||||
import TrackingSDK from "@/components/TrackingSDK"
|
import TrackingSDK from "@/components/TrackingSDK"
|
||||||
import { getLang } from "@/i18n/serverContext"
|
import { getLang } from "@/i18n/serverContext"
|
||||||
import { getRestaurantHeading } from "@/utils/facilityCards"
|
|
||||||
import { generateHotelSchema } from "@/utils/jsonSchemas"
|
import { generateHotelSchema } from "@/utils/jsonSchemas"
|
||||||
|
|
||||||
import DynamicMap from "./Map/DynamicMap"
|
import DynamicMap from "./Map/DynamicMap"
|
||||||
@@ -150,7 +149,6 @@ export default async function HotelPage({ hotelId }: HotelPageProps) {
|
|||||||
) : null}
|
) : null}
|
||||||
</header>
|
</header>
|
||||||
<TabNavigation
|
<TabNavigation
|
||||||
restaurantTitle={getRestaurantHeading(detailedFacilities)}
|
|
||||||
hasActivities={activitiesCards.length > 0}
|
hasActivities={activitiesCards.length > 0}
|
||||||
hasFAQ={!!faq?.accordions.length}
|
hasFAQ={!!faq?.accordions.length}
|
||||||
tabValues={tabValues}
|
tabValues={tabValues}
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
import type { IntlShape } from "react-intl"
|
||||||
|
|
||||||
|
import { HealthFacilitiesEnum } from "@/types/components/hotelPage/facilities"
|
||||||
import {
|
import {
|
||||||
TrackingChannelEnum,
|
TrackingChannelEnum,
|
||||||
type TrackingSDKHotelInfo,
|
type TrackingSDKHotelInfo,
|
||||||
@@ -42,3 +45,23 @@ export function getTrackingHotelData(hotelData: HotelData["hotel"]) {
|
|||||||
|
|
||||||
return tracking
|
return tracking
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function translateWellnessType(type: string, intl: IntlShape) {
|
||||||
|
switch (type) {
|
||||||
|
case HealthFacilitiesEnum.Gym:
|
||||||
|
return intl.formatMessage({ id: "Gym" })
|
||||||
|
case HealthFacilitiesEnum.IndoorPool:
|
||||||
|
return intl.formatMessage({ id: "Indoor pool" })
|
||||||
|
case HealthFacilitiesEnum.Jacuzzi:
|
||||||
|
return intl.formatMessage({ id: "Jacuzzi" })
|
||||||
|
case HealthFacilitiesEnum.OutdoorPool:
|
||||||
|
return intl.formatMessage({ id: "Outdoor pool" })
|
||||||
|
case HealthFacilitiesEnum.Relax:
|
||||||
|
return intl.formatMessage({ id: "Relax" })
|
||||||
|
case HealthFacilitiesEnum.Sauna:
|
||||||
|
return intl.formatMessage({ id: "Sauna" })
|
||||||
|
default:
|
||||||
|
console.warn(`Unsupported group given: ${type}`)
|
||||||
|
return intl.formatMessage({ id: "Wellness" })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
|||||||
import Title from "@/components/TempDesignSystem/Text/Title"
|
import Title from "@/components/TempDesignSystem/Text/Title"
|
||||||
import { getIntl } from "@/i18n"
|
import { getIntl } from "@/i18n"
|
||||||
|
|
||||||
|
import { translateWellnessType } from "../../HotelPage/utils"
|
||||||
|
|
||||||
import styles from "./sidebar.module.css"
|
import styles from "./sidebar.module.css"
|
||||||
|
|
||||||
import type { Hotel } from "@/types/hotel"
|
import type { Hotel } from "@/types/hotel"
|
||||||
@@ -23,7 +25,7 @@ export default async function WellnessSidebar({ hotel }: WellnessSidebarProps) {
|
|||||||
{hotel.healthFacilities.map((facility) => (
|
{hotel.healthFacilities.map((facility) => (
|
||||||
<div key={facility.type}>
|
<div key={facility.type}>
|
||||||
<Subtitle type="two" color="uiTextHighContrast" asChild>
|
<Subtitle type="two" color="uiTextHighContrast" asChild>
|
||||||
<h4>{intl.formatMessage({ id: facility.type })}</h4>
|
<h4>{translateWellnessType(facility.type, intl)}</h4>
|
||||||
</Subtitle>
|
</Subtitle>
|
||||||
<Body color="uiTextHighContrast">
|
<Body color="uiTextHighContrast">
|
||||||
{facility.openingDetails.openingHours.ordinary.alwaysOpen
|
{facility.openingDetails.openingHours.ordinary.alwaysOpen
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ type Tabs = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type TabNavigationProps = {
|
export type TabNavigationProps = {
|
||||||
restaurantTitle: string
|
|
||||||
hasActivities: boolean
|
hasActivities: boolean
|
||||||
hasFAQ: boolean
|
hasFAQ: boolean
|
||||||
tabValues?: Tabs | null
|
tabValues?: Tabs | null
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ export function setFacilityCardGrids(
|
|||||||
return cards
|
return cards
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getRestaurantHeading(amenities: Amenities): RestaurantHeadings {
|
function getRestaurantHeading(amenities: Amenities): RestaurantHeadings {
|
||||||
const hasBar = amenities.some(
|
const hasBar = amenities.some(
|
||||||
(facility) =>
|
(facility) =>
|
||||||
facility.id === FacilityEnum.Bar ||
|
facility.id === FacilityEnum.Bar ||
|
||||||
|
|||||||
Reference in New Issue
Block a user