Fix/SW-2429 map view
* feat(SW-2429): Removed [contentType]>[uid] and use app router based structure for content types * feat(SW-2429): Added breadcrumbs to follow contenttype folder structure * feat(SW-2429): Removed modal/dialog functionality from map views on hotel and destination pages * fix(SW-2429): Fixed issue with booking widget on meeting pages. Also used same structure for content types Approved-by: Arvid Norlin
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { env } from "@/env/server"
|
||||
import { getDestinationCityPage } from "@/lib/trpc/memoizedRequests"
|
||||
|
||||
import BookingWidget from "@/components/BookingWidget"
|
||||
|
||||
import type { BookingWidgetSearchData } from "@/types/components/bookingWidget"
|
||||
import type { PageArgs } from "@/types/params"
|
||||
|
||||
export default async function BookingWidgetDestinationCityPage({
|
||||
searchParams,
|
||||
}: PageArgs<{}, BookingWidgetSearchData>) {
|
||||
if (!env.ENABLE_BOOKING_WIDGET) {
|
||||
return null
|
||||
}
|
||||
const { bookingCode } = searchParams
|
||||
const pageData = await getDestinationCityPage()
|
||||
|
||||
const bookingWidgetSearchParams = {
|
||||
bookingCode: bookingCode ?? "",
|
||||
city: pageData?.city.name ?? "",
|
||||
}
|
||||
|
||||
return <BookingWidget bookingWidgetSearchParams={bookingWidgetSearchParams} />
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import { env } from "@/env/server"
|
||||
import { getHotel, getHotelPage } from "@/lib/trpc/memoizedRequests"
|
||||
|
||||
import BookingWidget from "@/components/BookingWidget"
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
|
||||
import type { BookingWidgetSearchData } from "@/types/components/bookingWidget"
|
||||
import type { PageArgs } from "@/types/params"
|
||||
|
||||
export default async function BookingWidgetHotelPage({
|
||||
searchParams,
|
||||
}: PageArgs<{}, BookingWidgetSearchData & { subpage?: string }>) {
|
||||
if (!env.ENABLE_BOOKING_WIDGET) {
|
||||
return null
|
||||
}
|
||||
const { bookingCode, subpage } = searchParams
|
||||
|
||||
const hotelPageData = await getHotelPage()
|
||||
const hotelData = await getHotel({
|
||||
hotelId: hotelPageData?.hotel_page_id || "",
|
||||
language: getLang(),
|
||||
isCardOnlyPayment: false,
|
||||
})
|
||||
|
||||
const isMeetingSubpage =
|
||||
subpage && hotelData?.additionalData.meetingRooms.nameInUrl === subpage
|
||||
|
||||
if (isMeetingSubpage) {
|
||||
return null
|
||||
}
|
||||
|
||||
const bookingWidgetSearchParams = {
|
||||
bookingCode: bookingCode ?? "",
|
||||
hotel: hotelData?.hotel.id ?? "",
|
||||
city: hotelData?.hotel.cityName ?? "",
|
||||
}
|
||||
|
||||
return <BookingWidget bookingWidgetSearchParams={bookingWidgetSearchParams} />
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export default async function BookingWidgetStartPage() {
|
||||
return null
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from "../page"
|
||||
@@ -1,64 +0,0 @@
|
||||
import { env } from "@/env/server"
|
||||
import { getHotel, getHotelPage } from "@/lib/trpc/memoizedRequests"
|
||||
|
||||
import BookingWidget from "@/components/BookingWidget"
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
|
||||
import type { BookingWidgetSearchData } from "@/types/components/bookingWidget"
|
||||
import type { ContentTypeParams, PageArgs } from "@/types/params"
|
||||
import { PageContentTypeEnum } from "@/types/requests/contentType"
|
||||
|
||||
export default async function BookingWidgetPage({
|
||||
params,
|
||||
searchParams,
|
||||
}: PageArgs<ContentTypeParams, BookingWidgetSearchData>) {
|
||||
if (!env.ENABLE_BOOKING_WIDGET) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (params.contentType === PageContentTypeEnum.startPage) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (params.contentType === PageContentTypeEnum.hotelPage) {
|
||||
return (
|
||||
<BookingWidgetOnHotelPage
|
||||
bookingCode={searchParams.bookingCode}
|
||||
subpage={searchParams.subpage}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
return <BookingWidget bookingWidgetSearchParams={searchParams} />
|
||||
}
|
||||
|
||||
async function BookingWidgetOnHotelPage({
|
||||
bookingCode,
|
||||
subpage,
|
||||
}: {
|
||||
bookingCode?: string
|
||||
subpage: string
|
||||
}) {
|
||||
const hotelPageData = await getHotelPage()
|
||||
|
||||
const hotelData = await getHotel({
|
||||
hotelId: hotelPageData?.hotel_page_id || "",
|
||||
language: getLang(),
|
||||
isCardOnlyPayment: false,
|
||||
})
|
||||
|
||||
const isMeetingSubpage =
|
||||
hotelData?.additionalData.meetingRooms.nameInUrl === subpage
|
||||
|
||||
if (isMeetingSubpage) {
|
||||
return null
|
||||
}
|
||||
|
||||
const hotelPageParams = {
|
||||
bookingCode: bookingCode ?? "",
|
||||
hotel: hotelData?.hotel.id ?? "",
|
||||
city: hotelData?.hotel.cityName ?? "",
|
||||
}
|
||||
|
||||
return <BookingWidget bookingWidgetSearchParams={hotelPageParams} />
|
||||
}
|
||||
Reference in New Issue
Block a user