Merge branch 'master' of bitbucket.org:scandic-swap/web into fix/loading-rooms-separately
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import { env } from "@/env/server"
|
||||
|
||||
import CurrentLoadingSpinner from "@/components/Current/LoadingSpinner"
|
||||
import LoadingSpinner from "@/components/LoadingSpinner"
|
||||
|
||||
export default function Loading() {
|
||||
if (env.HIDE_FOR_NEXT_RELEASE) {
|
||||
return <CurrentLoadingSpinner />
|
||||
}
|
||||
return <LoadingSpinner />
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import LoadingSpinner from "@/components/LoadingSpinner"
|
||||
|
||||
export default function Loading() {
|
||||
return <LoadingSpinner fullPage />
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import LoadingSpinner from "@/components/LoadingSpinner"
|
||||
|
||||
export default function Loading() {
|
||||
return <LoadingSpinner fullPage />
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import LoadingSpinner from "@/components/LoadingSpinner"
|
||||
|
||||
export default function Loading() {
|
||||
return <LoadingSpinner fullPage />
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import LoadingSpinner from "@/components/LoadingSpinner"
|
||||
|
||||
export default function LoadingModal() {
|
||||
return <LoadingSpinner />
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
import { MapModal } from "@/components/MapModal"
|
||||
import { setLang } from "@/i18n/serverContext"
|
||||
|
||||
import { fetchAvailableHotels } from "../../utils"
|
||||
import { fetchAvailableHotels, getFiltersFromHotels } from "../../utils"
|
||||
|
||||
import type { SelectHotelSearchParams } from "@/types/components/hotelReservation/selectHotel/selectHotelSearchParams"
|
||||
import type { LangParams, PageArgs } from "@/types/params"
|
||||
@@ -57,6 +57,7 @@ export default async function SelectHotelMapPage({
|
||||
})
|
||||
|
||||
const hotelPins = getHotelPins(hotels)
|
||||
const filterList = getFiltersFromHotels(hotels)
|
||||
|
||||
return (
|
||||
<MapModal>
|
||||
@@ -65,6 +66,7 @@ export default async function SelectHotelMapPage({
|
||||
hotelPins={hotelPins}
|
||||
mapId={googleMapId}
|
||||
hotels={hotels}
|
||||
filterList={filterList}
|
||||
/>
|
||||
</MapModal>
|
||||
)
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
getFiltersFromHotels,
|
||||
} from "@/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/utils"
|
||||
import HotelCardListing from "@/components/HotelReservation/HotelCardListing"
|
||||
import HotelCount from "@/components/HotelReservation/SelectHotel/HotelCount"
|
||||
import HotelFilter from "@/components/HotelReservation/SelectHotel/HotelFilter"
|
||||
import HotelSorter from "@/components/HotelReservation/SelectHotel/HotelSorter"
|
||||
import MobileMapButtonContainer from "@/components/HotelReservation/SelectHotel/MobileMapButtonContainer"
|
||||
@@ -20,7 +21,6 @@ import StaticMap from "@/components/Maps/StaticMap"
|
||||
import Alert from "@/components/TempDesignSystem/Alert"
|
||||
import Button from "@/components/TempDesignSystem/Button"
|
||||
import Link from "@/components/TempDesignSystem/Link"
|
||||
import Preamble from "@/components/TempDesignSystem/Text/Preamble"
|
||||
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
||||
import { getIntl } from "@/i18n"
|
||||
import { setLang } from "@/i18n/serverContext"
|
||||
@@ -66,13 +66,15 @@ export default async function SelectHotelPage({
|
||||
|
||||
const filterList = getFiltersFromHotels(hotels)
|
||||
|
||||
const isAllUnavailable = hotels.every((hotel) => hotel.price === undefined)
|
||||
|
||||
return (
|
||||
<>
|
||||
<header className={styles.header}>
|
||||
<div className={styles.title}>
|
||||
<div className={styles.cityInformation}>
|
||||
<Subtitle>{city.name}</Subtitle>
|
||||
<Preamble>{hotels.length} hotels</Preamble>
|
||||
<HotelCount />
|
||||
</div>
|
||||
<div className={styles.sorter}>
|
||||
<HotelSorter discreet />
|
||||
@@ -123,7 +125,7 @@ export default async function SelectHotelPage({
|
||||
<HotelFilter filters={filterList} className={styles.filter} />
|
||||
</div>
|
||||
<div className={styles.hotelList}>
|
||||
{!hotels.length && (
|
||||
{isAllUnavailable && (
|
||||
<Alert
|
||||
type={AlertTypeEnum.Info}
|
||||
heading={intl.formatMessage({ id: "No availability" })}
|
||||
|
||||
@@ -19,6 +19,15 @@ const hotelSurroundingsFilterNames = [
|
||||
"Omgivningar",
|
||||
]
|
||||
|
||||
const hotelFacilitiesFilterNames = [
|
||||
"Hotel facilities",
|
||||
"Hotellfaciliteter",
|
||||
"Hotelfaciliteter",
|
||||
"Hotel faciliteter",
|
||||
"Hotel-Infos",
|
||||
"Hotellin palvelut",
|
||||
]
|
||||
|
||||
export async function fetchAvailableHotels(
|
||||
input: AvailabilityInput
|
||||
): Promise<HotelData[]> {
|
||||
@@ -52,6 +61,7 @@ export function getFiltersFromHotels(hotels: HotelData[]): CategorizedFilters {
|
||||
const filterList: Filter[] = uniqueFilterIds
|
||||
.map((filterId) => filters.find((filter) => filter.id === filterId))
|
||||
.filter((filter): filter is Filter => filter !== undefined)
|
||||
.sort((a, b) => b.sortOrder - a.sortOrder)
|
||||
|
||||
return filterList.reduce<CategorizedFilters>(
|
||||
(acc, filter) => {
|
||||
@@ -61,10 +71,13 @@ export function getFiltersFromHotels(hotels: HotelData[]): CategorizedFilters {
|
||||
surroundingsFilters: [...acc.surroundingsFilters, filter],
|
||||
}
|
||||
|
||||
return {
|
||||
facilityFilters: [...acc.facilityFilters, filter],
|
||||
surroundingsFilters: acc.surroundingsFilters,
|
||||
}
|
||||
if (filter.filter && hotelFacilitiesFilterNames.includes(filter.filter))
|
||||
return {
|
||||
facilityFilters: [...acc.facilityFilters, filter],
|
||||
surroundingsFilters: acc.surroundingsFilters,
|
||||
}
|
||||
|
||||
return acc
|
||||
},
|
||||
{ facilityFilters: [], surroundingsFilters: [] }
|
||||
)
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
import LoadingSpinner from "@/components/LoadingSpinner"
|
||||
|
||||
export default function LoadingSummaryHeader() {
|
||||
return <LoadingSpinner />
|
||||
}
|
||||
@@ -83,10 +83,10 @@ export default async function SummaryPage({
|
||||
price: availability.publicRate.localPrice.pricePerStay,
|
||||
currency: availability.publicRate.localPrice.currency,
|
||||
},
|
||||
euro: availability.publicRate.requestedPrice
|
||||
euro: availability.publicRate?.requestedPrice
|
||||
? {
|
||||
price: availability.publicRate.requestedPrice.pricePerStay,
|
||||
currency: availability.publicRate.requestedPrice.currency,
|
||||
price: availability.publicRate?.requestedPrice.pricePerStay,
|
||||
currency: availability.publicRate?.requestedPrice.currency,
|
||||
}
|
||||
: undefined,
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import "./enterDetailsLayout.css"
|
||||
|
||||
import { notFound, redirect, RedirectType } from "next/navigation"
|
||||
import { notFound } from "next/navigation"
|
||||
|
||||
import {
|
||||
getBreakfastPackages,
|
||||
@@ -38,6 +38,8 @@ export default async function StepPage({
|
||||
}: PageArgs<LangParams, SelectRateSearchParams & { step: StepEnum }>) {
|
||||
const intl = await getIntl()
|
||||
const selectRoomParams = new URLSearchParams(searchParams)
|
||||
selectRoomParams.delete("step")
|
||||
const searchParamsString = selectRoomParams.toString()
|
||||
const {
|
||||
hotel: hotelId,
|
||||
rooms,
|
||||
@@ -111,11 +113,19 @@ export default async function StepPage({
|
||||
publicPrice: roomAvailability.publicRate!.localPrice.pricePerStay,
|
||||
}
|
||||
|
||||
const memberPrice = roomAvailability.memberRate
|
||||
? {
|
||||
price: roomAvailability.memberRate.localPrice.pricePerStay,
|
||||
currency: roomAvailability.memberRate.localPrice.currency,
|
||||
}
|
||||
: undefined
|
||||
|
||||
return (
|
||||
<StepsProvider
|
||||
bedTypes={roomAvailability.bedTypes}
|
||||
breakfastPackages={breakfastPackages}
|
||||
isMember={!!user}
|
||||
searchParams={searchParamsString}
|
||||
step={searchParams.step}
|
||||
>
|
||||
<section>
|
||||
@@ -152,7 +162,7 @@ export default async function StepPage({
|
||||
step={StepEnum.details}
|
||||
label={intl.formatMessage({ id: "Enter your details" })}
|
||||
>
|
||||
<Details user={user} />
|
||||
<Details user={user} memberPrice={memberPrice} />
|
||||
</SectionAccordion>
|
||||
|
||||
<SectionAccordion
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from "../../page"
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from "./page"
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from "../../page"
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from "../../page"
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from "../../page"
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from "./page"
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from "../../page"
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from "../page"
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from "../../page"
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from "./page"
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from "../../page"
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from "../page"
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from "../../page"
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from "./page"
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from "../../page"
|
||||
@@ -13,7 +13,7 @@ export default function SitewideAlertPage({ params }: PageArgs<LangParams>) {
|
||||
}
|
||||
|
||||
setLang(params.lang)
|
||||
preload()
|
||||
void preload()
|
||||
|
||||
return (
|
||||
<Suspense>
|
||||
|
||||
Reference in New Issue
Block a user