From 958906d3bf99a0db7f5fc71b7d9c541a5df0bac9 Mon Sep 17 00:00:00 2001 From: Erik Tiekstra Date: Tue, 3 Jun 2025 05:27:41 +0000 Subject: [PATCH] feat(SW-1901): Adjusted parking pricing on hotel pages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Approved-by: Michael Zetterberg Approved-by: Matilda Landström --- .../ParkingPrices/index.tsx | 73 ++++++++++++------- 1 file changed, 46 insertions(+), 27 deletions(-) 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}
))}