feat(SW-495): set scripted top title as optional

This commit is contained in:
Fredrik Thorsson
2025-01-09 16:07:24 +01:00
parent 8a0c1244ae
commit d4d9e540f1
2 changed files with 9 additions and 7 deletions

View File

@@ -24,7 +24,7 @@ export type FacilityCard = {
scrollOnClick: boolean scrollOnClick: boolean
} }
heading: string heading: string
scriptedTopTitle: string scriptedTopTitle?: string
theme: CardProps["theme"] theme: CardProps["theme"]
id: string id: string
} }
@@ -55,7 +55,6 @@ export enum WellnessHeadings {
GymSauna = "Gym & Sauna", GymSauna = "Gym & Sauna",
GymPoolSaunaRelax = "Gym, Pool, Sauna & Relax", GymPoolSaunaRelax = "Gym, Pool, Sauna & Relax",
GymJacuzziSaunaRelax = "Gym, Jacuzzi, Sauna & Relax", GymJacuzziSaunaRelax = "Gym, Jacuzzi, Sauna & Relax",
FallbackHeading = "",
} }
export enum HealthFacilitiesEnum { export enum HealthFacilitiesEnum {
@@ -63,4 +62,6 @@ export enum HealthFacilitiesEnum {
Gym = "Gym", Gym = "Gym",
Sauna = "Sauna", Sauna = "Sauna",
Relax = "Relax", Relax = "Relax",
IndoorPool = "IndoorPool",
OutdoorPool = "OutdoorPool",
} }

View File

@@ -34,7 +34,7 @@ function setCardProps(
heading: string, heading: string,
buttonText: string, buttonText: string,
href: string, href: string,
scriptedTopTitle: string scriptedTopTitle?: string
): FacilityCard { ): FacilityCard {
return { return {
theme, theme,
@@ -142,7 +142,7 @@ export function getRestaurantHeading(amenities: Amenities): RestaurantHeadings {
export function getWellnessHeading( export function getWellnessHeading(
healthFacilities: HealthFacilities healthFacilities: HealthFacilities
): WellnessHeadings { ): WellnessHeadings | undefined {
const hasGym = healthFacilities.some( const hasGym = healthFacilities.some(
(facility) => facility.type === HealthFacilitiesEnum.Gym (facility) => facility.type === HealthFacilitiesEnum.Gym
) )
@@ -155,8 +155,10 @@ export function getWellnessHeading(
const hasJacuzzi = healthFacilities.some( const hasJacuzzi = healthFacilities.some(
(facility) => facility.type === HealthFacilitiesEnum.Jacuzzi (facility) => facility.type === HealthFacilitiesEnum.Jacuzzi
) )
const hasPool = healthFacilities.some((facility) => const hasPool = healthFacilities.some(
facility.type.includes("Pool") (facility) =>
facility.type === HealthFacilitiesEnum.IndoorPool ||
facility.type === HealthFacilitiesEnum.OutdoorPool
) )
if (hasGym && hasJacuzzi && hasSauna && hasRelax) { if (hasGym && hasJacuzzi && hasSauna && hasRelax) {
@@ -168,7 +170,6 @@ export function getWellnessHeading(
} else if (hasGym && hasPool) { } else if (hasGym && hasPool) {
return WellnessHeadings.GymPool return WellnessHeadings.GymPool
} }
return WellnessHeadings.FallbackHeading
} }
export function filterFacilityCards(cards: FacilityGrid) { export function filterFacilityCards(cards: FacilityGrid) {