feat(BOOK-131): add no availability tracking * feat(BOOK-131): add no availability tracking * feat(BOOK-131): add no availability tracking * feat(BOOK-131): extract noAvailability function * feat(BOOK-131): fix every render problem * feat(BOOK-131): noavailability handle return in function Approved-by: Erik Tiekstra Approved-by: Joakim Jäderberg
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
|
|
|
import type { PackageEnum } from "@scandic-hotels/trpc/types/packages"
|
|
import type { IntlShape } from "react-intl"
|
|
|
|
export function getRoomFeatureDescription(
|
|
code: string,
|
|
description: string,
|
|
intl: IntlShape
|
|
): string {
|
|
const roomFeatureDescriptions: Record<string, string> = {
|
|
[RoomPackageCodeEnum.ACCESSIBILITY_ROOM]: intl.formatMessage({
|
|
defaultMessage: "Accessible room",
|
|
}),
|
|
[RoomPackageCodeEnum.ALLERGY_ROOM]: intl.formatMessage({
|
|
defaultMessage: "Allergy-friendly room",
|
|
}),
|
|
[RoomPackageCodeEnum.PET_ROOM]: intl.formatMessage({
|
|
defaultMessage: "Pet-friendly room",
|
|
}),
|
|
}
|
|
|
|
return roomFeatureDescriptions[code] ?? description
|
|
}
|
|
|
|
export function mapPackageToLabel(pkgCode: PackageEnum): string {
|
|
switch (pkgCode) {
|
|
case RoomPackageCodeEnum.ACCESSIBILITY_ROOM:
|
|
return "accessibility"
|
|
case RoomPackageCodeEnum.ALLERGY_ROOM:
|
|
return "allergy friendly"
|
|
case RoomPackageCodeEnum.PET_ROOM:
|
|
return "pet room"
|
|
default:
|
|
return ""
|
|
}
|
|
}
|