Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Add banner

Vasek Mlejnskye3f3442b806b
diff --git a/apps/docs/src/app/layout.tsx b/apps/docs/src/app/layout.tsx
index 8a6f8272d..4dae62796 100644
--- a/apps/docs/src/app/layout.tsx
+++ b/apps/docs/src/app/layout.tsx
@@ -8,7 +8,6 @@ import { Layout } from '@/components/Layout'
import '@/styles/tailwind.css'
import { PostHogAnalytics } from '@/utils/usePostHog'
import { Section } from '@/components/SectionProvider'
-import { Banner } from '@/components/Banner'
export const metadata: Metadata = {
title: {
@@ -45,7 +44,6 @@ export default async function RootLayout({ children }) {
<body className="flex min-h-full bg-white antialiased dark:bg-zinc-900">
<Providers>
<div className="w-full">
- <Banner />
<Layout allSections={allSections}>
{children}
<PostHogAnalytics />
diff --git a/apps/docs/src/components/Banner.tsx b/apps/docs/src/components/Banner.tsx
index 19e1de15a..097f6bf96 100644
--- a/apps/docs/src/components/Banner.tsx
+++ b/apps/docs/src/components/Banner.tsx
@@ -1,19 +1,20 @@
'use client'
+
+import Link from 'next/link'
import { useState } from 'react'
import { useUser } from '@/utils/useUser'
+
export function Banner() {
const [promoEnd, setPromoEnd] = useState(100)
const { user } = useUser()
+ // TODO: add corrent promo end date
console.log('user', user)
-
- if (!user?.pricingTier.isPromo) return null;
-
return (
- <div className="p-2">
- <span>You&apos;re on a trial Pro tier. Your trial will end on {promoEnd}.</span>
- <span>Please reach if you want to stay on the Pro tier</span>
+ <div className="py-2 px-8 border-y border-zinc-700 flex flex-col md:flex-row gap-1 fixed inset-x-0 top-[55px] bg-zinc-800 z-40">
+ <span className="text-sm">You&apos;re on a <b>trial</b> Pro tier. <b>Your trial will end on [TODO: Fix end date] {promoEnd}.</b></span>
+ <span className="text-sm">Please <Link href="/getting-help" className="text-brand-400 underline font-medium">reach out</Link> for an ugprade.</span>
</div>
)
}
diff --git a/apps/docs/src/components/Header.tsx b/apps/docs/src/components/Header.tsx
index e8f50c211..1e99ed25b 100644
--- a/apps/docs/src/components/Header.tsx
+++ b/apps/docs/src/components/Header.tsx
@@ -10,9 +10,10 @@ import { HeaderSeparator } from '@/components/HeaderUtils'
import { DiscordIcon } from '@/components/icons/DiscordIcon'
import { TwitterIcon } from '@/components/icons/TwitterIcon'
import { useLocalStorage } from 'usehooks-ts'
-import { config } from '../../config'
import { GitHubIcon } from '@/components/icons/GitHubIcon'
+
import dynamic from 'next/dynamic'
+import { config } from '../../config'
// No SSR to avoid hydration mismatch
const TopLevelNavItem = dynamic(() => import('@/components/TopLevelNavItem'), {
@@ -87,17 +88,17 @@ export const Header = forwardRef(function Header({ className }, ref) {
href="/"
aria-label="Home"
>
- <Logo className="h-6"/>
+ <Logo className="h-6" />
</Link>
</div>
- <Search/>
+ <Search />
<div className="flex items-center gap-5 lg:hidden">
- <MobileNavigation/>
+ <MobileNavigation />
<Link
href="/"
aria-label="Home"
>
- <Logo className="h-6"/>
+ <Logo className="h-6" />
</Link>
</div>
<div className="flex items-center gap-4">
@@ -110,24 +111,24 @@ export const Header = forwardRef(function Header({ className }, ref) {
href={`https://discord.gg/${config.discord.slug}`}
stat={discordUsers}
statType="discordUsers"
- icon={<DiscordIcon className="h-5 w-5 fill-current"/>}
+ icon={<DiscordIcon className="h-5 w-5 fill-current" />}
/>
<TopLevelNavItem
href={config.github.url}
stat={githubStars}
statType="githubStars"
- icon={<GitHubIcon className="h-5 w-5 fill-current"/>}
+ icon={<GitHubIcon className="h-5 w-5 fill-current" />}
/>
<TopLevelNavItem
href={config.twitter.url}
- icon={<TwitterIcon className="h-5 w-5 fill-current"/>}
+ icon={<TwitterIcon className="h-5 w-5 fill-current" />}
/>
</ul>
</nav>
- <HeaderSeparator/>
- <MobileSearch/>
+ <HeaderSeparator />
+ <MobileSearch />
<div className="hidden min-[540px]:contents">
- <Auth/>
+ <Auth />
</div>
</div>
</motion.div>
diff --git a/apps/docs/src/components/Layout.tsx b/apps/docs/src/components/Layout.tsx
index 3a89733d2..dd40665d5 100644
--- a/apps/docs/src/components/Layout.tsx
+++ b/apps/docs/src/components/Layout.tsx
@@ -1,5 +1,6 @@
'use client'
+import clsx from 'clsx'
import { usePathname } from 'next/navigation'
import { motion } from 'framer-motion'
@@ -7,23 +8,30 @@ import { Footer } from '@/components/Footer'
import { Header } from '@/components/Header'
import { Navigation } from '@/components/Navigation'
import { Section, SectionProvider } from '@/components/SectionProvider'
+import { Banner } from '@/components/Banner'
+import { useUser } from '@/utils/useUser'
export function Layout({
- children,
- allSections,
- }: {
+ children,
+ allSections,
+}: {
children: React.ReactNode
allSections: Record<string, Array<Section>>
}) {
+ const { user } = useUser()
const pathname = usePathname()
const relativePathname = pathname.replace(new RegExp('^/docs'), '')
+ const shouldShowBanner = user?.pricingTier.isPromo
return (
<SectionProvider sections={allSections[relativePathname] ?? []}>
<div className="h-full lg:ml-[var(--sidebar-nav-width)]">
<motion.header
layoutScroll
- className="contents lg:pointer-events-none lg:fixed lg:inset-0 lg:top-[60px] lg:z-40 lg:flex"
+ className={clsx(
+ 'contents lg:pointer-events-none lg:fixed lg:inset-0 lg:z-40 lg:flex',
+ shouldShowBanner ? 'lg:top-[110px]' : 'lg:top-[60px]',
+ )}
>
<div
id="sidebar"
@@ -39,10 +47,11 @@ export function Layout({
lg:pb-8
"
>
- <Header/>
- <Navigation className="hidden lg:my-4 lg:block"/>
+ <Header />
+ <Navigation className="hidden lg:my-4 lg:block" />
</div>
</motion.header>
+ {shouldShowBanner && <Banner />}
<div
className="
relative
@@ -61,8 +70,9 @@ export function Layout({
>
<main className="
flex-auto
- ">{children}</main>
- <Footer/>
+ ">
+ {children}</main>
+ <Footer />
</div>
</div>
</SectionProvider>
diff --git a/apps/docs/src/components/mdx.tsx b/apps/docs/src/components/mdx.tsx
index d00a9c610..dcb13aa7b 100644
--- a/apps/docs/src/components/mdx.tsx
+++ b/apps/docs/src/components/mdx.tsx
@@ -12,7 +12,7 @@ export { LanguageSpecificText } from '@/components/LanguageSpecificText'
export function wrapper({ children }: { children: React.ReactNode }) {
return (
- <article className="mx-auto flex h-full max-w-6xl flex-col pb-10 pt-16">
+ <article className="mx-auto flex h-full max-w-6xl flex-col pb-10 pt-20 md:pt-18">
<Prose className="flex-auto">{children}</Prose>
<footer className="mx-auto mt-10 w-full max-w-2xl lg:max-w-5xl">
<Feedback variant="textSubtle" />