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({
data,
currency,
freeParking,
}: ParkingPricesProps) {
const intl = await getIntl()
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")
console.log("Parking log:", data)
return (
<div className={styles.wrapper}>
{filterdPeriods?.map((parking) => {
return (
<div key={parking.period} className={styles.period}>
<div className={styles.information}>
<Body textTransform="bold" color="uiTextHighContrast">
{getPeriod(parking.period)}
</Body>
<Body color="uiTextHighContrast">
{`${parking.amount} ${currency}`}
</Body>
</div>
{parking.startTime && parking.endTime && (
{filterdPeriods?.map((parking) => (
<div key={parking.period} className={styles.period}>
<div className={styles.information}>
<Body textTransform="bold" color="uiTextHighContrast">
{getPeriod(parking.period)}
</Body>
<Body color="uiTextHighContrast">
{freeParking
? intl.formatMessage({ id: "Free parking" })
: `${parking.amount} ${currency}`}
</Body>
</div>
{parking.startTime &&
parking.endTime &&
parking.period !== "AllDay" && (
<div className={styles.information}>
<Body color="uiTextHighContrast">
{intl.formatMessage({ id: "From" })}
@@ -52,9 +54,8 @@ export default async function ParkingPrices({
</Body>
</div>
)}
</div>
)
})}
</div>
))}
</div>
)
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -6,5 +6,6 @@ export type ParkingAmenityProps = {
export type ParkingPricesProps = {
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"]
}