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"
|
import styles from "./layout.module.css"
|
||||||
|
|
||||||
export default async function MyPagesLayout({
|
export default async function MyPagesLayout({
|
||||||
bookingwidget,
|
|
||||||
breadcrumbs,
|
breadcrumbs,
|
||||||
children,
|
children,
|
||||||
}: React.PropsWithChildren<{
|
}: React.PropsWithChildren<{
|
||||||
bookingwidget: React.ReactNode
|
|
||||||
breadcrumbs: React.ReactNode
|
breadcrumbs: React.ReactNode
|
||||||
}>) {
|
}>) {
|
||||||
return (
|
return (
|
||||||
<>
|
<section className={styles.layout}>
|
||||||
{bookingwidget}
|
{breadcrumbs}
|
||||||
<section className={styles.layout}>
|
<section className={styles.content}>
|
||||||
{breadcrumbs}
|
<Sidebar />
|
||||||
<section className={styles.content}>
|
{children}
|
||||||
<Sidebar />
|
|
||||||
{children}
|
|
||||||
</section>
|
|
||||||
</section>
|
</section>
|
||||||
</>
|
</section>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import BookingWidget from "@/components/BookingWidget"
|
|
||||||
|
|
||||||
import styles from "./layout.module.css"
|
import styles from "./layout.module.css"
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -18,12 +16,9 @@ export default function ContentTypeLayout({
|
|||||||
}
|
}
|
||||||
>) {
|
>) {
|
||||||
return (
|
return (
|
||||||
<>
|
<section className={styles.layout}>
|
||||||
<BookingWidget />
|
{breadcrumbs}
|
||||||
<section className={styles.layout}>
|
{children}
|
||||||
{breadcrumbs}
|
</section>
|
||||||
{children}
|
|
||||||
</section>
|
|
||||||
</>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import BookingWidget from "@/components/BookingWidget"
|
|
||||||
|
|
||||||
import styles from "./layout.module.css"
|
import styles from "./layout.module.css"
|
||||||
|
|
||||||
import { LangParams, LayoutArgs } from "@/types/params"
|
import { LangParams, LayoutArgs } from "@/types/params"
|
||||||
@@ -7,10 +5,5 @@ import { LangParams, LayoutArgs } from "@/types/params"
|
|||||||
export default function HotelReservationLayout({
|
export default function HotelReservationLayout({
|
||||||
children,
|
children,
|
||||||
}: React.PropsWithChildren<LayoutArgs<LangParams>>) {
|
}: React.PropsWithChildren<LayoutArgs<LangParams>>) {
|
||||||
return (
|
return <div className={styles.layout}>{children}</div>
|
||||||
<>
|
|
||||||
<BookingWidget />
|
|
||||||
<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,
|
children,
|
||||||
params,
|
params,
|
||||||
header,
|
header,
|
||||||
|
bookingwidget,
|
||||||
}: React.PropsWithChildren<
|
}: React.PropsWithChildren<
|
||||||
LayoutArgs<LangParams> & {
|
LayoutArgs<LangParams> & {
|
||||||
header: React.ReactNode
|
header: React.ReactNode
|
||||||
|
bookingwidget: React.ReactNode
|
||||||
}
|
}
|
||||||
>) {
|
>) {
|
||||||
setLang(params.lang)
|
setLang(params.lang)
|
||||||
@@ -52,6 +54,7 @@ export default async function RootLayout({
|
|||||||
<ServerIntlProvider intl={{ defaultLocale, locale, messages }}>
|
<ServerIntlProvider intl={{ defaultLocale, locale, messages }}>
|
||||||
<TrpcProvider>
|
<TrpcProvider>
|
||||||
{header}
|
{header}
|
||||||
|
{bookingwidget}
|
||||||
{children}
|
{children}
|
||||||
<ToastHandler />
|
<ToastHandler />
|
||||||
<Footer />
|
<Footer />
|
||||||
|
|||||||
@@ -1,24 +1,11 @@
|
|||||||
import { serverClient } from "@/lib/trpc/server"
|
|
||||||
|
|
||||||
import Form from "@/components/Forms/BookingWidget"
|
import Form from "@/components/Forms/BookingWidget"
|
||||||
import { getLang } from "@/i18n/serverContext"
|
|
||||||
|
|
||||||
import styles from "./bookingWidget.module.css"
|
import styles from "./bookingWidget.module.css"
|
||||||
|
|
||||||
export default async function BookingWidget() {
|
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 (
|
return (
|
||||||
<>
|
<section className={styles.container}>
|
||||||
{bookingWidgetToggle && bookingWidgetToggle.hideBookingWidget ? null : (
|
<Form />
|
||||||
<section className={styles.container}>
|
</section>
|
||||||
<Form />
|
|
||||||
</section>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user