Replace reverse-proxy/iframe approach with @ebook/@community/@navmini imports under /nav /book /community so localhost:3000 serves all three products directly. Co-authored-by: Cursor <cursoragent@cursor.com>
62 lines
1.8 KiB
TypeScript
62 lines
1.8 KiB
TypeScript
import { AntdRegistry } from "@ant-design/nextjs-registry";
|
|
import { Providers } from "@ebook/components/Providers";
|
|
import { getSiteConfig } from "@ebook/lib/site-config.server";
|
|
import { getServerFeatures } from "@ebook/lib/features.server";
|
|
import { getLocale } from "@ebook/lib/i18n/server";
|
|
import "@ebook/app/globals.css";
|
|
|
|
export default async function BookLayout({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode;
|
|
}) {
|
|
const locale = await getLocale();
|
|
const site = getSiteConfig();
|
|
const f = getServerFeatures();
|
|
|
|
return (
|
|
<div className="ebook-root" data-locale={locale}>
|
|
<AntdRegistry>
|
|
<Providers locale={locale}>
|
|
{f.analytics.enabled ? <AnalyticsLazy /> : null}
|
|
{f.ads.enabled && f.ads.clientId ? <AdSenseLazy /> : null}
|
|
{children}
|
|
{f.feedback.enabled ? (
|
|
<FeedbackLazy
|
|
title={f.feedback.title}
|
|
subtitle={f.feedback.subtitle}
|
|
contactEmail={site.brand.contactEmail}
|
|
xHandle={site.brand.xHandle}
|
|
/>
|
|
) : null}
|
|
</Providers>
|
|
</AntdRegistry>
|
|
<script
|
|
dangerouslySetInnerHTML={{
|
|
__html: `window.__EBOOK_FEATURES__=${JSON.stringify(f).replace(/</g, "\\u003c")};window.__LOCALE__=${JSON.stringify(locale)};`,
|
|
}}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
function AnalyticsLazy() {
|
|
const { AnalyticsProvider } = require("@ebook/components/AnalyticsProvider");
|
|
return <AnalyticsProvider />;
|
|
}
|
|
|
|
function AdSenseLazy() {
|
|
const { AdSenseScript } = require("@ebook/components/AdSlot");
|
|
return <AdSenseScript />;
|
|
}
|
|
|
|
function FeedbackLazy(props: {
|
|
title: string;
|
|
subtitle: string;
|
|
contactEmail: string;
|
|
xHandle: string;
|
|
}) {
|
|
const { FeedbackPanel } = require("@ebook/components/FeedbackPanel");
|
|
return <FeedbackPanel {...props} />;
|
|
}
|