"use client" import { useIntl } from "react-intl" import { formatPrice } from "@/utils/numberFormatting" import BoldRow from "../Bold" import RegularRow from "../Regular" import BedTypeRow from "./BedType" import PackagesRow from "./Packages" import type { SharedPriceRowProps } from "./price" export interface VoucherPriceType { voucher?: { numberOfVouchers: number } } interface VoucherPriceProps extends SharedPriceRowProps { currency: string nights: number price: VoucherPriceType["voucher"] } export default function VoucherPrice({ bedType, currency, nights, packages, price, }: VoucherPriceProps) { const intl = useIntl() if (!price) { return null } const voucherCurrency = intl.formatMessage({ defaultMessage: "Voucher" }) const averagePriceTitle = intl.formatMessage({ defaultMessage: "Average price per night", }) const averagePricePerNight = `${price.numberOfVouchers / nights} ${voucherCurrency}` return ( <> {nights > 1 ? ( ) : null} ) }