feat(SW-237): Updated parallel route to the root layout
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
import BookingWidget from "@/components/BookingWidget"
|
||||
|
||||
export default function BookingWidgetPage() {
|
||||
return <BookingWidget />
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
export default function DefaultBookingWidgetPage() {
|
||||
return null
|
||||
}
|
||||
@@ -3,23 +3,18 @@ import Sidebar from "@/components/MyPages/Sidebar"
|
||||
import styles from "./layout.module.css"
|
||||
|
||||
export default async function MyPagesLayout({
|
||||
bookingwidget,
|
||||
breadcrumbs,
|
||||
children,
|
||||
}: React.PropsWithChildren<{
|
||||
bookingwidget: React.ReactNode
|
||||
breadcrumbs: React.ReactNode
|
||||
}>) {
|
||||
return (
|
||||
<>
|
||||
{bookingwidget}
|
||||
<section className={styles.layout}>
|
||||
{breadcrumbs}
|
||||
<section className={styles.content}>
|
||||
<Sidebar />
|
||||
{children}
|
||||
</section>
|
||||
<section className={styles.layout}>
|
||||
{breadcrumbs}
|
||||
<section className={styles.content}>
|
||||
<Sidebar />
|
||||
{children}
|
||||
</section>
|
||||
</>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import BookingWidget from "@/components/BookingWidget"
|
||||
|
||||
import styles from "./layout.module.css"
|
||||
|
||||
import {
|
||||
@@ -18,12 +16,9 @@ export default function ContentTypeLayout({
|
||||
}
|
||||
>) {
|
||||
return (
|
||||
<>
|
||||
<BookingWidget />
|
||||
<section className={styles.layout}>
|
||||
{breadcrumbs}
|
||||
{children}
|
||||
</section>
|
||||
</>
|
||||
<section className={styles.layout}>
|
||||
{breadcrumbs}
|
||||
{children}
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import BookingWidget from "@/components/BookingWidget"
|
||||
|
||||
import styles from "./layout.module.css"
|
||||
|
||||
import { LangParams, LayoutArgs } from "@/types/params"
|
||||
@@ -7,10 +5,5 @@ import { LangParams, LayoutArgs } from "@/types/params"
|
||||
export default function HotelReservationLayout({
|
||||
children,
|
||||
}: React.PropsWithChildren<LayoutArgs<LangParams>>) {
|
||||
return (
|
||||
<>
|
||||
<BookingWidget />
|
||||
<div className={styles.layout}>{children}</div>
|
||||
</>
|
||||
)
|
||||
return <div className={styles.layout}>{children}</div>
|
||||
}
|
||||
|
||||
1
app/[lang]/(live)/@bookingwidget/[...paths]/page.tsx
Normal file
1
app/[lang]/(live)/@bookingwidget/[...paths]/page.tsx
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from "../page"
|
||||
1
app/[lang]/(live)/@bookingwidget/default.tsx
Normal file
1
app/[lang]/(live)/@bookingwidget/default.tsx
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from "./page"
|
||||
20
app/[lang]/(live)/@bookingwidget/page.tsx
Normal file
20
app/[lang]/(live)/@bookingwidget/page.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import { serverClient } from "@/lib/trpc/server"
|
||||
|
||||
import BookingWidget from "@/components/BookingWidget"
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
|
||||
export default async function BookingWidgetPage() {
|
||||
// Get the booking widget show/hide status based on page specific settings
|
||||
const bookingWidgetToggle =
|
||||
await serverClient().contentstack.base.page_settings({
|
||||
lang: getLang(),
|
||||
})
|
||||
|
||||
return (
|
||||
<>
|
||||
{bookingWidgetToggle && bookingWidgetToggle.hideBookingWidget ? null : (
|
||||
<BookingWidget />
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -21,9 +21,11 @@ export default async function RootLayout({
|
||||
children,
|
||||
params,
|
||||
header,
|
||||
bookingwidget,
|
||||
}: React.PropsWithChildren<
|
||||
LayoutArgs<LangParams> & {
|
||||
header: React.ReactNode
|
||||
bookingwidget: React.ReactNode
|
||||
}
|
||||
>) {
|
||||
setLang(params.lang)
|
||||
@@ -52,6 +54,7 @@ export default async function RootLayout({
|
||||
<ServerIntlProvider intl={{ defaultLocale, locale, messages }}>
|
||||
<TrpcProvider>
|
||||
{header}
|
||||
{bookingwidget}
|
||||
{children}
|
||||
<ToastHandler />
|
||||
<Footer />
|
||||
|
||||
@@ -1,24 +1,11 @@
|
||||
import { serverClient } from "@/lib/trpc/server"
|
||||
|
||||
import Form from "@/components/Forms/BookingWidget"
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
|
||||
import styles from "./bookingWidget.module.css"
|
||||
|
||||
export default async function BookingWidget() {
|
||||
// Get the booking widget show/hide status based on page specific settings
|
||||
const bookingWidgetToggle =
|
||||
await serverClient().contentstack.base.page_settings({
|
||||
lang: getLang(),
|
||||
})
|
||||
|
||||
return (
|
||||
<>
|
||||
{bookingWidgetToggle && bookingWidgetToggle.hideBookingWidget ? null : (
|
||||
<section className={styles.container}>
|
||||
<Form />
|
||||
</section>
|
||||
)}
|
||||
</>
|
||||
<section className={styles.container}>
|
||||
<Form />
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user