import Body from "@/components/TempDesignSystem/Text/Body" import { getIntl } from "@/i18n" import { formatPrice } from "@/utils/numberFormatting" import styles from "./parkingPrices.module.css" import { type ParkingPricesProps, Periods, } from "@/types/components/hotelPage/sidepeek/parking" export default async function ParkingPrices({ currency = "", freeParking, pricing, }: ParkingPricesProps) { const intl = await getIntl() const day = intl.formatMessage({ id: "Price per day" }) const night = intl.formatMessage({ id: "Price per night" }) const allDay = intl.formatMessage({ id: "Price per 24 hours" }) function getPeriod(period?: string) { switch (period) { case Periods.day: return day case Periods.night: return night case Periods.allDay: return allDay default: return period } } const filteredPeriods = pricing?.filter((filter) => filter.period !== "Hour") return (
{filteredPeriods?.map((parking) => (
{getPeriod(parking.period)} {parking.amount ? freeParking ? intl.formatMessage({ id: "Free parking" }) : formatPrice(intl, parking.amount, currency) : intl.formatMessage({ id: "N/A" })}
{parking.startTime && parking.endTime && parking.period !== Periods.allDay && (
{intl.formatMessage({ id: "From" })} {`${parking.startTime}-${parking.endTime}`}
)}
))}
) }