Refactor and fixed bug
This commit is contained in:
@@ -9,7 +9,7 @@ import type { LangParams, PageArgs } from "@/types/params"
|
|||||||
export default function HotelReservationPage({ params }: PageArgs<LangParams>) {
|
export default function HotelReservationPage({ params }: PageArgs<LangParams>) {
|
||||||
setLang(params.lang)
|
setLang(params.lang)
|
||||||
|
|
||||||
if (!env.ENABLE_BOOKING_FLOW) {
|
if (!env.ENABLE_BOOKING_WIDGET_HOTELRESERVATION_PATH) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
import { notFound } from "next/navigation"
|
|
||||||
|
|
||||||
import { env } from "@/env/server"
|
|
||||||
|
|
||||||
import styles from "./layout.module.css"
|
import styles from "./layout.module.css"
|
||||||
|
|
||||||
import { LangParams, LayoutArgs } from "@/types/params"
|
import { LangParams, LayoutArgs } from "@/types/params"
|
||||||
@@ -12,9 +8,6 @@ export default function HotelReservationLayout({
|
|||||||
}: React.PropsWithChildren<
|
}: React.PropsWithChildren<
|
||||||
LayoutArgs<LangParams> & { modal: React.ReactNode }
|
LayoutArgs<LangParams> & { modal: React.ReactNode }
|
||||||
>) {
|
>) {
|
||||||
if (env.HIDE_FOR_NEXT_RELEASE) {
|
|
||||||
return notFound()
|
|
||||||
}
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.layout}>
|
<div className={styles.layout}>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
export { default } from "../../page"
|
export { default } from "../page"
|
||||||
|
|||||||
17
app/[lang]/(live)/@bookingwidget/hotelreservation/page.tsx
Normal file
17
app/[lang]/(live)/@bookingwidget/hotelreservation/page.tsx
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import { env } from "@/env/server"
|
||||||
|
|
||||||
|
import BookingWidget, { preload } from "@/components/BookingWidget"
|
||||||
|
|
||||||
|
import { PageArgs } from "@/types/params"
|
||||||
|
|
||||||
|
export default async function BookingWidgetPage({
|
||||||
|
searchParams,
|
||||||
|
}: PageArgs<{}, URLSearchParams>) {
|
||||||
|
if (!env.ENABLE_BOOKING_WIDGET_HOTELRESERVATION_PATH) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
preload()
|
||||||
|
|
||||||
|
return <BookingWidget searchParams={searchParams} />
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@ import { env } from "@/env/server"
|
|||||||
import { BookingWidgetSkeleton } from "@/components/BookingWidget/Client"
|
import { BookingWidgetSkeleton } from "@/components/BookingWidget/Client"
|
||||||
|
|
||||||
export default function LoadingBookingWidget() {
|
export default function LoadingBookingWidget() {
|
||||||
if (env.HIDE_FOR_NEXT_RELEASE) {
|
if (!env.ENABLE_BOOKING_FLOW) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { PageArgs } from "@/types/params"
|
|||||||
export default async function BookingWidgetPage({
|
export default async function BookingWidgetPage({
|
||||||
searchParams,
|
searchParams,
|
||||||
}: PageArgs<{}, URLSearchParams>) {
|
}: PageArgs<{}, URLSearchParams>) {
|
||||||
if (!env.ENABLE_BOOKING_WIDGET_HOTELRESERVATION_PATH) {
|
if (!env.ENABLE_BOOKING_WIDGET) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user