refactor(SW-302): code cleanup
This commit is contained in:
@@ -11,11 +11,11 @@ import {
|
||||
type Facilities,
|
||||
type FacilityCards,
|
||||
FacilityEnum,
|
||||
RestaurantHeadings,
|
||||
} from "@/types/components/hotelPage/facilities"
|
||||
import type { ImageVaultAsset } from "@/types/components/imageVault"
|
||||
import type { HotelData } from "@/types/hotel"
|
||||
import type { Amenities, Facility } from "@/types/hotel"
|
||||
import type { CardProps } from "@/components/TempDesignSystem/Card/card"
|
||||
import type { Facility } from "@/server/routers/hotels/output"
|
||||
|
||||
type ActivityCard = {
|
||||
background_image?: ImageVaultAsset
|
||||
@@ -55,8 +55,8 @@ export function setActivityCard(activitiesCard: ActivityCard): FacilityCards {
|
||||
}
|
||||
|
||||
export async function setFacilityCards(
|
||||
facilities: Array<Facility>,
|
||||
amenities: HotelData["data"]["attributes"]["detailedFacilities"]
|
||||
facilities: Facility[],
|
||||
amenities: Amenities
|
||||
) {
|
||||
const lang = getLang()
|
||||
const intl = await getIntl()
|
||||
@@ -135,28 +135,27 @@ export async function setFacilityCards(
|
||||
return cards
|
||||
}
|
||||
|
||||
export function getRestaurantHeading(
|
||||
amenities: HotelData["data"]["attributes"]["detailedFacilities"]
|
||||
) {
|
||||
export function getRestaurantHeading(amenities: Amenities): RestaurantHeadings {
|
||||
const hasBar = amenities.some(
|
||||
(facility) => facility.id == 1606 || facility.id == 1014 // bar & rooftop bar id
|
||||
)
|
||||
const hasRestaurant = amenities.some((facility) => facility.id == 1383) // restaurant id
|
||||
|
||||
//let href,
|
||||
let title: string
|
||||
let title: RestaurantHeadings
|
||||
|
||||
if (hasBar && hasRestaurant) {
|
||||
//href = restaurantAndBar
|
||||
title = "Restaurant & Bar"
|
||||
title = RestaurantHeadings.restaurantAndBar
|
||||
} else if (hasBar) {
|
||||
//href = bar
|
||||
title = "Bar"
|
||||
title = RestaurantHeadings.bar
|
||||
} else if (hasRestaurant) {
|
||||
//href = restaurant
|
||||
title = "Restaurant"
|
||||
title = RestaurantHeadings.restaurant
|
||||
} else {
|
||||
//href = breakfastRestaurant
|
||||
title = "Breakfast restaurant"
|
||||
title = RestaurantHeadings.breakfastRestaurant
|
||||
}
|
||||
return title
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user