Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Move header to common header
Jakub Novake4f5cfce59bf
diff --git a/apps/web/src/app/(dashboard)/layout.tsx b/apps/web/src/app/(dashboard)/dashboard/layout.tsxsimilarity index 59%rename from apps/web/src/app/(dashboard)/layout.tsxrename to apps/web/src/app/(dashboard)/dashboard/layout.tsxindex 95f68db7e..bb8f8a0df 100644--- a/apps/web/src/app/(dashboard)/layout.tsx+++ b/apps/web/src/app/(dashboard)/dashboard/layout.tsx@@ -4,9 +4,9 @@ import { Toaster } from '@/components/ui/toaster'export default async function Layout({ children }) {return (- <LayoutDashboard>- {children}- <Toaster />- </LayoutDashboard>- )+ <LayoutDashboard>+ {children}+ <Toaster />+ </LayoutDashboard>+ )}diff --git a/apps/web/src/app/layout.tsx b/apps/web/src/app/layout.tsxindex e7e7943bf..1f438a75c 100644--- a/apps/web/src/app/layout.tsx+++ b/apps/web/src/app/layout.tsx@@ -7,7 +7,8 @@ import { Providers } from '@/app/providers'import '@/styles/tailwind.css'import { PostHogAnalytics } from '@/utils/usePostHog'import Canonical from '@/components/Navigation/canonical'-import {Suspense} from 'react'+import { Suspense } from 'react'+import { Header } from '@/components/Header'export const metadata: Metadata = {// TODO: Add metadataBase@@ -40,6 +41,7 @@ export default async function RootLayout({ children }) {<body className="flex min-h-full bg-white antialiased dark:bg-zinc-900"><Providers><div className="w-full">+ <Header />{children}</div><Suspense>diff --git a/apps/web/src/components/Header.tsx b/apps/web/src/components/Header.tsxindex 9c1b19a58..20a297af3 100644--- a/apps/web/src/components/Header.tsx+++ b/apps/web/src/components/Header.tsx@@ -12,6 +12,7 @@ import { GitHubIcon } from '@/components/icons/GitHubIcon'import dynamic from 'next/dynamic'import { config } from '../../config'+import { usePathname } from 'next/navigation'// No SSR to avoid hydration mismatchconst TopLevelNavItem = dynamic(() => import('@/components/TopLevelNavItem'), {@@ -19,7 +20,7 @@ const TopLevelNavItem = dynamic(() => import('@/components/TopLevelNavItem'), {})// @ts-ignore-export const Header = forwardRef(function Header({ className, isAuth }, ref) {+export const Header = forwardRef(function Header({ className }, ref) {const { isOpen: mobileNavIsOpen } = useMobileNavigationStore()const isInsideMobileNavigation = useIsInsideMobileNavigation()@@ -29,6 +30,11 @@ export const Header = forwardRef(function Header({ className, isAuth }, ref) {const bgOpacityLight = useTransform(scrollY, [0, 72], [0.5, 0.9])const bgOpacityDark = useTransform(scrollY, [0, 72], [0.2, 0.8])+ const pathname = usePathname()+ const isDocs = pathname?.startsWith('/docs')+ const isAuth = pathname?.startsWith('/auth')++useEffect(() => {fetch(config.github.api).then(response => response.json())@@ -67,7 +73,7 @@ export const Header = forwardRef(function Header({ className, isAuth }, ref) {<Logo className="h-6" /></Link></div>- {!isAuth && <Search />}+ {isDocs && <Search />}<div className="flex items-center gap-5 lg:hidden"><MobileNavigation /><Linkdiff --git a/apps/web/src/components/Layout.tsx b/apps/web/src/components/Layout.tsxindex 83743b6b3..c0f692b17 100644--- a/apps/web/src/components/Layout.tsx+++ b/apps/web/src/components/Layout.tsx@@ -5,7 +5,6 @@ import { usePathname } from 'next/navigation'import { motion } from 'framer-motion'import { Footer } from '@/components/Footer'-import { Header } from '@/components/Header'import { Navigation } from '@/components/Navigation'import { Section, SectionProvider } from '@/components/SectionProvider'@@ -18,11 +17,11 @@ export function Layout({}) {const pathname = usePathname()const relativePathname = pathname?.replace(new RegExp('^/docs'), '')- const isAuth = relativePathname?.startsWith('/sign-in')+ const isDocs = pathname?.startsWith('/docs')return (<SectionProvider sections={relativePathname ? allSections[relativePathname] ?? [] : []}>- <div className={clsx('h-full', { 'lg:ml-[var(--sidebar-nav-width)]': !isAuth })}>+ <div className={clsx('h-full', { 'lg:ml-[var(--sidebar-nav-width)]': isDocs })}><motion.headerlayoutScrollclassName='contents lg:pointer-events-none lg:fixed lg:inset-0 lg:z-40 lg:flex lg:top-[60px]'@@ -41,12 +40,10 @@ export function Layout({lg:pb-8">- {/* @ts-ignore */}- <Header isAuth={isAuth} />- {!isAuth && <Navigation className="hidden lg:my-4 lg:block" />}+ {isDocs && <Navigation className="hidden lg:my-4 lg:block" />}</div></motion.header>- {!isAuth && (+ {isDocs && (<divclassName="relative@@ -70,7 +67,7 @@ export function Layout({<Footer /></div>)}- {isAuth && (+ {!isDocs && (<divclassName="relativediff --git a/apps/web/src/components/LayoutDashboard.tsx b/apps/web/src/components/LayoutDashboard.tsxindex 85696416b..5262c828f 100644--- a/apps/web/src/components/LayoutDashboard.tsx+++ b/apps/web/src/components/LayoutDashboard.tsx@@ -1,5 +1,4 @@import { FooterMain } from '@/components/Footer'-import { HeaderDashboard } from '@/components/HeaderDashboard'export function LayoutDashboard({children,@@ -8,12 +7,9 @@ export function LayoutDashboard({}) {return (<div className="h-full w-full">- <HeaderDashboard />-<main className="w-full h-full flex flex-col">{children}</main>-<FooterMain /></div>)