From d158aca6fddf4ce2ea54c0c7f824dde1940773d1 Mon Sep 17 00:00:00 2001 From: Pontus Dreij Date: Thu, 14 Nov 2024 16:23:44 +0100 Subject: [PATCH] feat(SW-629): Added no availabilty if no hotels are listed --- .../(standard)/select-hotel/page.module.css | 7 +++ .../(standard)/select-hotel/page.tsx | 50 ++++++++++++++----- .../HotelCardListing/index.tsx | 24 ++++----- .../SelectHotel/HotelFilter/index.tsx | 4 ++ i18n/dictionaries/da.json | 2 + i18n/dictionaries/de.json | 2 + i18n/dictionaries/en.json | 2 + i18n/dictionaries/fi.json | 2 + i18n/dictionaries/no.json | 2 + i18n/dictionaries/sv.json | 2 + 10 files changed, 72 insertions(+), 25 deletions(-) diff --git a/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/page.module.css b/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/page.module.css index d8e3db57e..89de83d4d 100644 --- a/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/page.module.css +++ b/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/page.module.css @@ -38,6 +38,13 @@ flex: 1; } +.hotelList { + flex: 1; + display: flex; + flex-direction: column; + gap: var(--Spacing-x3); +} + @media (min-width: 768px) { .link { display: flex; diff --git a/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/page.tsx b/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/page.tsx index 7ddffacae..4dfefd7ac 100644 --- a/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/page.tsx +++ b/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/page.tsx @@ -17,6 +17,7 @@ import { } from "@/components/HotelReservation/SelectRate/RoomSelection/utils" import { ChevronRightIcon } from "@/components/Icons" import StaticMap from "@/components/Maps/StaticMap" +import Alert from "@/components/TempDesignSystem/Alert" import Link from "@/components/TempDesignSystem/Link" import { getIntl } from "@/i18n" import { setLang } from "@/i18n/serverContext" @@ -24,6 +25,7 @@ import { setLang } from "@/i18n/serverContext" import styles from "./page.module.css" import type { SelectHotelSearchParams } from "@/types/components/hotelReservation/selectHotel/selectHotelSearchParams" +import { AlertTypeEnum } from "@/types/enums/alert" import { LangParams, PageArgs } from "@/types/params" export default async function SelectHotelPage({ @@ -69,12 +71,29 @@ export default async function SelectHotelPage({
- + {hotels.length > 0 ? ( // TODO: Temp fix until API returns hotels that are not available + +
+ +
+ {intl.formatMessage({ id: "Show map" })} + +
+
+ + ) : (
-
- {intl.formatMessage({ id: "Show map" })} - -
- + )}
- +
+ {!hotels.length && ( + + )} + +
) diff --git a/components/HotelReservation/HotelCardListing/index.tsx b/components/HotelReservation/HotelCardListing/index.tsx index 18b491a45..4ba65ed9c 100644 --- a/components/HotelReservation/HotelCardListing/index.tsx +++ b/components/HotelReservation/HotelCardListing/index.tsx @@ -71,19 +71,17 @@ export default function HotelCardListing({ return (
- {hotels?.length ? ( - hotels.map((hotel) => ( - - )) - ) : ( - No hotels found - )} + {hotels?.length + ? hotels.map((hotel) => ( + + )) + : null}
) } diff --git a/components/HotelReservation/SelectHotel/HotelFilter/index.tsx b/components/HotelReservation/SelectHotel/HotelFilter/index.tsx index 97096f909..df6689f2d 100644 --- a/components/HotelReservation/SelectHotel/HotelFilter/index.tsx +++ b/components/HotelReservation/SelectHotel/HotelFilter/index.tsx @@ -50,6 +50,10 @@ export default function HotelFilter({ filters }: HotelFiltersProps) { return () => subscription.unsubscribe() }, [handleSubmit, watch, submitFilter]) + if (!filters.facilityFilters.length && !filters.surroundingsFilters.length) { + return null + } + return (