Merged in fix/SW-3021-vouchers (pull request #2719)
fix(SW-3021): add pluralization support for vouchers * fix(SW-3021): add pluralization support for vouchers Approved-by: Anton Gunnarsson
This commit is contained in:
@@ -31,10 +31,10 @@ import styles from './hotelCard.module.css'
|
||||
import type { Lang } from '@scandic-hotels/common/constants/language'
|
||||
import { FacilityEnum } from '@scandic-hotels/common/constants/facilities'
|
||||
import { RateTypeEnum } from '@scandic-hotels/common/constants/rateType'
|
||||
import { CurrencyEnum } from '@scandic-hotels/common/constants/currency'
|
||||
import { BookingCodeChip } from '../BookingCodeChip'
|
||||
import { HotelType } from '@scandic-hotels/common/constants/hotelType'
|
||||
import { TripAdvisorChip } from '../TripAdvisorChip'
|
||||
import { CurrencyEnum } from '@scandic-hotels/common/constants/currency'
|
||||
|
||||
type Price = {
|
||||
pricePerStay: number
|
||||
@@ -57,47 +57,48 @@ export type HotelCardProps = {
|
||||
tripAdvisor?: number
|
||||
}
|
||||
}
|
||||
prices: {
|
||||
public?: {
|
||||
rateType: RateTypeEnum
|
||||
localPrice: Price
|
||||
requestedPrice?: Price
|
||||
}
|
||||
member?: {
|
||||
rateType: RateTypeEnum
|
||||
localPrice: Price
|
||||
requestedPrice?: Price
|
||||
}
|
||||
voucher?: {
|
||||
numberOfVouchers: number
|
||||
rateCode: string
|
||||
rateType: RateTypeEnum
|
||||
}
|
||||
bonusCheque?: {
|
||||
rateCode: string
|
||||
rateType: RateTypeEnum
|
||||
localPrice: {
|
||||
additionalPricePerStay: number
|
||||
currency: CurrencyEnum | null | undefined
|
||||
numberOfCheques: number
|
||||
prices:
|
||||
| {
|
||||
public?: {
|
||||
rateType: RateTypeEnum
|
||||
localPrice: Price
|
||||
requestedPrice?: Price
|
||||
}
|
||||
member?: {
|
||||
rateType: RateTypeEnum
|
||||
localPrice: Price
|
||||
requestedPrice?: Price
|
||||
}
|
||||
voucher?: {
|
||||
numberOfVouchers: number
|
||||
rateCode: string
|
||||
rateType: RateTypeEnum
|
||||
}
|
||||
bonusCheque?: {
|
||||
rateCode: string
|
||||
rateType: RateTypeEnum
|
||||
localPrice: {
|
||||
additionalPricePerStay: number
|
||||
currency: CurrencyEnum | null | undefined
|
||||
numberOfCheques: number
|
||||
}
|
||||
requestedPrice?: {
|
||||
additionalPricePerStay: number
|
||||
currency: CurrencyEnum | null | undefined
|
||||
numberOfCheques: number
|
||||
}
|
||||
}
|
||||
redemptions?: {
|
||||
rateCode: string
|
||||
hasEnoughPoints: boolean
|
||||
localPrice: {
|
||||
additionalPricePerStay: number
|
||||
pointsPerStay: number
|
||||
currency: CurrencyEnum | null | undefined
|
||||
}
|
||||
}[]
|
||||
}
|
||||
requestedPrice?: {
|
||||
additionalPricePerStay: number
|
||||
currency: CurrencyEnum | null | undefined
|
||||
numberOfCheques: number
|
||||
}
|
||||
}
|
||||
redemptions?: {
|
||||
rateCode: string
|
||||
hasEnoughPoints: boolean
|
||||
localPrice: {
|
||||
additionalPricePerStay: number
|
||||
pointsPerStay: number
|
||||
currency: string
|
||||
}
|
||||
}[]
|
||||
}
|
||||
|
||||
| undefined
|
||||
images: GalleryImage[]
|
||||
distanceToCityCenter: number
|
||||
isUserLoggedIn: boolean
|
||||
@@ -105,6 +106,7 @@ export type HotelCardProps = {
|
||||
state?: 'default' | 'active'
|
||||
bookingCode?: string | null
|
||||
isAlternative?: boolean
|
||||
fullPrice: boolean
|
||||
|
||||
lang: Lang
|
||||
|
||||
@@ -128,6 +130,7 @@ export const HotelCard = memo(
|
||||
images,
|
||||
lang,
|
||||
belowInfoSlot,
|
||||
fullPrice,
|
||||
onAddressClick,
|
||||
onHover,
|
||||
onHoverEnd,
|
||||
@@ -151,16 +154,15 @@ export const HotelCard = memo(
|
||||
}
|
||||
|
||||
const addressStr = `${hotel.address.streetAddress}, ${hotel.address.city}`
|
||||
const fullPrice = !bookingCode
|
||||
|
||||
const hasInsufficientPoints = !prices.redemptions?.some(
|
||||
const hasInsufficientPoints = !prices?.redemptions?.some(
|
||||
(r) => r.hasEnoughPoints
|
||||
)
|
||||
const notEnoughPointsLabel = intl.formatMessage({
|
||||
defaultMessage: 'Not enough points',
|
||||
})
|
||||
|
||||
const isDisabled = prices.redemptions?.length && hasInsufficientPoints
|
||||
const isDisabled = prices?.redemptions?.length && hasInsufficientPoints
|
||||
|
||||
return (
|
||||
<article
|
||||
|
||||
Reference in New Issue
Block a user