feat(SW-914): add parking logic

This commit is contained in:
Fredrik Thorsson
2024-11-28 16:35:21 +01:00
parent d2e214ed6c
commit 3524b62f6c
10 changed files with 28 additions and 19 deletions

View File

@@ -8,6 +8,7 @@ import type { ParkingPricesProps } from "@/types/components/hotelPage/sidepeek/p
export default async function ParkingPrices({ export default async function ParkingPrices({
data, data,
currency, currency,
freeParking,
}: ParkingPricesProps) { }: ParkingPricesProps) {
const intl = await getIntl() const intl = await getIntl()
const day = intl.formatMessage({ id: "Price per day" }) const day = intl.formatMessage({ id: "Price per day" })
@@ -27,22 +28,23 @@ export default async function ParkingPrices({
const filterdPeriods = data?.filter((filter) => filter.period !== "Hour") const filterdPeriods = data?.filter((filter) => filter.period !== "Hour")
console.log("Parking log:", data)
return ( return (
<div className={styles.wrapper}> <div className={styles.wrapper}>
{filterdPeriods?.map((parking) => { {filterdPeriods?.map((parking) => (
return (
<div key={parking.period} className={styles.period}> <div key={parking.period} className={styles.period}>
<div className={styles.information}> <div className={styles.information}>
<Body textTransform="bold" color="uiTextHighContrast"> <Body textTransform="bold" color="uiTextHighContrast">
{getPeriod(parking.period)} {getPeriod(parking.period)}
</Body> </Body>
<Body color="uiTextHighContrast"> <Body color="uiTextHighContrast">
{`${parking.amount} ${currency}`} {freeParking
? intl.formatMessage({ id: "Free parking" })
: `${parking.amount} ${currency}`}
</Body> </Body>
</div> </div>
{parking.startTime && parking.endTime && ( {parking.startTime &&
parking.endTime &&
parking.period !== "AllDay" && (
<div className={styles.information}> <div className={styles.information}>
<Body color="uiTextHighContrast"> <Body color="uiTextHighContrast">
{intl.formatMessage({ id: "From" })} {intl.formatMessage({ id: "From" })}
@@ -53,8 +55,7 @@ export default async function ParkingPrices({
</div> </div>
)} )}
</div> </div>
) ))}
})}
</div> </div>
) )
} }

View File

@@ -54,6 +54,7 @@ export default async function ParkingAmenity({ parking }: ParkingAmenityProps) {
<ParkingPrices <ParkingPrices
data={data.pricing.localCurrency.ordinary} data={data.pricing.localCurrency.ordinary}
currency={data.pricing.localCurrency.currency} currency={data.pricing.localCurrency.currency}
freeParking={data.pricing.freeParking}
/> />
</div> </div>
<div className={styles.weekend}> <div className={styles.weekend}>
@@ -64,6 +65,7 @@ export default async function ParkingAmenity({ parking }: ParkingAmenityProps) {
<ParkingPrices <ParkingPrices
data={data.pricing.localCurrency.weekend} data={data.pricing.localCurrency.weekend}
currency={data.pricing.localCurrency.currency} currency={data.pricing.localCurrency.currency}
freeParking={data.pricing.freeParking}
/> />
</div> </div>
</div> </div>

View File

@@ -178,7 +178,6 @@ export default async function HotelPage({ hotelId }: HotelPageProps) {
</> </>
) : null} ) : null}
<SidePeekProvider> <SidePeekProvider>
{/* eslint-disable import/no-named-as-default-member */}
<AmenitiesSidePeek <AmenitiesSidePeek
amenitiesList={detailedFacilities} amenitiesList={detailedFacilities}
parking={parking} parking={parking}

View File

@@ -140,6 +140,7 @@
"Food options": "Madvalg", "Food options": "Madvalg",
"Former Scandic Hotel": "Tidligere Scandic Hotel", "Former Scandic Hotel": "Tidligere Scandic Hotel",
"Free cancellation": "Gratis afbestilling", "Free cancellation": "Gratis afbestilling",
"Free parking": "Gratis parkering",
"Free rebooking": "Gratis ombooking", "Free rebooking": "Gratis ombooking",
"From": "Fra", "From": "Fra",
"Garage": "Garage", "Garage": "Garage",

View File

@@ -140,6 +140,7 @@
"Food options": "Speisen & Getränke", "Food options": "Speisen & Getränke",
"Former Scandic Hotel": "Ehemaliges Scandic Hotel", "Former Scandic Hotel": "Ehemaliges Scandic Hotel",
"Free cancellation": "Kostenlose Stornierung", "Free cancellation": "Kostenlose Stornierung",
"Free parking": "Kostenloses Parken",
"Free rebooking": "Kostenlose Umbuchung", "Free rebooking": "Kostenlose Umbuchung",
"From": "Fromm", "From": "Fromm",
"Garage": "Garage", "Garage": "Garage",

View File

@@ -149,6 +149,7 @@
"Food options": "Food options", "Food options": "Food options",
"Former Scandic Hotel": "Former Scandic Hotel", "Former Scandic Hotel": "Former Scandic Hotel",
"Free cancellation": "Free cancellation", "Free cancellation": "Free cancellation",
"Free parking": "Free parking",
"Free rebooking": "Free rebooking", "Free rebooking": "Free rebooking",
"Free until": "Free until", "Free until": "Free until",
"From": "From", "From": "From",

View File

@@ -140,6 +140,7 @@
"Food options": "Ruokavalio", "Food options": "Ruokavalio",
"Former Scandic Hotel": "Entinen Scandic-hotelli", "Former Scandic Hotel": "Entinen Scandic-hotelli",
"Free cancellation": "Ilmainen peruutus", "Free cancellation": "Ilmainen peruutus",
"Free parking": "Ilmainen pysäköinti",
"Free rebooking": "Ilmainen uudelleenvaraus", "Free rebooking": "Ilmainen uudelleenvaraus",
"From": "From", "From": "From",
"Garage": "Autotalli", "Garage": "Autotalli",

View File

@@ -139,6 +139,7 @@
"Food options": "Matvalg", "Food options": "Matvalg",
"Former Scandic Hotel": "Tidligere Scandic-hotell", "Former Scandic Hotel": "Tidligere Scandic-hotell",
"Free cancellation": "Gratis avbestilling", "Free cancellation": "Gratis avbestilling",
"Free parking": "Gratis parkering",
"Free rebooking": "Gratis ombooking", "Free rebooking": "Gratis ombooking",
"From": "Fra", "From": "Fra",
"Garage": "Garasje", "Garage": "Garasje",

View File

@@ -139,6 +139,7 @@
"Food options": "Matval", "Food options": "Matval",
"Former Scandic Hotel": "Tidigare Scandichotell", "Former Scandic Hotel": "Tidigare Scandichotell",
"Free cancellation": "Fri avbokning", "Free cancellation": "Fri avbokning",
"Free parking": "Gratis parkering",
"Free rebooking": "Fri ombokning", "Free rebooking": "Fri ombokning",
"From": "Från", "From": "Från",
"Garage": "Garage", "Garage": "Garage",

View File

@@ -6,5 +6,6 @@ export type ParkingAmenityProps = {
export type ParkingPricesProps = { export type ParkingPricesProps = {
data: Hotel["parking"][number]["pricing"]["localCurrency"]["ordinary"] data: Hotel["parking"][number]["pricing"]["localCurrency"]["ordinary"]
currency?: Hotel["parking"][number]["pricing"]["localCurrency"]["currency"] currency: Hotel["parking"][number]["pricing"]["localCurrency"]["currency"]
freeParking: Hotel["parking"][number]["pricing"]["freeParking"]
} }