feat: translate Voucher everywhere during booking flow
This commit is contained in:
committed by
Simon.Emanuelsson
parent
a0b0ed2544
commit
59f4a27cb1
@@ -1,6 +1,7 @@
|
||||
import { cx } from "class-variance-authority"
|
||||
import { useIntl } from "react-intl"
|
||||
|
||||
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||
|
||||
import { formatPrice } from "@/utils/numberFormatting"
|
||||
@@ -21,10 +22,14 @@ export default function LargeRow({
|
||||
price,
|
||||
}: RowProps) {
|
||||
const intl = useIntl()
|
||||
const isVoucherRate = price.local.currency === CurrencyEnum.Voucher
|
||||
const currency = isVoucherRate
|
||||
? intl.formatMessage({ defaultMessage: "Voucher" })
|
||||
: price.local.currency
|
||||
const totalPrice = formatPrice(
|
||||
intl,
|
||||
price.local.price,
|
||||
price.local.currency,
|
||||
currency,
|
||||
price.local.additionalPrice,
|
||||
price.local.additionalPriceCurrency
|
||||
)
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
"use client"
|
||||
import { useIntl } from "react-intl"
|
||||
|
||||
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
||||
|
||||
import { formatPrice } from "@/utils/numberFormatting"
|
||||
|
||||
import BoldRow from "../Bold"
|
||||
@@ -37,17 +35,19 @@ export default function VoucherPrice({
|
||||
return null
|
||||
}
|
||||
|
||||
const voucherCurrency = intl.formatMessage({ defaultMessage: "Voucher" })
|
||||
|
||||
const averagePriceTitle = intl.formatMessage({
|
||||
defaultMessage: "Average price per night",
|
||||
})
|
||||
|
||||
const averagePricePerNight = `${price.numberOfVouchers / nights} ${CurrencyEnum.Voucher}`
|
||||
const averagePricePerNight = `${price.numberOfVouchers / nights} ${voucherCurrency}`
|
||||
|
||||
return (
|
||||
<>
|
||||
<BoldRow
|
||||
label={intl.formatMessage({ defaultMessage: "Room charge" })}
|
||||
value={formatPrice(intl, price.numberOfVouchers, CurrencyEnum.Voucher)}
|
||||
value={formatPrice(intl, price.numberOfVouchers, voucherCurrency)}
|
||||
/>
|
||||
{nights > 1 ? (
|
||||
<RegularRow label={averagePriceTitle} value={averagePricePerNight} />
|
||||
|
||||
Reference in New Issue
Block a user