Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Redesign sidebar (desktop)

Vasek Mlejnskyc2e670c5d531
diff --git a/apps/web/src/components/Footer.tsx b/apps/web/src/components/Footer.tsx
index ffcc2d179..eaa89f506 100644
--- a/apps/web/src/components/Footer.tsx
+++ b/apps/web/src/components/Footer.tsx
@@ -1,88 +1,88 @@
'use client'
import Link from 'next/link'
-import { usePathname } from 'next/navigation'
+// import { usePathname } from 'next/navigation'
-import { Button } from '@/components/Button'
-import { routes } from '@/components/Navigation/routes'
+// import { Button } from '@/components/Button'
+// import { routes } from '@/components/Navigation/routes'
import { TwitterIcon } from '@/components/icons/TwitterIcon'
import { GitHubIcon } from '@/components/icons/GitHubIcon'
import { DiscordIcon } from '@/components/icons/DiscordIcon'
-function PageLink({
- label,
- page,
- previous = false,
- }: {
- label: string
- page: { href: string; title: string }
- previous?: boolean
-}) {
- return (
- <>
- <Button
- href={page.href}
- aria-label={`${label}: ${page.title}`}
- variant="secondary"
- arrow={previous ? 'left' : 'right'}
- >
- {label}
- </Button>
- <Link
- href={page.href}
- tabIndex={-1}
- aria-hidden="true"
- className="text-base font-semibold text-zinc-900 transition hover:text-zinc-600 dark:text-white dark:hover:text-zinc-300"
- >
- {page.title}
- </Link>
- </>
- )
-}
+// function PageLink({
+// label,
+// page,
+// previous = false,
+// }: {
+// label: string
+// page: { href: string; title: string }
+// previous?: boolean
+// }) {
+// return (
+// <>
+// <Button
+// href={page.href}
+// aria-label={`${label}: ${page.title}`}
+// variant="secondary"
+// arrow={previous ? 'left' : 'right'}
+// >
+// {label}
+// </Button>
+// <Link
+// href={page.href}
+// tabIndex={-1}
+// aria-hidden="true"
+// className="text-base font-semibold text-zinc-900 transition hover:text-zinc-600 dark:text-white dark:hover:text-zinc-300"
+// >
+// {page.title}
+// </Link>
+// </>
+// )
+// }
-function PageNavigation() {
- let initialPathname = usePathname()
- // Running on the server, there's bug with usePathname() and basePath https://github.com/vercel/next.js/issues/52700
- if (typeof window === 'undefined' && initialPathname === '/') initialPathname = '/docs'
+// function PageNavigation() {
+// let initialPathname = usePathname()
+// // Running on the server, there's bug with usePathname() and basePath https://github.com/vercel/next.js/issues/52700
+// if (typeof window === 'undefined' && initialPathname === '/') initialPathname = '/docs'
- const allPages = routes.flatMap(group => group.links)
- const currentPageIndex = allPages.findIndex(page => page.href === initialPathname)
+// const allPages = routes.flatMap(group => group.links)
+// const currentPageIndex = allPages.findIndex(page => page.href === initialPathname)
- if (currentPageIndex === -1) return null
+// if (currentPageIndex === -1) return null
- const previousPage = allPages[currentPageIndex - 1]
- const nextPage = allPages[currentPageIndex + 1]
+// const previousPage = allPages[currentPageIndex - 1]
+// const nextPage = allPages[currentPageIndex + 1]
- if (!previousPage && !nextPage) return null
+// if (!previousPage && !nextPage) return null
- return (
- <div className="flex">
- {previousPage && (
- <div className="flex flex-col items-start gap-3">
- <PageLink
- label="Previous"
- page={previousPage}
- previous
- />
- </div>
- )}
- {nextPage && (
- <div className="ml-auto flex flex-col items-end gap-3">
- <PageLink
- label="Next"
- page={nextPage}
- />
- </div>
- )}
- </div>
- )
-}
+// return (
+// <div className="flex">
+// {previousPage && (
+// <div className="flex flex-col items-start gap-3">
+// <PageLink
+// label="Previous"
+// page={previousPage}
+// previous
+// />
+// </div>
+// )}
+// {nextPage && (
+// <div className="ml-auto flex flex-col items-end gap-3">
+// <PageLink
+// label="Next"
+// page={nextPage}
+// />
+// </div>
+// )}
+// </div>
+// )
+// }
function SocialLink({
- href,
- icon: Icon,
- children,
- }: {
+ href,
+ icon: Icon,
+ children,
+}: {
href: string
icon: React.ComponentType<{ className?: string }>
children: React.ReactNode
@@ -93,7 +93,7 @@ function SocialLink({
className="group"
>
<span className="sr-only">{children}</span>
- <Icon className="h-5 w-5 fill-zinc-700 transition group-hover:fill-zinc-900 dark:group-hover:fill-zinc-500"/>
+ <Icon className="h-5 w-5 fill-zinc-700 transition group-hover:fill-zinc-900 dark:group-hover:fill-zinc-500" />
</Link>
)
}
@@ -136,8 +136,8 @@ function SmallPrint() {
export function Footer() {
return (
<footer className="mx-auto w-full max-w-2xl space-y-10 pb-16 lg:max-w-5xl">
- <PageNavigation/>
- <SmallPrint/>
+ {/* <PageNavigation /> */}
+ <SmallPrint />
</footer>
)
}
@@ -146,7 +146,7 @@ export function FooterMain() {
return (
<footer className="flex w-full space-y-10 pb-16">
<div className="flex flex-col w-full items-center justify-center border-t border-zinc-900/5 dark:border-white/5">
- <SmallPrint/>
+ <SmallPrint />
</div>
</footer>
)
diff --git a/apps/web/src/components/Header.tsx b/apps/web/src/components/Header.tsx
index 4d10ae641..5b504ead0 100644
--- a/apps/web/src/components/Header.tsx
+++ b/apps/web/src/components/Header.tsx
@@ -50,7 +50,7 @@ export const Header = forwardRef(function Header({ className }, ref) {
ref={ref}
className={clsx(
className,
- 'fixed inset-x-0 top-0 z-50 flex h-14 items-center justify-between gap-12 px-4 transition sm:px-6 lg:z-30 lg:px-8',
+ 'fixed inset-x-0 top-0 z-50 flex h-14 items-center justify-between gap-12 px-4 transition sm:px-6 lg:z-30 lg:px-6',
!isInsideMobileNavigation && 'backdrop-blur-sm dark:backdrop-blur',
)}
style={
diff --git a/apps/web/src/components/Layout.tsx b/apps/web/src/components/Layout.tsx
index a8dbeb73c..f937be4e0 100644
--- a/apps/web/src/components/Layout.tsx
+++ b/apps/web/src/components/Layout.tsx
@@ -38,7 +38,7 @@ export function Layout({
lg:block
lg:w-[var(--sidebar-nav-width)]
lg:overflow-y-auto
- lg:px-6
+ lg:px-4
lg:pb-8
"
>
diff --git a/apps/web/src/components/Navigation/NavigationLink.tsx b/apps/web/src/components/Navigation/NavigationLink.tsx
new file mode 100644
index 000000000..ee0ea0126
--- /dev/null
+++ b/apps/web/src/components/Navigation/NavigationLink.tsx
@@ -0,0 +1,62 @@
+import clsx from 'clsx'
+import Link from 'next/link'
+import { usePathname } from 'next/navigation'
+import { Tag } from '@/components/Tag'
+
+import { NavLink } from './routes'
+
+export function NavigationLink({
+ className,
+ link,
+ // href,
+ // children,
+ tag,
+ // icon,
+ // isAnchorLink = false,
+ // isFontMono = false,
+}: {
+
+ className?: string
+ link: NavLink
+ // href: string
+ // children: React.ReactNode
+ tag?: string
+}) {
+ const pathname = usePathname()
+ const active = pathname === link.href
+
+ return (
+ <Link
+ href={link.href}
+ aria-current={active ? 'page' : undefined}
+ className={clsx(
+ 'flex justify-between py-1 px-2 text-sm transition rounded-md hover:bg-zinc-800 transition-colors',
+ active
+ ? 'text-white bg-zinc-800'
+ : 'hover:text-white text-zinc-400 bg-transparent',
+ className,
+ )}
+ >
+ <div className="flex items-center justify-start gap-1">
+ {link.icon}
+ {tag ? (
+ <div className="flex items-center gap-2">
+ <Tag
+ variant="small"
+ color="emerald"
+ >
+ {tag}
+ </Tag>
+ <span className={clsx('truncate', active ? 'text-white' : '')}>
+ {link.title}
+ </span>
+ </div>
+ ) : (
+ <span className={clsx('truncate', active ? 'text-white' : '')}>
+ {link.title}
+ </span>
+ )}
+ </div>
+ </Link>
+ )
+}
\ No newline at end of file
diff --git a/apps/web/src/components/Navigation/NavigationSubgroup.tsx b/apps/web/src/components/Navigation/NavigationSubgroup.tsx
new file mode 100644
index 000000000..44172e614
--- /dev/null
+++ b/apps/web/src/components/Navigation/NavigationSubgroup.tsx
@@ -0,0 +1,40 @@
+import { useState } from 'react'
+import { NavSubgroup } from './routes'
+import { NavigationLink } from './NavigationLink'
+import { ChevronDown, ChevronRight } from 'lucide-react'
+
+export function NavigationSubgroup({ subgroup }: { subgroup: NavSubgroup }) {
+ const [isExpanded, setIsExpanded] = useState(false)
+
+ const toggleExpand = () => {
+ setIsExpanded(!isExpanded)
+ }
+
+ return (
+ <div>
+ <button
+ onClick={toggleExpand}
+ className="group flex items-center justify-between w-full text-left px-2 py-1 rounded-md hover:bg-zinc-100 dark:hover:bg-zinc-800 transition-colors"
+ >
+ <h3 className="text-sm font-medium text-zinc-400 group-hover:text-white">{subgroup.title}</h3>
+ {isExpanded ? (
+ <ChevronDown className="w-4 h-4 ml-2 text-zinc-400 group-hover:text-white" />
+ ) : (
+ <ChevronRight className="w-4 h-4 ml-2 text-zinc-400 group-hover:text-white" />
+ )}
+ </button>
+ {isExpanded && (
+ <div className="relative ml-2 mt-1">
+ <div className="absolute left-0 top-0 bottom-0 w-px bg-white/10 rounded"></div>
+ <ul className="pl-4">
+ {subgroup.links.map((link) => (
+ <li key={link.href}>
+ <NavigationLink link={link} />
+ </li>
+ ))}
+ </ul>
+ </div>
+ )}
+ </div>
+ )
+}
diff --git a/apps/web/src/components/Navigation/index.tsx b/apps/web/src/components/Navigation/index.tsx
index 26282e86d..416651024 100644
--- a/apps/web/src/components/Navigation/index.tsx
+++ b/apps/web/src/components/Navigation/index.tsx
@@ -1,180 +1,110 @@
'use client'
import { useRef } from 'react'
-import Link from 'next/link'
import { usePathname } from 'next/navigation'
import clsx from 'clsx'
-import { AnimatePresence, motion, useIsPresent } from 'framer-motion'
+import {
+ motion,
+ // useIsPresent,
+} from 'framer-motion'
import { useIsInsideMobileNavigation } from '@/components/MobileNavigation'
import { useSectionStore } from '@/components/SectionProvider'
-import { Tag } from '@/components/Tag'
-import { remToPx } from '@/lib/remToPx'
-import { Auth } from '@/components/Auth'
-import { routes } from './routes'
-
-interface NavGroup {
- title: string
- links: Array<{
- title: string
- href: string
- }>
-}
+// import { remToPx } from '@/lib/remToPx'
+import {
+ routes,
+ NavGroup,
+ NavSubgroup,
+ NavLink,
+} from './routes'
+import { NavigationSubgroup } from './NavigationSubgroup'
+import { NavigationLink } from './NavigationLink'
+
+// interface NavGroup {
+// title: string
+// links: Array<{
+// title: string
+// href: string
+// }>
+// }
function useInitialValue<T>(value: T, condition = true) {
const initialValue = useRef(value).current
return condition ? initialValue : value
}
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
-function TopLevelNavItem({
- href,
- children,
-}: {
- href: string
- children: React.ReactNode
-}) {
- return (
- <li className="md:hidden">
- <Link
- href={href}
- className="block py-1 text-sm text-zinc-600 transition hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-white"
- >
- {children}
- </Link>
- </li>
- )
-}
-
-function NavLink({
- className,
- href,
- children,
- tag,
- icon,
- active = false,
- isAnchorLink = false,
- isFontMono = false,
-}: {
- className?: string
- href: string
- children: React.ReactNode
- tag?: string
- active?: boolean
- icon?: React.ReactNode
- isAnchorLink?: boolean
- isFontMono?: boolean
-}) {
- return (
- <Link
- href={href}
- aria-current={active ? 'page' : undefined}
- className={clsx(
- 'flex justify-between gap-2 py-1 pr-3 text-sm transition',
- isAnchorLink ? 'pl-7' : 'pl-4',
- active
- ? 'text-zinc-900 dark:text-white'
- : 'text-zinc-600 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-white',
- isFontMono ? 'font-mono text-xs' : '',
- className,
- )}
- >
- <div className="flex items-center justify-start gap-1">
- {icon}
- {tag ? (
- <div className="flex items-center gap-2">
- <Tag
- variant="small"
- color="emerald"
- >
- {tag}
- </Tag>
- <span className={clsx('truncate', active ? 'text-white' : '')}>
- {children}
- </span>
- </div>
- ) : (
- <span className={clsx('truncate', active ? 'text-white' : '')}>{children}</span>
- )}
- </div>
- </Link>
- )
-}
-
-function VisibleSectionHighlight({ group, pathname }) {
- const [sections, visibleSections] = useInitialValue(
- [useSectionStore(s => s.sections), useSectionStore(s => s.visibleSections)],
- useIsInsideMobileNavigation(),
- )
-
- const isPresent = useIsPresent()
- const firstVisibleSectionIndex = Math.max(
- 0,
- [{ id: '_top' }, ...sections].findIndex(section => section.id === visibleSections[0]),
- )
- const itemHeight = remToPx(2)
- const height = isPresent ? Math.max(1, visibleSections.length) * itemHeight : itemHeight
- const activePageIndex = activeGroupIndex(group, pathname)
- const top = activePageIndex * itemHeight + firstVisibleSectionIndex * itemHeight
-
- return (
- <motion.div
- layout
- initial={{ opacity: 0 }}
- animate={{ opacity: 1, transition: { delay: 0.2 } }}
- exit={{ opacity: 0 }}
- className="absolute inset-x-0 top-0 bg-zinc-800/5 will-change-transform dark:bg-white/5"
- style={{ borderRadius: 8, height, top }}
- />
- )
-}
-
-function ActivePageMarker({ group, pathname }: { group: NavGroup; pathname: string }) {
- const itemHeight = remToPx(2)
- const offset = remToPx(0.25)
- const activePageIndex = activeGroupIndex(group, pathname)
- const top = offset + activePageIndex * itemHeight
-
- return (
- <motion.div
- layout
- className="absolute left-2 h-6 w-px bg-brand-500"
- initial={{ opacity: 0 }}
- animate={{ opacity: 1, transition: { delay: 0.2 } }}
- exit={{ opacity: 0 }}
- style={{ top }}
- />
- )
-}
-
-function NavigationGroup({ group, className }) {
+// function VisibleSectionHighlight({ group, pathname }) {
+// const [sections, visibleSections] = useInitialValue(
+// [useSectionStore(s => s.sections), useSectionStore(s => s.visibleSections)],
+// useIsInsideMobileNavigation(),
+// )
+
+// const isPresent = useIsPresent()
+// const firstVisibleSectionIndex = Math.max(
+// 0,
+// [{ id: '_top' }, ...sections].findIndex(section => section.id === visibleSections[0]),
+// )
+// const itemHeight = remToPx(2)
+// const height = isPresent ? Math.max(1, visibleSections.length) * itemHeight : itemHeight
+// const activePageIndex = activeGroupIndex(group, pathname)
+// const top = activePageIndex * itemHeight + firstVisibleSectionIndex * itemHeight
+
+// return (
+// <motion.div
+// layout
+// initial={{ opacity: 0 }}
+// animate={{ opacity: 1, transition: { delay: 0.2 } }}
+// exit={{ opacity: 0 }}
+// className="absolute inset-x-0 top-0 bg-zinc-800/5 will-change-transform dark:bg-white/5"
+// style={{ borderRadius: 8, height, top }}
+// />
+// )
+// }
+
+// function ActivePageMarker({ group, pathname }: { group: NavGroup; pathname: string }) {
+// const itemHeight = remToPx(2)
+// const offset = remToPx(0.25)
+// const activePageIndex = activeGroupIndex(group, pathname)
+// const top = offset + activePageIndex * itemHeight
+
+// return (
+// <motion.div
+// layout
+// className="absolute left-2 h-6 w-px bg-brand-500"
+// initial={{ opacity: 0 }}
+// animate={{ opacity: 1, transition: { delay: 0.2 } }}
+// exit={{ opacity: 0 }}
+// style={{ top }}
+// />
+// )
+// }
+
+function NavigationGroup({ group, className, isLast }: { group: NavGroup; className?: string; isLast?: boolean }) {
// If this is the mobile navigation then we always render the initial
// state, so that the state does not change during the close animation.
// The state will still update when we re-open (re-render) the navigation.
const isInsideMobileNavigation = useIsInsideMobileNavigation()
const initialPathname = usePathname()
-
- const [pathname, sections] = useInitialValue(
+ const [pathname] = useInitialValue(
[initialPathname, useSectionStore(s => s.sections)],
isInsideMobileNavigation,
)
-
if (!pathname) {
return null
}
- const isActiveGroup = activeGroupIndex(group, pathname) !== -1
+ // const isActiveGroup = activeGroupIndex(group, pathname) !== -1
return (
- <li className={clsx('relative mt-6', className)}>
+ <li className={clsx('relative', className)}>
<motion.h2
layout="position"
- className="text-sm font-semibold text-zinc-900 dark:text-white"
+ className="pl-2 text-2xs font-medium text-white mb-1"
>
{group.title}
</motion.h2>
- <div className="relative mt-3 pl-2">
- <AnimatePresence initial={!isInsideMobileNavigation}>
+ <div className="relative">
+ {/* <AnimatePresence initial={!isInsideMobileNavigation}>
{isActiveGroup && (
<VisibleSectionHighlight
group={group}
@@ -182,10 +112,6 @@ function NavigationGroup({ group, className }) {
/>
)}
</AnimatePresence>
- <motion.div
- layout
- className="absolute inset-y-0 left-2 w-px bg-zinc-900/10 dark:bg-white/5"
- />
<AnimatePresence initial={false}>
{isActiveGroup && (
<ActivePageMarker
@@ -193,106 +119,115 @@ function NavigationGroup({ group, className }) {
pathname={pathname}
/>
)}
- </AnimatePresence>
+ </AnimatePresence> */}
<ul
role="list"
className="border-l border-transparent"
>
- {group.links.map(link => (
- <motion.li
- key={link.href}
- layout="position"
- className="relative"
- >
- {/* @ts-ignore */}
- <NavLink
- className="font-medium"
- href={link.href}
- active={
- `/docs${link.href}` === pathname ||
- // Special case for index (/)
- (link.href == '/' && pathname == '/docs')
- }
- isFontMono={link.isFontMono}
- icon={link.icon}
- tag={link.tag}
- >
- {link.title}
- </NavLink>
- <AnimatePresence
- mode="popLayout"
- initial={false}
- >
- {`/docs${link.href}` === pathname && sections.length > 0 && (
- <motion.ul
- role="list"
- initial={{ opacity: 0 }}
- animate={{
- opacity: 1,
- transition: { delay: 0.1 },
- }}
- exit={{
- opacity: 0,
- transition: { duration: 0.15 },
- }}
- >
- {sections.map(section => (
- <li key={section.id}>
- {/* @ts-ignore */}
- <NavLink
- href={`${link.href}#${section.id}`}
- tag={section.tag}
- icon={section.icon}
- isAnchorLink
- >
- {section.title}
- </NavLink>
- </li>
- ))}
- </motion.ul>
+ <>
+ {group.items?.map(item => (
+ <>
+ {(item as any).links ? (
+ <NavigationSubgroup subgroup={item as NavSubgroup} />
+ ) : (
+ <NavigationLink
+ link={item as NavLink}
+ className="font-medium"
+ // href={item.href}
+ // active={
+ // `/docs${item.href}` === pathname ||
+ // // Special case for index (/)
+ // (item.href == '/' && pathname == '/docs')
+ // }
+ // tag={item.tag}
+ />
)}
- </AnimatePresence>
- </motion.li>
- ))}
+ </>
+ ))}
+
+ {/* {group.links?.map(link => (
+ <motion.li
+ key={link.href}
+ layout="position"
+ className="relative"
+ >
+ <NavigationLink
+ className="font-medium"
+ href={link.href}
+ active={
+ `/docs${link.href}` === pathname ||
+ // Special case for index (/)
+ (link.href == '/' && pathname == '/docs')
+ }
+ isFontMono={link.isFontMono}
+ icon={link.icon}
+ tag={link.tag}
+ >
+ {link.title}
+ </NavigationLink>
+ <AnimatePresence
+ mode="popLayout"
+ initial={false}
+ >
+ {`/docs${link.href}` === pathname && sections.length > 0 && (
+ <motion.ul
+ role="list"
+ initial={{ opacity: 0 }}
+ animate={{
+ opacity: 1,
+ transition: { delay: 0.1 },
+ }}
+ exit={{
+ opacity: 0,
+ transition: { duration: 0.15 },
+ }}
+ >
+ {sections.map(section => (
+ <li key={section.id}>
+ <NavigationLink
+ href={`${link.href}#${section.id}`}
+ tag={section.tag}
+ icon={section.icon}
+ isAnchorLink
+ >
+ {section.title}
+ </NavigationLink>
+ </li>
+ ))}
+ </motion.ul>
+ )}
+ </AnimatePresence>
+ </motion.li>
+ ))} */}
+ </>
</ul>
</div>
- <div className="h-px bg-zinc-900/10 dark:bg-white/5 my-4"></div>
+ {!isLast && (
+ <div className="ml-2 h-px bg-white/5 my-4"></div>
+ )}
</li>
)
}
-
export function Navigation(props) {
return (
<nav {...props}>
<ul role="list">
- {/* <TopLevelNavItem href="/">API</TopLevelNavItem>
- <TopLevelNavItem href="#">Documentation</TopLevelNavItem>
- <TopLevelNavItem href="#">Support</TopLevelNavItem> */}
{routes.map((group, groupIndex) => (
<NavigationGroup
key={group.title}
group={group}
- className={groupIndex === 0 && 'md:mt-0'}
+ className={groupIndex === 0 ? 'md:mt-0' : undefined}
+ isLast={groupIndex === routes.length - 1}
/>
))}
- <li
- /* -1.5rem to stretch outside the padding of the parent list */
- className="
- sticky bottom-[-1.5rem] z-10 mx-[-1.5rem] mt-[1.5rem] py-3
- backdrop-blur-lg backdrop-filter
- min-[540px]:hidden
- "
- >
- <Auth />
- </li>
</ul>
</nav>
)
}
-function activeGroupIndex(group: NavGroup, pathname: string) {
- return group.links.findIndex(link => {
- return link.href === pathname
- })
-}
+// function activeGroupIndex(group: NavGroup, pathname: string) {
+// return group.items.findIndex(item => {
+// return item.href === pathname
+// })
+// }
diff --git a/apps/web/src/components/Navigation/routes.tsx b/apps/web/src/components/Navigation/routes.tsx
index 945cf3847..1658bebac 100644
--- a/apps/web/src/components/Navigation/routes.tsx
+++ b/apps/web/src/components/Navigation/routes.tsx
@@ -1,38 +1,38 @@
-// import {
-// BarChart,
-// BookOpen,
-// Braces,
-// ChevronRightSquare,
-// Cog,
-// Cpu,
-// DollarSign,
-// File,
-// FileDown,
-// FileUp,
-// Folder,
-// FolderTree,
-// Hammer,
-// HardDrive,
-// KeyRound,
-// Link,
-// PencilRuler,
-// PlaySquare,
-// RefreshCw,
-// Settings,
-// ShieldQuestion,
-// Terminal,
-// TerminalSquare,
-// Timer,
-// Variable,
-// Wrench,
-// } from 'lucide-react'
+import {
+ Home,
+ // BarChart,
+ // BookOpen,
+ // Braces,
+ // ChevronRightSquare,
+ // Cog,
+ // Cpu,
+ // DollarSign,
+ // File,
+ // FileDown,
+ // FileUp,
+ // Folder,
+ // FolderTree,
+ // Hammer,
+ // HardDrive,
+ // KeyRound,
+ // Link,
+ // PencilRuler,
+ // PlaySquare,
+ // RefreshCw,
+ // Settings,
+ // ShieldQuestion,
+ // Terminal,
+ // TerminalSquare,
+ // Timer,
+ // Variable,
+ // Wrench,
+} from 'lucide-react'
// import logoNode from '@/images/logos/node.svg'
// import logoPython from '@/images/logos/python.svg'
// import Image from 'next/image'
// @ts-ignore; generated by prebuild.ts
-import apiRefRoutes from './apiRefRoutes.json'
@@ -63,28 +63,62 @@ import apiRefRoutes from './apiRefRoutes.json'
// - Cookbook
//
-export const routes = [
+
+export interface NavLink {
+ title: string
+ href: string
+ icon?: React.ReactNode
+}
+
+export interface NavSubgroup {
+ title: string
+ links: NavLink[]
+}
+
+export interface NavGroup {
+ title?: string
+ items: Array<NavLink | NavSubgroup>
+ // links?: NavLink[]
+ // subgroups?: NavSubgroup[]
+}
+
+
+// export interface NavGroupWithLinks {
+// title?: string
+// links: NavLink[]
+// subgroups?: never // This ensures that subgroups is not present when links is used
+// }
+
+// export interface NavGroupWithSubgroups {
+// title?: string
+// links?: never // This ensures that links is not present when subgroups is used
+// subgroups: NavSubgroup[]
+// }
+
+// export type NavGroup = NavGroupWithLinks | NavGroupWithSubgroups
+
+export const routes: NavGroup[] = [
{
- title: '',
- links: [
+ items: [
{
title: 'Home',
href: '/docs',
+ icon: <Home size={16} />,
},
],
},
{
title: 'Quickstart',
- links: [
+ items: [
{
title: 'Start E2B Sandbox',
- href: '/docs/installation',
+ href: '/docs/hello-world/js',
},
]
},
{
title: 'Guides', // How to's
- links: [
+ items: [
{
title: 'Execute AI-generated code',
href: '/docs/a',
@@ -110,31 +144,52 @@ export const routes = [
href: '/docs/f',
},
{
- title: 'Associate specific sandbox with your user',
+ title: 'Link specific sandbox with user',
href: '/docs/g',
}
]
},
{
title: 'AI Code Execution',
- links: [
+ items: [
{
title: 'Data analysis',
- href: '/docs/code-execution/overview',
+ links: [
+ {
+ title: 'Overview',
+ href: '/docs/hello-world/py',
+ },
+ {
+ title: 'Data visualization',
+ href: '/docs/code-execution/overview',
+ },
+ {
+ title: 'Interactive charts',
+ href: '/docs/code-execution/overview',
+ },
+ ]
},
{
- title: 'Data visualization',
- href: '/docs/code-execution/overview',
+ title: 'Python',
+ href: '/docs/code-execution/python',
},
{
- title: 'Interactive charts',
- href: '/docs/code-execution/overview',
+ title: 'JavaScript',
+ href: '/docs/code-execution/python',
},
- ]
+ {
+ title: 'TypeScript',
+ href: '/docs/code-execution/python',
+ },
+ {
+ title: 'Custom language',
+ href: '/docs/code-execution/python',
+ },
+ ],
},
{
title: 'Sandbox',
- links: [
+ items: [
{
title: 'Lifecycle',
href: '/docs/sandbox/lifecycle',
@@ -151,7 +206,7 @@ export const routes = [
},
{
title: 'Filesystem',
- links: [
+ items: [
{
title: 'Overview',
href: '/docs/filesystem/overview',
@@ -160,7 +215,7 @@ export const routes = [
},
{
title: 'Commands',
- links: [
+ items: [
{
title: 'Overview',
href: '/docs/process/overview',
@@ -171,7 +226,7 @@ export const routes = [
{
// Maybe move integrations to a separate page?
title: 'Integrations',
- links: [
+ items: [
{
title: 'OpenAI',
href: '/docs/integrations/openai',
@@ -186,256 +241,6 @@ export const routes = [
},
]
},
- ...apiRefRoutes,
+ // ...apiRefRoutes,
]
-
-
-// export const routes = [
-// {
-// title: 'Getting Started',
-// links: [
-// {
-// title: 'Installation',
-// href: '/docs',
-// },
-// {
-// title: 'helloWorld.[ts|js]',
-// href: '/docs/hello-world/js',
-// icon: <Image src={logoNode} width={20} height={20} alt="Python logo" />,
-// isFontMono: true,
-// },
-// {
-// title: 'hello_world.py',
-// href: '/docs/hello-world/py',
-// icon: <Image src={logoPython} width={20} height={20} alt="Python logo" />,
-// isFontMono: true,
-// },
-// {
-// title: 'Supported LLMs and AI frameworks',
-// href: '/docs/supported',
-// },
-// // {
-// // title: 'What\'s Code Interpreting?',
-// // href: '/code-interpreting',
-// // },
-// {
-// icon: <KeyRound strokeWidth={1} size={20} />,
-// title: 'API Key',
-// href: '/docs/getting-started/api-key',
-// },
-// {
-// icon: <DollarSign strokeWidth={1} size={20} />,
-// title: 'Pricing',
-// href: '/docs/pricing',
-// },
-// {
-// icon: <BarChart strokeWidth={1} size={20} />,
-// title: 'Track usage',
-// href: '/dashboard?tab=usage',
-// },
-// {
-// icon: <ShieldQuestion strokeWidth={1} size={20} />,
-// title: 'Getting help',
-// href: '/docs/getting-help',
-// },
-// ],
-// },
-// {
-// title: 'Guides',
-// links: [
-// {
-// icon: <BookOpen strokeWidth={1} size={20} />,
-// title: 'Guides and examples in cookbook',
-// href: 'https://github.com/e2b-dev/e2b-cookbook',
-// },
-// {
-// icon: <BookOpen strokeWidth={1} size={20} />,
-// title: '[SDK Beta] Migration',
-// href: '/docs/guide/beta-migration',
-// },
-// {
-// icon: <BookOpen strokeWidth={1} size={20} />,
-// title: '[SDK Beta] Runtimes in Code Interpreter',
-// href: '/docs/guide/beta-code-interpreter-language-runtimes',
-// },
-// // {
-// // icon: <Hammer strokeWidth={1} size={20} />,
-// // title: 'Guide: Code Interpreter with OpenAI models',
-// // href: '/guide/simple-gpt4-code-interpreter',
-// // },
-// // {
-// // icon: <Hammer strokeWidth={1} size={20} />,
-// // title: 'Guide: Secure Sandbox for Devin-like agent',
-// // href: '/guide/simple-gpt4-code-interpreter',
-// // },
-// // {
-// // icon: <Hammer strokeWidth={1} size={20} />,
-// // title: 'Guide: Generative UI with Next.js',
-// // href: '/guide/simple-gpt4-code-interpreter',
-// // },
-// // {
-// // icon: <Hammer strokeWidth={1} size={20} />,
-// // title: 'Guide: Upload and analyze CSV files with AI',
-// // href: '/guide/simple-gpt4-code-interpreter',
-// // },
-// // {
-// // icon: <Hammer strokeWidth={1} size={20} />,
-// // title: 'Guide: Customize sandbox compute (TODO: Move this away from guides?)',
-// // href: '/guide/simple-gpt4-code-interpreter',
-// // },
-// ],
-// },
-// {
-// title: 'E2B Code Interpreter',
-// links: [
-// {
-// title: 'Installation',
-// href: '/docs/code-interpreter/installation',
-// },
-// {
-// icon: <Terminal strokeWidth={1} size={20} />,
-// title: 'AI Code Execution',
-// href: '/docs/code-interpreter/execution',
-// },
-// // {
-// // icon: <Book strokeWidth={1} size={20} />,
-// // title: 'Streaming',
-// // href: '/code-interpreter/examples',
-// // },
-// // {
-// // icon: <Wrench strokeWidth={1} size={20} />,
-// // title: 'Supported languages',
-// // href: '/code-interpreter/template',
-// // },
-// // {
-// // icon: <Wrench strokeWidth={1} size={20} />,
-// // title: 'Preinstalled packages (customization)',
-// // href: '/code-interpreter/template',
-// // },
-// {
-// icon: <Wrench strokeWidth={1} size={20} />,
-// title: 'Customization',
-// href: '/docs/code-interpreter/template',
-// },
-// {
-// icon: <Cog strokeWidth={1} size={20} />,
-// title: 'Kernels',
-// href: '/docs/code-interpreter/kernels',
-// },
-// ],
-// },
-// {
-// title: 'E2B Sandbox',
-// links: [
-// {
-// title: 'Overview',
-// href: '/docs/sandbox/overview',
-// },
-// {
-// icon: <Cpu strokeWidth={1} size={20} />,
-// title: 'Compute',
-// href: '/docs/sandbox/compute',
-// },
-// {
-// icon: <PencilRuler strokeWidth={1} size={20} />,
-// title: 'Customization',
-// href: '/docs/sandbox/custom',
-// },
-// {
-// icon: <Variable strokeWidth={1} size={20} />,
-// title: 'Environment Variables',
-// href: '/docs/sandbox/api/envs',
-// },
-// {
-// icon: <FolderTree strokeWidth={1} size={20} />,
-// title: 'Filesystem',
-// href: '/docs/sandbox/api/filesystem',
-// },
-// {
-// icon: <ChevronRightSquare strokeWidth={1} size={20} />,
-// title: 'Process',
-// href: '/docs/sandbox/api/process',
-// },
-// {
-// icon: <Folder strokeWidth={1} size={20} />,
-// title: 'Working Directory',
-// href: '/docs/sandbox/api/cwd',
-// },
-// {
-// icon: <Link strokeWidth={1} size={20} />,
-// title: 'Sandbox URL',
-// href: '/docs/sandbox/api/url',
-// },
-// {
-// icon: <FileUp strokeWidth={1} size={20} />,
-// title: 'Upload Files',
-// href: '/docs/sandbox/api/upload',
-// },
-// {
-// icon: <FileDown strokeWidth={1} size={20} />,
-// title: 'Download Files',
-// href: '/docs/sandbox/api/download',
-// },
-// {
-// icon: <Timer strokeWidth={1} size={20} />,
-// title: 'Timeouts',
-// href: '/docs/sandbox/api/timeouts',
-// },
-// {
-// icon: <RefreshCw strokeWidth={1} size={20} />,
-// title: 'Connect to running sandbox',
-// href: '/docs/sandbox/api/reconnect',
-// },
-// {
-// icon: <Braces strokeWidth={1} size={20} />,
-// title: 'Sandbox metadata',
-// href: '/docs/sandbox/api/metadata',
-// },
-// ],
-// },
-// {
-// title: 'CLI',
-// links: [
-// {
-// icon: <Settings strokeWidth={1} size={20} />,
-// title: 'Installation',
-// href: '/docs/cli/installation',
-// },
-// {
-// icon: <TerminalSquare strokeWidth={1} size={20} />,
-// title: 'Commands',
-// href: '/docs/cli/commands',
-// },
-// ],
-// },
-// {
-// title: 'Custom Sandboxes',
-// links: [
-// {
-// title: 'Overview',
-// href: '/docs/sandbox/templates/overview',
-// },
-// {
-// icon: <File strokeWidth={1} size={20} />,
-// title: 'Template File',
-// href: '/docs/sandbox/templates/template-file',
-// },
-// {
-// icon: <PlaySquare strokeWidth={1} size={20} />,
-// title: 'Start Command',
-// href: '/docs/sandbox/templates/start-cmd',
-// },
-// {
-// icon: <Hammer strokeWidth={1} size={20} />,
-// title: 'Guide: Creating Custom Sandbox',
-// href: '/docs/guide/custom-sandbox',
-// },
-// {
-// icon: <HardDrive strokeWidth={1} size={20} />,
-// title: 'Connecting buckets to persist data',
-// href: '/docs/guide/connect-bucket',
-// },
-// ],
-// },
-// ]
diff --git a/apps/web/src/styles/tailwind.css b/apps/web/src/styles/tailwind.css
index 4ec47a660..1092e15cb 100644
--- a/apps/web/src/styles/tailwind.css
+++ b/apps/web/src/styles/tailwind.css
@@ -121,7 +121,7 @@
--radius: 0.5rem;
- --sidebar-nav-width: 376px;
+ --sidebar-nav-width: 275px;
}
.dark {