Skip to content

Commit

Permalink
Fix broken side panel in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubno committed Aug 2, 2024
1 parent 00e6813 commit 1988a8a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 35 deletions.
32 changes: 0 additions & 32 deletions apps/web/src/app/(docs)/docs/layout.tsx

This file was deleted.

27 changes: 25 additions & 2 deletions apps/web/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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>
Expand Down
6 changes: 5 additions & 1 deletion apps/web/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand Down

0 comments on commit 1988a8a

Please sign in to comment.