diff --git a/apps/scandic-web/components/ParkingInformation/ParkingPrices/index.tsx b/apps/scandic-web/components/ParkingInformation/ParkingPrices/index.tsx index 30cebc3c6..1124e2dde 100644 --- a/apps/scandic-web/components/ParkingInformation/ParkingPrices/index.tsx +++ b/apps/scandic-web/components/ParkingInformation/ParkingPrices/index.tsx @@ -22,41 +22,60 @@ export default function ParkingPrices({ }: ParkingPricesProps) { const intl = useIntl() - return freeParking ? ( - -

- {intl.formatMessage({ defaultMessage: "Free parking" })} -

-
- ) : ( -
- {pricing?.map((parking) => ( -
+ if (freeParking) { + return ( + +

+ {intl.formatMessage({ defaultMessage: "Free parking" })} +

+
+ ) + } + + const filteredPricing = pricing.filter((price) => price.amount > 0) + + if (filteredPricing.length === 0) { + return ( +
+
-
{getPeriod(intl, parking.period)}
+
{getPeriod(intl, "Hour")}
- {parking.amount - ? formatPrice(intl, parking.amount, currency) - : intl.formatMessage({ - defaultMessage: "At a cost", - })} + {intl.formatMessage({ + defaultMessage: "At a cost", + })}
- {parking.startTime && - parking.endTime && - parking.period !== Periods.allDay && ( - -
-
{intl.formatMessage({ defaultMessage: "From" })}
- {/* eslint-disable formatjs/no-literal-string-in-jsx */} -
{`${parking.startTime}-${parking.endTime}`}
-
-
- )} +
+
+ ) + } + + return ( +
+ {filteredPricing.map(({ period, amount, startTime, endTime }) => ( +
+
+ +
{getPeriod(intl, period)}
+
+ +
{formatPrice(intl, amount, currency)}
+
+
+ {startTime && endTime && period !== Periods.allDay ? ( + +
+
{intl.formatMessage({ defaultMessage: "From" })}
+ {/* eslint-disable formatjs/no-literal-string-in-jsx */} +
{`${startTime}-${endTime}`}
+
+
+ ) : null}
))}