From d4d9e540f1e699e81abb46e8b18347d9f5d7573f Mon Sep 17 00:00:00 2001 From: Fredrik Thorsson Date: Thu, 9 Jan 2025 16:07:24 +0100 Subject: [PATCH] feat(SW-495): set scripted top title as optional --- types/components/hotelPage/facilities.ts | 5 +++-- utils/facilityCards.ts | 11 ++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/types/components/hotelPage/facilities.ts b/types/components/hotelPage/facilities.ts index f7c02a950..13a1047bd 100644 --- a/types/components/hotelPage/facilities.ts +++ b/types/components/hotelPage/facilities.ts @@ -24,7 +24,7 @@ export type FacilityCard = { scrollOnClick: boolean } heading: string - scriptedTopTitle: string + scriptedTopTitle?: string theme: CardProps["theme"] id: string } @@ -55,7 +55,6 @@ export enum WellnessHeadings { GymSauna = "Gym & Sauna", GymPoolSaunaRelax = "Gym, Pool, Sauna & Relax", GymJacuzziSaunaRelax = "Gym, Jacuzzi, Sauna & Relax", - FallbackHeading = "", } export enum HealthFacilitiesEnum { @@ -63,4 +62,6 @@ export enum HealthFacilitiesEnum { Gym = "Gym", Sauna = "Sauna", Relax = "Relax", + IndoorPool = "IndoorPool", + OutdoorPool = "OutdoorPool", } diff --git a/utils/facilityCards.ts b/utils/facilityCards.ts index 16f318efb..7773540d0 100644 --- a/utils/facilityCards.ts +++ b/utils/facilityCards.ts @@ -34,7 +34,7 @@ function setCardProps( heading: string, buttonText: string, href: string, - scriptedTopTitle: string + scriptedTopTitle?: string ): FacilityCard { return { theme, @@ -142,7 +142,7 @@ export function getRestaurantHeading(amenities: Amenities): RestaurantHeadings { export function getWellnessHeading( healthFacilities: HealthFacilities -): WellnessHeadings { +): WellnessHeadings | undefined { const hasGym = healthFacilities.some( (facility) => facility.type === HealthFacilitiesEnum.Gym ) @@ -155,8 +155,10 @@ export function getWellnessHeading( const hasJacuzzi = healthFacilities.some( (facility) => facility.type === HealthFacilitiesEnum.Jacuzzi ) - const hasPool = healthFacilities.some((facility) => - facility.type.includes("Pool") + const hasPool = healthFacilities.some( + (facility) => + facility.type === HealthFacilitiesEnum.IndoorPool || + facility.type === HealthFacilitiesEnum.OutdoorPool ) if (hasGym && hasJacuzzi && hasSauna && hasRelax) { @@ -168,7 +170,6 @@ export function getWellnessHeading( } else if (hasGym && hasPool) { return WellnessHeadings.GymPool } - return WellnessHeadings.FallbackHeading } export function filterFacilityCards(cards: FacilityGrid) {