Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Fix broken side panel in docs

Jakub Novak1988a8a34732
diff --git a/apps/web/src/app/(docs)/docs/layout.tsx b/apps/web/src/app/(docs)/docs/layout.tsx
deleted file mode 100644
index 0fd46d5a4..000000000
--- a/apps/web/src/app/(docs)/docs/layout.tsx
+++ /dev/null
@@ -1,32 +0,0 @@
-import glob from 'fast-glob'
-
-import { Layout } from '@/components/Layout'
-
-import { Section } from '@/components/SectionProvider'
-
-declare global {
- // eslint-disable-next-line @typescript-eslint/no-namespace
- namespace JSX {
- interface IntrinsicElements {
- 'chatlio-widget': any;
- }
- }
-}
-
-
-export default async function DocsLayout({ children }) {
- const pages = await glob('**/*.mdx', { cwd: 'src/app/(docs)/docs' })
- const allSectionsEntries = (await Promise.all(
- pages.map(async filename => [
- '/docs/' + filename.replace(/\(docs\)\/?|(^|\/)page\.mdx$/, ''),
- (await import(`./${filename}`)).sections,
- ]),
- )) as Array<[string, Array<Section>]>
- const allSections = Object.fromEntries(allSectionsEntries)
-
- return (
- <Layout allSections={allSections}>
- {children}
- </Layout>
- )
-}
diff --git a/apps/web/src/app/layout.tsx b/apps/web/src/app/layout.tsx
index f0c1ce576..11e595ad8 100644
--- a/apps/web/src/app/layout.tsx
+++ b/apps/web/src/app/layout.tsx
@@ -9,6 +9,9 @@ import { PostHogAnalytics } from '@/utils/usePostHog'
import Canonical from '@/components/Navigation/canonical'
import { Suspense } from 'react'
import { Header } from '@/components/Header'
+import glob from 'fast-glob'
+import { Section } from '@/components/SectionProvider'
+import { Layout } from '@/components/Layout'
export const metadata: Metadata = {
// TODO: Add metadataBase
@@ -28,7 +31,27 @@ export const metadata: Metadata = {
},
}
+declare global {
+ // eslint-disable-next-line @typescript-eslint/no-namespace
+ namespace JSX {
+ interface IntrinsicElements {
+ 'chatlio-widget': any;
+ }
+ }
+}
+
+
export default async function RootLayout({ children }) {
+ const pages = await glob('**/*.mdx', { cwd: 'src/app/(docs)/docs' })
+ const allSectionsEntries = (await Promise.all(
+ pages.map(async filename => [
+ '/docs/' + filename.replace(/\(docs\)\/?|(^|\/)page\.mdx$/, ''),
+ (await import(`./(docs)/docs/${filename}`)).sections,
+ ]),
+ )) as Array<[string, Array<Section>]>
+ const allSections = Object.fromEntries(allSectionsEntries)
+
+
return (
<html
lang="en"
@@ -40,10 +63,10 @@ export default async function RootLayout({ children }) {
</head>
<body className="flex min-h-full bg-white antialiased dark:bg-zinc-900">
<Providers>
- <div className="w-full">
+ <Layout allSections={allSections}>
<Header />
{children}
- </div>
+ </Layout>
<Suspense>
<PostHogAnalytics />
</Suspense>
diff --git a/apps/web/src/middleware.ts b/apps/web/src/middleware.ts
index 531bb3310..7cb62821c 100644
--- a/apps/web/src/middleware.ts
+++ b/apps/web/src/middleware.ts
@@ -10,7 +10,11 @@ export async function middleware(req: NextRequest): Promise<NextResponse> {
url.port = ''
if (url.pathname === '' || url.pathname === '/') {
- url.hostname = 'e2b-landing-page.framer.website'
+ if (process.env.NODE_ENV === 'production') {
+ url.hostname = 'e2b-landing-page.framer.website'
+ } else {
+ return NextResponse.redirect(new URL('/dashboard', req.url))
+ }
}
if (url.pathname.startsWith('/terms')) {