Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Refactor docs and dashboard layouts into one

Jakub Novakd2a79a0e01c4
diff --git a/apps/web/src/app/(dashboard)/layout.tsx b/apps/web/src/app/(dashboard)/layout.tsx
index 31ad5f139..95f68db7e 100644
--- a/apps/web/src/app/(dashboard)/layout.tsx
+++ b/apps/web/src/app/(dashboard)/layout.tsx
@@ -1,54 +1,12 @@
-import { Metadata } from 'next'
-import { Analytics } from '@vercel/analytics/react'
-
-import { Providers } from '@/app/providers'
-
-import '@/styles/tailwind.css'
-import { PostHogAnalytics } from '@/utils/usePostHog'
-import Canonical from '@/components/Navigation/canonical'
import { LayoutDashboard } from '@/components/LayoutDashboard'
import { Toaster } from '@/components/ui/toaster'
-export const metadata: Metadata = {
- // TODO: Add metadataBase
- // metadataBase: ''
- title: {
- template: '%s - E2B',
- default: 'E2B - Code Interpreting for AI apps',
- },
- description: 'Open-source secure sandboxes for AI code execution',
- twitter: {
- title: 'E2B - Code Interpreting for AI apps',
- description: 'Open-source secure sandboxes for AI code execution',
- },
- openGraph: {
- title: 'E2B - Code Interpreting for AI apps',
- description: 'Open-source secure sandboxes for AI code execution',
- },
-}
-export default async function RootLayout({ children }) {
+export default async function Layout({ children }) {
return (
- <html
- lang="en"
- className="h-full"
- suppressHydrationWarning
- >
- <head>
- <Canonical />
- </head>
- <body className="flex min-h-full bg-white antialiased dark:bg-zinc-900">
- <Providers>
- <div className="w-full">
<LayoutDashboard>
{children}
<Toaster />
- <PostHogAnalytics />
- <Analytics />
</LayoutDashboard>
- </div>
- </Providers>
- </body>
- </html>
- )
+ )
}
diff --git a/apps/web/src/app/(docs)/docs/layout.tsx b/apps/web/src/app/(docs)/docs/layout.tsx
index c013ac7c8..0fd46d5a4 100644
--- a/apps/web/src/app/(docs)/docs/layout.tsx
+++ b/apps/web/src/app/(docs)/docs/layout.tsx
@@ -1,15 +1,8 @@
-import Script from 'next/script'
-import { Metadata } from 'next'
import glob from 'fast-glob'
-import { Analytics } from '@vercel/analytics/react'
-import { Providers } from '@/app/providers'
import { Layout } from '@/components/Layout'
-import '@/styles/tailwind.css'
-import { PostHogAnalytics } from '@/utils/usePostHog'
import { Section } from '@/components/SectionProvider'
-import Canonical from '@/components/Navigation/canonical'
declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
@@ -20,25 +13,8 @@ declare global {
}
}
-export const metadata: Metadata = {
- // TODO: Add metadataBase
- // metadataBase: ''
- title: {
- template: '%s - E2B Docs',
- default: 'E2B Docs - Code Interpreting for AI apps',
- },
- description: 'Open-source secure sandboxes for AI code execution',
- twitter: {
- title: 'E2B Docs - Code Interpreting for AI apps',
- description: 'Open-source secure sandboxes for AI code execution',
- },
- openGraph: {
- title: 'E2B Docs - Code Interpreting for AI apps',
- description: 'Open-source secure sandboxes for AI code execution',
- },
-}
-export default async function RootLayout({ children }) {
+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 => [
@@ -47,30 +23,10 @@ export default async function RootLayout({ children }) {
]),
)) as Array<[string, Array<Section>]>
const allSections = Object.fromEntries(allSectionsEntries)
-
- return (
- <html
- lang="en"
- className="h-full"
- suppressHydrationWarning
- >
- <head>
- <Canonical />
- </head>
- <body className="flex min-h-full bg-white antialiased dark:bg-zinc-900">
- <Providers>
- <div className="w-full">
- <Layout allSections={allSections}>
- {children}
- <PostHogAnalytics />
- <Analytics />
- </Layout>
- </div>
- </Providers>
- <Script src="https://js.chatlio.com/widget.js" strategy="lazyOnload" />
- <chatlio-widget widgetid={process.env.NEXT_PUBLIC_CHATLIO_WIDGET_ID} disable-favicon-badge></chatlio-widget>
- </body>
- </html>
+ return (
+ <Layout allSections={allSections}>
+ {children}
+ </Layout>
)
}
diff --git a/apps/web/src/app/layout.tsx b/apps/web/src/app/layout.tsx
new file mode 100644
index 000000000..e7e7943bf
--- /dev/null
+++ b/apps/web/src/app/layout.tsx
@@ -0,0 +1,56 @@
+import Script from 'next/script'
+import { Metadata } from 'next'
+import { Analytics } from '@vercel/analytics/react'
+
+import { Providers } from '@/app/providers'
+
+import '@/styles/tailwind.css'
+import { PostHogAnalytics } from '@/utils/usePostHog'
+import Canonical from '@/components/Navigation/canonical'
+import {Suspense} from 'react'
+
+export const metadata: Metadata = {
+ // TODO: Add metadataBase
+ // metadataBase: ''
+ title: {
+ template: '%s - E2B Docs',
+ default: 'E2B Docs - Code Interpreting for AI apps',
+ },
+ description: 'Open-source secure sandboxes for AI code execution',
+ twitter: {
+ title: 'E2B Docs - Code Interpreting for AI apps',
+ description: 'Open-source secure sandboxes for AI code execution',
+ },
+ openGraph: {
+ title: 'E2B Docs - Code Interpreting for AI apps',
+ description: 'Open-source secure sandboxes for AI code execution',
+ },
+}
+
+export default async function RootLayout({ children }) {
+ return (
+ <html
+ lang="en"
+ className="h-full"
+ suppressHydrationWarning
+ >
+ <head>
+ <Canonical />
+ </head>
+ <body className="flex min-h-full bg-white antialiased dark:bg-zinc-900">
+ <Providers>
+ <div className="w-full">
+ {children}
+ </div>
+ <Suspense>
+ <PostHogAnalytics />
+ </Suspense>
+ <Analytics />
+ </Providers>
+
+ <Script src="https://js.chatlio.com/widget.js" strategy="lazyOnload" />
+ <chatlio-widget widgetid={process.env.NEXT_PUBLIC_CHATLIO_WIDGET_ID} disable-favicon-badge></chatlio-widget>
+ </body>
+ </html>
+ )
+}