feat(SW-914): add parking

This commit is contained in:
Fredrik Thorsson
2024-11-26 16:13:10 +01:00
parent 0d7874d1c7
commit 65aa5f37ae
16 changed files with 163 additions and 29 deletions

View File

@@ -1,16 +0,0 @@
import AccordionItem from "@/components/TempDesignSystem/Accordion/AccordionItem"
import { getIntl } from "@/i18n"
import { IconName } from "@/types/components/icon"
export default async function MeetingsAmenity() {
const intl = await getIntl()
return (
<AccordionItem
title={intl.formatMessage({ id: "Meetings & Conferences" })}
icon={IconName.Business}
>
Meeting and Conferences
</AccordionItem>
)
}

View File

@@ -1,16 +1,123 @@
import AccordionItem from "@/components/TempDesignSystem/Accordion/AccordionItem"
import Body from "@/components/TempDesignSystem/Text/Body"
import { getIntl } from "@/i18n"
import styles from "./parking.module.css"
import { ParkingProps } from "@/types/components/hotelPage/sidepeek/parking"
import { IconName } from "@/types/components/icon"
export default async function ParkingAmenity() {
export default async function ParkingAmenity({ parking }: ParkingProps) {
const intl = await getIntl()
const hour = intl.formatMessage({ id: "per hour during" })
const day = intl.formatMessage({ id: "per day during" })
const night = intl.formatMessage({ id: "per night during" })
const allDay = intl.formatMessage({ id: "per whole day" })
function translatePeriods(period: string) {
switch (period) {
case "Hour":
return hour
case "Day":
return day
case "Night":
return night
case "AllDay":
return allDay
}
}
const test = parking.map((data) => data.pricing.localCurrency.range)
console.log("dfafda", test)
return (
<AccordionItem
title={intl.formatMessage({ id: "Parking" })}
icon={IconName.Parking}
>
Parking
<div className={styles.wrapper}>
{parking.map((data) => (
<>
<div key={data.type} className={styles.information}>
<Body textTransform="bold">{`${data.type} (${data.name})`}</Body>
<Body color="uiTextHighContrast" asChild>
<ul>
{data.numberOfChargingSpaces && (
<li>{`Number of charging points for electric cars: ${data.numberOfChargingSpaces}`}</li>
)}
{data.canMakeReservation && (
<li>{`${intl.formatMessage({ id: "Parking can be reserved in advance" })}: ${data.canMakeReservation ? intl.formatMessage({ id: "Yes" }) : intl.formatMessage({ id: "No" })}`}</li>
)}
{data.numberOfParkingSpots && (
<li>{`${intl.formatMessage({ id: "Number of parking spots" })}: ${data.numberOfParkingSpots}`}</li>
)}
{data.distanceToHotel && (
<li>{`${intl.formatMessage({ id: "Distance to hotel" })}: ${data.distanceToHotel}`}</li>
)}
{data.address && (
<li>{`${intl.formatMessage({ id: "Address" })}: ${data.address}`}</li>
)}
</ul>
</Body>
</div>
<div>
<Body textTransform="bold">
{intl.formatMessage({ id: "Prices" })}
</Body>
<div className={styles.prices}>
<div>
{data.pricing.localCurrency.ordinary && (
<>
<Body color="uiTextMediumContrast">
{intl.formatMessage({ id: "Weekday" })}
</Body>
{data.pricing.localCurrency.ordinary.map((ordinary) => {
return (
ordinary.amount &&
ordinary.period &&
ordinary.startTime &&
ordinary.endTime && (
<Body
key={ordinary.period}
color="uiTextHighContrast"
>
{`${ordinary.amount} ${translatePeriods(ordinary.period)} ${ordinary.startTime}-${ordinary.endTime}`}
</Body>
)
)
})}
</>
)}
</div>
<div>
{data.pricing.localCurrency.weekend && (
<>
<Body color="uiTextMediumContrast">
{intl.formatMessage({ id: "Weekday" })}
</Body>
{data.pricing.localCurrency.weekend.map((weekend) => {
return (
weekend.amount &&
weekend.period &&
weekend.startTime &&
weekend.endTime && (
<Body
key={weekend.period}
color="uiTextHighContrast"
>
{`${weekend.amount} ${translatePeriods(weekend.period)} ${weekend.startTime}-${weekend.endTime}`}
</Body>
)
)
})}
</>
)}
</div>
</div>
</div>
</>
))}
</div>
</AccordionItem>
)
}

View File

@@ -0,0 +1,18 @@
.wrapper {
display: flex;
flex-direction: column;
gap: var(--Spacing-x3);
overflow: hidden;
}
.information {
display: flex;
flex-direction: column;
gap: var(--Spacing-x-one-and-half);
}
.prices {
display: flex;
flex-direction: column;
gap: var(--Spacing-x1);
}

View File

@@ -1,5 +1,4 @@
export { default as AccessibilityAmenity } from "./Accessibility"
export { default as BreakfastAmenity } from "./Breakfast"
export { default as CheckInCheckOutAmenity } from "./CheckInCheckOut"
export { default as MeetingsAmenity } from "./Meetings"
export { default as ParkingAmenity } from "./Parking"

View File

@@ -10,7 +10,7 @@ import type { AmenityProps } from "@/types/components/hotelPage/sidepeek/amenity
export default function Amenity({ filteredAmenities }: AmenityProps) {
return (
<>
{filteredAmenities.map((amenity) => {
{filteredAmenities?.map((amenity) => {
const Icon = mapFacilityToIcon(amenity.id)
return (
<div key={amenity.name} className={styles.wrapper}>

View File

@@ -9,7 +9,6 @@ import {
AccessibilityAmenity,
BreakfastAmenity,
CheckInCheckOutAmenity,
MeetingsAmenity,
ParkingAmenity,
} from "./AccordionAmenities"
import Amenity from "./Amenity"
@@ -18,14 +17,18 @@ import type { AmenitiesSidePeekProps } from "@/types/components/hotelPage/sidepe
export default async function AmenitiesSidePeek({
amenitiesList,
parking,
}: AmenitiesSidePeekProps) {
const lang = getLang()
const intl = await getIntl()
const filteredAmenities = amenitiesList
.filter((filter) => !filter.name.startsWith("Parking"))
.filter((filter) => !filter.name.startsWith("Meeting"))
.filter((filter) => filter.name !== "Late check-out until 14:00 guaranteed")
const filteredAmenities = amenitiesList?.filter((filter) => {
return (
!filter.name.startsWith("Parking") &&
filter.name !== "Meeting / conference facilities" &&
filter.name !== "Late check-out until 14:00 guaranteed"
)
})
return (
<SidePeek
@@ -33,11 +36,10 @@ export default async function AmenitiesSidePeek({
title={intl.formatMessage({ id: "Amenities" })}
>
<Accordion>
<ParkingAmenity />
{parking?.length ? <ParkingAmenity parking={parking} /> : null}
<BreakfastAmenity />
<CheckInCheckOutAmenity />
<AccessibilityAmenity />
<MeetingsAmenity />
<Amenity filteredAmenities={filteredAmenities} />
</Accordion>
</SidePeek>

View File

@@ -283,6 +283,7 @@
"Previous victories": "Tidligere sejre",
"Price": "Pris",
"Price details": "Prisoplysninger",
"Prices": "Priser",
"Proceed to login": "Fortsæt til login",
"Proceed to payment method": "Fortsæt til betalingsmetode",
"Provide a payment card in the next step": "Giv os dine betalingsoplysninger i næste skridt",
@@ -394,7 +395,9 @@
"We have a special gift waiting for you!": "Vi har en speciel gave, der venter på dig!",
"We have sent a detailed confirmation of your booking to your email:": "Vi har sendt en detaljeret bekræftelse af din booking til din email:",
"We look forward to your visit!": "Vi ser frem til dit besøg!",
"Weekday": "Ugedag",
"Weekdays": "Hverdage",
"Weekend": "Weekend",
"Weekends": "Weekender",
"Welcome": "Velkommen",
"Welcome to": "Velkommen til",

View File

@@ -282,6 +282,7 @@
"Previous victories": "Bisherige Siege",
"Price": "Preis",
"Price details": "Preisdetails",
"Prices": "Preise",
"Proceed to login": "Weiter zum Login",
"Proceed to payment method": "Weiter zur Zahlungsmethode",
"Provide a payment card in the next step": "Geben Sie Ihre Zahlungskarteninformationen im nächsten Schritt an",
@@ -393,7 +394,9 @@
"We have a special gift waiting for you!": "Wir haben ein besonderes Geschenk für Sie!",
"We have sent a detailed confirmation of your booking to your email:": "Wir haben eine detaillierte Bestätigung Ihrer Buchung an Ihre E-Mail gesendet:",
"We look forward to your visit!": "Wir freuen uns auf Ihren Besuch!",
"Weekday": "Wochentag",
"Weekdays": "Wochentage",
"Weekend": "Wochenende",
"Weekends": "Wochenenden",
"Welcome": "Willkommen",
"Welcome to": "Willkommen zu",

View File

@@ -306,6 +306,7 @@
"Price details": "Price details",
"Price excl VAT": "Price excl VAT",
"Price incl VAT": "Price incl VAT",
"Prices": "Prices",
"Print confirmation": "Print confirmation",
"Proceed to login": "Proceed to login",
"Proceed to payment method": "Proceed to payment method",
@@ -425,7 +426,9 @@
"We have a special gift waiting for you!": "We have a special gift waiting for you!",
"We have sent a detailed confirmation of your booking to your email:": "We have sent a detailed confirmation of your booking to your email: ",
"We look forward to your visit!": "We look forward to your visit!",
"Weekday": "Weekday",
"Weekdays": "Weekdays",
"Weekend": "Weekend",
"Weekends": "Weekends",
"Welcome": "Welcome",
"Welcome to": "Welcome to",

View File

@@ -283,6 +283,7 @@
"Previous victories": "Edelliset voitot",
"Price": "Hinta",
"Price details": "Hintatiedot",
"Prices": "Hinnat",
"Proceed to login": "Jatka kirjautumiseen",
"Proceed to payment method": "Siirry maksutavalle",
"Provide a payment card in the next step": "Anna maksukortin tiedot seuraavassa vaiheessa",
@@ -394,7 +395,9 @@
"We have a special gift waiting for you!": "Meillä on erityinen lahja odottamassa sinua!",
"We have sent a detailed confirmation of your booking to your email:": "Olemme lähettäneet yksityiskohtaisen varausvahvistuksen sähköpostiisi:",
"We look forward to your visit!": "Odotamme innolla vierailuasi!",
"Weekday": "Arkipäivä",
"Weekdays": "Arkisin",
"Weekend": "Viikonloppu",
"Weekends": "Viikonloppuisin",
"Welcome": "Tervetuloa",
"Welcome to": "Tervetuloa",

View File

@@ -281,6 +281,7 @@
"Previous victories": "Tidligere seire",
"Price": "Pris",
"Price details": "Prisdetaljer",
"Prices": "Priser",
"Proceed to login": "Fortsett til innlogging",
"Proceed to payment method": "Fortsett til betalingsmetode",
"Provide a payment card in the next step": "Gi oss dine betalingskortdetaljer i neste steg",
@@ -391,7 +392,9 @@
"We have a special gift waiting for you!": "Vi har en spesiell gave som venter på deg!",
"We have sent a detailed confirmation of your booking to your email:": "Vi har sendt en detaljert bekreftelse av din bestilling til din e-post:",
"We look forward to your visit!": "Vi ser frem til ditt besøk!",
"Weekday": "Ukedag",
"Weekdays": "Hverdager",
"Weekend": "Helg",
"Weekends": "Helger",
"Welcome": "Velkommen",
"Welcome to": "Velkommen til",

View File

@@ -281,6 +281,7 @@
"Previous victories": "Tidigare segrar",
"Price": "Pris",
"Price details": "Prisdetaljer",
"Prices": "Priser",
"Proceed to login": "Fortsätt till inloggning",
"Proceed to payment method": "Gå vidare till betalningsmetod",
"Provide a payment card in the next step": "Ge oss dina betalkortdetaljer i nästa steg",
@@ -391,7 +392,9 @@
"We have a special gift waiting for you!": "Vi har en speciell present som väntar på dig!",
"We have sent a detailed confirmation of your booking to your email:": "Vi har skickat en detaljerad bekräftelse av din bokning till din e-post:",
"We look forward to your visit!": "Vi ser fram emot ditt besök!",
"Weekday": "Vardag",
"Weekdays": "Vardagar",
"Weekend": "Helg",
"Weekends": "Helger",
"Welcome": "Välkommen",
"Welcome to": "Välkommen till",

View File

@@ -1,5 +1,6 @@
import type { Hotel } from "@/types/hotel"
export type AmenitiesSidePeekProps = {
amenitiesList: Hotel["detailedFacilities"]
amenitiesList?: Hotel["detailedFacilities"]
parking?: Hotel["parking"]
}

View File

@@ -1,5 +1,5 @@
import type { Hotel } from "@/types/hotel"
export type AmenityProps = {
filteredAmenities: Hotel["detailedFacilities"]
filteredAmenities?: Hotel["detailedFacilities"]
}

View File

@@ -0,0 +1,5 @@
import type { Hotel } from "@/types/hotel"
export type ParkingProps = {
parking: Hotel["parking"]
}