import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" import { Divider } from "@scandic-hotels/design-system/Divider" import { Typography } from "@scandic-hotels/design-system/Typography" import { getIntl } from "@/i18n" import styles from "./total.module.css" import type { TotalProps } from "@/types/components/hotelReservation/myStay/receipt" export default async function Total({ booking, currency }: TotalProps) { const intl = await getIntl() const totalPriceInMoney = booking.totalPrice const totalPriceInMoneyExclVat = booking.totalPriceExVat const totalVat = booking.vatAmount const totalPriceInPoints = booking.ancillaries .filter((a) => a.currency === CurrencyEnum.POINTS) .reduce((acc, curr) => acc + curr.totalPrice, 0) const moneyString = totalPriceInMoney > 0 ? `${totalPriceInMoney} ${currency}` : "" const pointsString = totalPriceInPoints > 0 ? intl.formatMessage( { id: "common.numberOfPoints", defaultMessage: "{points, plural, one {# point} other {# points}}", }, { points: totalPriceInPoints } ) : "" const plusString = moneyString && pointsString ? " + " : "" return (