From e26a2aec85331ec91a0f2c2ee6a84d3a006c0adf Mon Sep 17 00:00:00 2001 From: Fredrik Thorsson Date: Fri, 30 Aug 2024 13:53:12 +0200 Subject: [PATCH] feat(SW-176): add enum --- .../(public)/hotelreservation/[section]/page.tsx | 3 ++- .../(public)/hotelreservation/select-hotel/page.tsx | 11 +++++++---- i18n/dictionaries/da.json | 1 + i18n/dictionaries/de.json | 2 +- i18n/dictionaries/en.json | 1 + i18n/dictionaries/sv.json | 2 +- server/routers/hotels/output.ts | 2 +- .../hotelReservation/selectHotel/selectHotel.ts | 4 ++++ 8 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 types/components/hotelReservation/selectHotel/selectHotel.ts diff --git a/app/[lang]/(live)/(public)/hotelreservation/[section]/page.tsx b/app/[lang]/(live)/(public)/hotelreservation/[section]/page.tsx index ecd62644b..45ca7d308 100644 --- a/app/[lang]/(live)/(public)/hotelreservation/[section]/page.tsx +++ b/app/[lang]/(live)/(public)/hotelreservation/[section]/page.tsx @@ -107,7 +107,8 @@ export default async function SectionsPage({ return (
-
Hotel Card TBI
+ {/* TODO: Add Hotel Listing Card */} +
Hotel Listing Card TBI
diff --git a/app/[lang]/(live)/(public)/hotelreservation/select-hotel/page.tsx b/app/[lang]/(live)/(public)/hotelreservation/select-hotel/page.tsx index 56302d36b..24b53a6b9 100644 --- a/app/[lang]/(live)/(public)/hotelreservation/select-hotel/page.tsx +++ b/app/[lang]/(live)/(public)/hotelreservation/select-hotel/page.tsx @@ -11,6 +11,7 @@ import { setLang } from "@/i18n/serverContext" import styles from "./page.module.css" +import { AvailabilityEnum } from "@/types/components/hotelReservation/selectHotel/selectHotel" import { LangParams, PageArgs } from "@/types/params" export default async function SelectHotelPage({ @@ -35,10 +36,12 @@ export default async function SelectHotelPage({ const { availability } = availabilityResponse - const filterAvailability = availability.data - .filter((hotels) => hotels.attributes.status === "Available") + const availableHotels = availability.data + .filter((hotels) => hotels.attributes.status === AvailabilityEnum.Available) .flatMap((hotels) => hotels.attributes) + console.log(availableHotels) + return (
@@ -56,8 +59,8 @@ export default async function SelectHotelPage({
- {filterAvailability.length ? ( - filterAvailability.map((hotel) => ( + {availableHotels.length ? ( + availableHotels.map((hotel) => (