Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Fix default app background color; Add basic sign in page

Tomas Valenta52e4622e6e7d
diff --git a/components/AgentDetail.tsx b/components/AgentDetail.tsx
new file mode 100644
index 000000000..612a99c50
--- /dev/null
+++ b/components/AgentDetail.tsx
@@ -0,0 +1,282 @@
+import { Fragment, useState } from 'react'
+import { Dialog, Transition } from '@headlessui/react'
+// import {
+// XMarkIcon,
+// } from '@heroicons/react/24/outline'
+import { ChevronRightIcon } from '@heroicons/react/20/solid'
+import clsx from 'clsx'
+import { Grid } from 'lucide-react'
+
+import { projects, deployments } from 'db/prisma'
+
+const navigation = [
+ {
+ name: 'Agents', href: '#', icon: Grid, current: false,
+ },
+]
+const statuses = {
+ offline: 'text-gray-500 bg-gray-100/10',
+ online: 'text-green-400 bg-green-400/10',
+ error: 'text-rose-400 bg-rose-400/10',
+}
+const environments = {
+ Preview: 'text-gray-400 bg-gray-400/10 ring-gray-400/20',
+ Production: 'text-indigo-400 bg-indigo-400/10 ring-indigo-400/30',
+}
+const deployments = [
+ {
+ id: 1,
+ href: '#',
+ projectName: 'smol-ai/developer',
+ teamName: 'Smol Agent',
+ status: 'offline',
+ statusText: 'Initiated 1m 32s ago',
+ description: 'Deployed to GitHub repository ValentaTomas/test',
+ environment: 'PR#11',
+ },
+ {
+ id: 2,
+ href: '#',
+ projectName: 'smol-ai/developer',
+ teamName: 'Smol Agent',
+ status: 'online',
+ statusText: 'Initiated 1m 32s ago',
+ description: 'Deployed to GitHub repository ValentaTomas/test',
+ environment: 'PR#12',
+ },
+]
+const activityItems = [
+ {
+ user: {
+ name: 'Michael Foster',
+ imageUrl:
+ 'https://images.unsplash.com/photo-1519244703995-f4e0f30006d5?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80',
+ },
+ projectName: 'ios-app',
+ commit: '2d89f0c8',
+ branch: 'main',
+ date: '1h',
+ dateTime: '2023-01-23T11:00',
+ },
+ // More items...
+]
+
+export interface Props {
+ project: projects & { deployments: deployments[] }
+}
+
+
+export default function AgentDetail({ project }: Props) {
+
+
+
+
+
+
+
+ const [sidebarOpen, setSidebarOpen] = useState(false)
+
+ return (
+ <>
+ {/*
+ This example requires updating your template:
+
+ ```
+ <html class="h-full bg-gray-900">
+ <body class="h-full">
+ ```
+ */}
+ <div>
+ <Transition.Root show={sidebarOpen} as={Fragment}>
+ <Dialog as="div" className="relative z-50 xl:hidden" onClose={setSidebarOpen}>
+ <Transition.Child
+ as={Fragment}
+ enter="transition-opacity ease-linear duration-300"
+ enterFrom="opacity-0"
+ enterTo="opacity-100"
+ leave="transition-opacity ease-linear duration-300"
+ leaveFrom="opacity-100"
+ leaveTo="opacity-0"
+ >
+ <div className="fixed inset-0 bg-gray-900/80" />
+ </Transition.Child>
+
+ <div className="fixed inset-0 flex">
+ <Transition.Child
+ as={Fragment}
+ enter="transition ease-in-out duration-300 transform"
+ enterFrom="-translate-x-full"
+ enterTo="translate-x-0"
+ leave="transition ease-in-out duration-300 transform"
+ leaveFrom="translate-x-0"
+ leaveTo="-translate-x-full"
+ >
+ <Dialog.Panel className="relative mr-16 flex w-full max-w-xs flex-1">
+ <Transition.Child
+ as={Fragment}
+ enter="ease-in-out duration-300"
+ enterFrom="opacity-0"
+ enterTo="opacity-100"
+ leave="ease-in-out duration-300"
+ leaveFrom="opacity-100"
+ leaveTo="opacity-0"
+ >
+ <div className="absolute left-full top-0 flex w-16 justify-center pt-5">
+ <button type="button" className="-m-2.5 p-2.5" onClick={() => setSidebarOpen(false)}>
+ <span className="sr-only">Close sidebar</span>
+ {/* <XMarkIcon className="h-6 w-6 text-white" aria-hidden="true" /> */}
+ </button>
+ </div>
+ </Transition.Child>
+ {/* Sidebar component, swap this element with another sidebar if you like */}
+ <div className="flex grow flex-col gap-y-5 overflow-y-auto bg-gray-900 px-6 ring-1 ring-white/10">
+ <div className="flex h-16 shrink-0 items-center">
+ <img
+ className="h-8 w-auto"
+ src="https://tailwindui.com/img/logos/mark.svg?color=indigo&shade=500"
+ alt="Your Company"
+ />
+ </div>
+ <nav className="flex flex-1 flex-col">
+ <ul role="list" className="flex flex-1 flex-col gap-y-7">
+ <li>
+ <ul role="list" className="-mx-2 space-y-1">
+ {navigation.map((item) => (
+ <li key={item.name}>
+ <a
+ href={item.href}
+ className={clsx(
+ item.current
+ ? 'bg-gray-800 text-white'
+ : 'text-gray-400 hover:text-white hover:bg-gray-800',
+ 'group flex gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold'
+ )}
+ >
+ <item.icon className="h-6 w-6 shrink-0" aria-hidden="true" />
+ {item.name}
+ </a>
+ </li>
+ ))}
+ </ul>
+ </li>
+ <li className="-mx-6 mt-auto">
+ <a
+ href="#"
+ className="flex items-center gap-x-4 px-6 py-3 text-sm font-semibold leading-6 text-white hover:bg-gray-800"
+ >
+ <span className="sr-only">Your profile</span>
+ <span aria-hidden="true">Tom Cook</span>
+ </a>
+ </li>
+ </ul>
+ </nav>
+ </div>
+ </Dialog.Panel>
+ </Transition.Child>
+ </div>
+ </Dialog>
+ </Transition.Root>
+
+ {/* Static sidebar for desktop */}
+ <div className="hidden xl:fixed xl:inset-y-0 xl:z-50 xl:flex xl:w-72 xl:flex-col">
+ {/* Sidebar component, swap this element with another sidebar if you like */}
+ <div className="flex grow flex-col gap-y-5 overflow-y-auto bg-black/10 px-6 ring-1 ring-white/5">
+ <div className="flex h-16 shrink-0 items-center">
+ <img
+ className="h-8 w-auto"
+ src="https://tailwindui.com/img/logos/mark.svg?color=indigo&shade=500"
+ alt="Your Company"
+ />
+ </div>
+ <nav className="flex flex-1 flex-col">
+ <ul role="list" className="flex flex-1 flex-col gap-y-7">
+ <li>
+ <ul role="list" className="-mx-2 space-y-1">
+ {navigation.map((item) => (
+ <li key={item.name}>
+ <a
+ href={item.href}
+ className={clsx(
+ item.current
+ ? 'bg-gray-800 text-white'
+ : 'text-gray-400 hover:text-white hover:bg-gray-800',
+ 'group flex gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold'
+ )}
+ >
+ <item.icon className="h-6 w-6 shrink-0" aria-hidden="true" />
+ {item.name}
+ </a>
+ </li>
+ ))}
+ </ul>
+ </li>
+ <li className="-mx-6 mt-auto">
+ <a
+ href="#"
+ className="flex items-center gap-x-4 px-6 py-3 text-sm font-semibold leading-6 text-white hover:bg-gray-800"
+ >
+ <img
+ className="h-8 w-8 rounded-full bg-gray-800"
+ src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80"
+ alt=""
+ />
+ <span className="sr-only">Your profile</span>
+ <span aria-hidden="true">Tom Cook</span>
+ </a>
+ </li>
+ </ul>
+ </nav>
+ </div>
+ </div>
+
+ <div className="xl:pl-72">
+ <main className="">
+ <header className="flex items-center justify-between border-b border-white/5 p-4 sm:p-6 lg:px-8">
+ <h1 className="text-base font-semibold leading-7 text-white">Agents</h1>
+ </header>
+
+ {/* Deployment list */}
+ <ul role="list" className="divide-y divide-white/5">
+ {deployments.map((deployment) => (
+ <li key={deployment.id} className="relative flex items-center space-x-4 p-4 sm:px-6 lg:px-8">
+ <div className="min-w-0 flex-auto">
+ <div className="flex items-center gap-x-3">
+ <div className={clsx(statuses[deployment.status as keyof typeof statuses], 'flex-none rounded-full p-1')}>
+ <div className="h-2 w-2 rounded-full bg-current" />
+ </div>
+ <h2 className="min-w-0 text-sm font-semibold leading-6 text-white">
+ <a href={deployment.href} className="flex gap-x-2">
+ <span className="truncate">{deployment.teamName}</span>
+ <span className="text-gray-400">-</span>
+ <span className="whitespace-nowrap">{deployment.projectName}</span>
+ <span className="absolute inset-0" />
+ </a>
+ </h2>
+ </div>
+ <div className="mt-3 flex items-center gap-x-2.5 text-xs leading-5 text-gray-400">
+ <p className="truncate">{deployment.description}</p>
+ <svg viewBox="0 0 2 2" className="h-0.5 w-0.5 flex-none fill-gray-300">
+ <circle cx={1} cy={1} r={1} />
+ </svg>
+ <p className="whitespace-nowrap">{deployment.statusText}</p>
+ </div>
+ </div>
+ <div
+ className={clsx(
+ environments[deployment.environment as keyof typeof environments],
+ 'rounded-full flex-none py-1 px-2 text-xs font-medium ring-1 ring-inset'
+ )}
+ >
+ {deployment.environment}
+ </div>
+ <ChevronRightIcon className="h-5 w-5 flex-none text-gray-400" aria-hidden="true" />
+ </li>
+ ))}
+ </ul>
+ </main>
+
+ </div>
+ </div>
+ </>
+ )
+}
diff --git a/components/AgentOverview.tsx b/components/AgentOverview.tsx
index dc470e1b6..e53a44ca9 100644
--- a/components/AgentOverview.tsx
+++ b/components/AgentOverview.tsx
@@ -65,211 +65,203 @@ export interface Props {
projects: (projects & { deployments: deployments[] })[]
}
+export default function AgentOverview({ projects }: Props) {
+ const projectWithDeployments = projects
+ .filter(p => p.deployments.length > 0)
-export default function Example({ projects }: Props) {
const [sidebarOpen, setSidebarOpen] = useState(false)
return (
- <>
- {/*
- This example requires updating your template:
+ <div>
+ <Transition.Root show={sidebarOpen} as={Fragment}>
+ <Dialog as="div" className="relative z-50 xl:hidden" onClose={setSidebarOpen}>
+ <Transition.Child
+ as={Fragment}
+ enter="transition-opacity ease-linear duration-300"
+ enterFrom="opacity-0"
+ enterTo="opacity-100"
+ leave="transition-opacity ease-linear duration-300"
+ leaveFrom="opacity-100"
+ leaveTo="opacity-0"
+ >
+ <div className="fixed inset-0 bg-gray-900/80" />
+ </Transition.Child>
- ```
- <html class="h-full bg-gray-900">
- <body class="h-full">
- ```
- */}
- <div>
- <Transition.Root show={sidebarOpen} as={Fragment}>
- <Dialog as="div" className="relative z-50 xl:hidden" onClose={setSidebarOpen}>
+ <div className="fixed inset-0 flex">
<Transition.Child
as={Fragment}
- enter="transition-opacity ease-linear duration-300"
- enterFrom="opacity-0"
- enterTo="opacity-100"
- leave="transition-opacity ease-linear duration-300"
- leaveFrom="opacity-100"
- leaveTo="opacity-0"
+ enter="transition ease-in-out duration-300 transform"
+ enterFrom="-translate-x-full"
+ enterTo="translate-x-0"
+ leave="transition ease-in-out duration-300 transform"
+ leaveFrom="translate-x-0"
+ leaveTo="-translate-x-full"
>
- <div className="fixed inset-0 bg-gray-900/80" />
- </Transition.Child>
-
- <div className="fixed inset-0 flex">
- <Transition.Child
- as={Fragment}
- enter="transition ease-in-out duration-300 transform"
- enterFrom="-translate-x-full"
- enterTo="translate-x-0"
- leave="transition ease-in-out duration-300 transform"
- leaveFrom="translate-x-0"
- leaveTo="-translate-x-full"
- >
- <Dialog.Panel className="relative mr-16 flex w-full max-w-xs flex-1">
- <Transition.Child
- as={Fragment}
- enter="ease-in-out duration-300"
- enterFrom="opacity-0"
- enterTo="opacity-100"
- leave="ease-in-out duration-300"
- leaveFrom="opacity-100"
- leaveTo="opacity-0"
- >
- <div className="absolute left-full top-0 flex w-16 justify-center pt-5">
- <button type="button" className="-m-2.5 p-2.5" onClick={() => setSidebarOpen(false)}>
- <span className="sr-only">Close sidebar</span>
- {/* <XMarkIcon className="h-6 w-6 text-white" aria-hidden="true" /> */}
- </button>
- </div>
- </Transition.Child>
- {/* Sidebar component, swap this element with another sidebar if you like */}
- <div className="flex grow flex-col gap-y-5 overflow-y-auto bg-gray-900 px-6 ring-1 ring-white/10">
- <div className="flex h-16 shrink-0 items-center">
- <img
- className="h-8 w-auto"
- src="https://tailwindui.com/img/logos/mark.svg?color=indigo&shade=500"
- alt="Your Company"
- />
- </div>
- <nav className="flex flex-1 flex-col">
- <ul role="list" className="flex flex-1 flex-col gap-y-7">
- <li>
- <ul role="list" className="-mx-2 space-y-1">
- {navigation.map((item) => (
- <li key={item.name}>
- <a
- href={item.href}
- className={clsx(
- item.current
- ? 'bg-gray-800 text-white'
- : 'text-gray-400 hover:text-white hover:bg-gray-800',
- 'group flex gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold'
- )}
- >
- <item.icon className="h-6 w-6 shrink-0" aria-hidden="true" />
- {item.name}
- </a>
- </li>
- ))}
- </ul>
- </li>
- <li className="-mx-6 mt-auto">
- <a
- href="#"
- className="flex items-center gap-x-4 px-6 py-3 text-sm font-semibold leading-6 text-white hover:bg-gray-800"
- >
- <span className="sr-only">Your profile</span>
- <span aria-hidden="true">Tom Cook</span>
- </a>
- </li>
- </ul>
- </nav>
+ <Dialog.Panel className="relative mr-16 flex w-full max-w-xs flex-1">
+ <Transition.Child
+ as={Fragment}
+ enter="ease-in-out duration-300"
+ enterFrom="opacity-0"
+ enterTo="opacity-100"
+ leave="ease-in-out duration-300"
+ leaveFrom="opacity-100"
+ leaveTo="opacity-0"
+ >
+ <div className="absolute left-full top-0 flex w-16 justify-center pt-5">
+ <button type="button" className="-m-2.5 p-2.5" onClick={() => setSidebarOpen(false)}>
+ <span className="sr-only">Close sidebar</span>
+ {/* <XMarkIcon className="h-6 w-6 text-white" aria-hidden="true" /> */}
+ </button>
</div>
- </Dialog.Panel>
- </Transition.Child>
- </div>
- </Dialog>
- </Transition.Root>
-
- {/* Static sidebar for desktop */}
- <div className="hidden xl:fixed xl:inset-y-0 xl:z-50 xl:flex xl:w-72 xl:flex-col">
- {/* Sidebar component, swap this element with another sidebar if you like */}
- <div className="flex grow flex-col gap-y-5 overflow-y-auto bg-black/10 px-6 ring-1 ring-white/5">
- <div className="flex h-16 shrink-0 items-center">
- <img
- className="h-8 w-auto"
- src="https://tailwindui.com/img/logos/mark.svg?color=indigo&shade=500"
- alt="Your Company"
- />
- </div>
- <nav className="flex flex-1 flex-col">
- <ul role="list" className="flex flex-1 flex-col gap-y-7">
- <li>
- <ul role="list" className="-mx-2 space-y-1">
- {navigation.map((item) => (
- <li key={item.name}>
+ </Transition.Child>
+ {/* Sidebar component, swap this element with another sidebar if you like */}
+ <div className="flex grow flex-col gap-y-5 overflow-y-auto bg-gray-900 px-6 ring-1 ring-white/10">
+ <div className="flex h-16 shrink-0 items-center">
+ <img
+ className="h-8 w-auto"
+ src="https://tailwindui.com/img/logos/mark.svg?color=indigo&shade=500"
+ alt="Your Company"
+ />
+ </div>
+ <nav className="flex flex-1 flex-col">
+ <ul role="list" className="flex flex-1 flex-col gap-y-7">
+ <li>
+ <ul role="list" className="-mx-2 space-y-1">
+ {navigation.map((item) => (
+ <li key={item.name}>
+ <a
+ href={item.href}
+ className={clsx(
+ item.current
+ ? 'bg-gray-800 text-white'
+ : 'text-gray-400 hover:text-white hover:bg-gray-800',
+ 'group flex gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold'
+ )}
+ >
+ <item.icon className="h-6 w-6 shrink-0" aria-hidden="true" />
+ {item.name}
+ </a>
+ </li>
+ ))}
+ </ul>
+ </li>
+ <li className="-mx-6 mt-auto">
<a
- href={item.href}
- className={clsx(
- item.current
- ? 'bg-gray-800 text-white'
- : 'text-gray-400 hover:text-white hover:bg-gray-800',
- 'group flex gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold'
- )}
+ href="#"
+ className="flex items-center gap-x-4 px-6 py-3 text-sm font-semibold leading-6 text-white hover:bg-gray-800"
>
- <item.icon className="h-6 w-6 shrink-0" aria-hidden="true" />
- {item.name}
+ <span className="sr-only">Your profile</span>
+ <span aria-hidden="true">Tom Cook</span>
</a>
</li>
- ))}
- </ul>
- </li>
- <li className="-mx-6 mt-auto">
- <a
- href="#"
- className="flex items-center gap-x-4 px-6 py-3 text-sm font-semibold leading-6 text-white hover:bg-gray-800"
- >
- <img
- className="h-8 w-8 rounded-full bg-gray-800"
- src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80"
- alt=""
- />
- <span className="sr-only">Your profile</span>
- <span aria-hidden="true">Tom Cook</span>
- </a>
- </li>
- </ul>
- </nav>
+ </ul>
+ </nav>
+ </div>
+ </Dialog.Panel>
+ </Transition.Child>
</div>
+ </Dialog>
+ </Transition.Root>
+
+ {/* Static sidebar for desktop */}
+ <div className="hidden xl:fixed xl:inset-y-0 xl:z-50 xl:flex xl:w-72 xl:flex-col">
+ {/* Sidebar component, swap this element with another sidebar if you like */}
+ <div className="flex grow flex-col gap-y-5 overflow-y-auto bg-black/10 px-6 ring-1 ring-white/5">
+ <div className="flex h-16 shrink-0 items-center">
+ <img
+ className="h-8 w-auto"
+ src="https://tailwindui.com/img/logos/mark.svg?color=indigo&shade=500"
+ alt="Your Company"
+ />
+ </div>
+ <nav className="flex flex-1 flex-col">
+ <ul role="list" className="flex flex-1 flex-col gap-y-7">
+ <li>
+ <ul role="list" className="-mx-2 space-y-1">
+ {navigation.map((item) => (
+ <li key={item.name}>
+ <a
+ href={item.href}
+ className={clsx(
+ item.current
+ ? 'bg-gray-800 text-white'
+ : 'text-gray-400 hover:text-white hover:bg-gray-800',
+ 'group flex gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold'
+ )}
+ >
+ <item.icon className="h-6 w-6 shrink-0" aria-hidden="true" />
+ {item.name}
+ </a>
+ </li>
+ ))}
+ </ul>
+ </li>
+ <li className="-mx-6 mt-auto">
+ <a
+ href="#"
+ className="flex items-center gap-x-4 px-6 py-3 text-sm font-semibold leading-6 text-white hover:bg-gray-800"
+ >
+ <img
+ className="h-8 w-8 rounded-full bg-gray-800"
+ src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80"
+ alt=""
+ />
+ <span className="sr-only">Your profile</span>
+ <span aria-hidden="true">Tom Cook</span>
+ </a>
+ </li>
+ </ul>
+ </nav>
</div>
+ </div>
- <div className="xl:pl-72">
- <main className="">
- <header className="flex items-center justify-between border-b border-white/5 p-4 sm:p-6 lg:px-8">
- <h1 className="text-base font-semibold leading-7 text-white">Agents</h1>
- </header>
+ <div className="xl:pl-72">
+ <main className="">
+ <header className="flex items-center justify-between border-b border-white/5 p-4 sm:p-6 lg:px-8">
+ <h1 className="text-base font-semibold leading-7 text-white">Agents</h1>
+ </header>
- {/* Deployment list */}
- <ul role="list" className="divide-y divide-white/5">
- {deployments.map((deployment) => (
- <li key={deployment.id} className="relative flex items-center space-x-4 p-4 sm:px-6 lg:px-8">
- <div className="min-w-0 flex-auto">
- <div className="flex items-center gap-x-3">
- <div className={clsx(statuses[deployment.status as keyof typeof statuses], 'flex-none rounded-full p-1')}>
- <div className="h-2 w-2 rounded-full bg-current" />
- </div>
- <h2 className="min-w-0 text-sm font-semibold leading-6 text-white">
- <a href={deployment.href} className="flex gap-x-2">
- <span className="truncate">{deployment.teamName}</span>
- <span className="text-gray-400">-</span>
- <span className="whitespace-nowrap">{deployment.projectName}</span>
- <span className="absolute inset-0" />
- </a>
- </h2>
- </div>
- <div className="mt-3 flex items-center gap-x-2.5 text-xs leading-5 text-gray-400">
- <p className="truncate">{deployment.description}</p>
- <svg viewBox="0 0 2 2" className="h-0.5 w-0.5 flex-none fill-gray-300">
- <circle cx={1} cy={1} r={1} />
- </svg>
- <p className="whitespace-nowrap">{deployment.statusText}</p>
+ {/* Deployment list */}
+ <ul role="list" className="divide-y divide-white/5">
+ {deployments.map((deployment) => (
+ <li key={deployment.id} className="relative flex items-center space-x-4 p-4 sm:px-6 lg:px-8">
+ <div className="min-w-0 flex-auto">
+ <div className="flex items-center gap-x-3">
+ <div className={clsx(statuses[deployment.status as keyof typeof statuses], 'flex-none rounded-full p-1')}>
+ <div className="h-2 w-2 rounded-full bg-current" />
</div>
+ <h2 className="min-w-0 text-sm font-semibold leading-6 text-white">
+ <a href={deployment.href} className="flex gap-x-2">
+ <span className="truncate">{deployment.teamName}</span>
+ <span className="text-gray-400">-</span>
+ <span className="whitespace-nowrap">{deployment.projectName}</span>
+ <span className="absolute inset-0" />
+ </a>
+ </h2>
</div>
- <div
- className={clsx(
- environments[deployment.environment as keyof typeof environments],
- 'rounded-full flex-none py-1 px-2 text-xs font-medium ring-1 ring-inset'
- )}
- >
- {deployment.environment}
+ <div className="mt-3 flex items-center gap-x-2.5 text-xs leading-5 text-gray-400">
+ <p className="truncate">{deployment.description}</p>
+ <svg viewBox="0 0 2 2" className="h-0.5 w-0.5 flex-none fill-gray-300">
+ <circle cx={1} cy={1} r={1} />
+ </svg>
+ <p className="whitespace-nowrap">{deployment.statusText}</p>
</div>
- <ChevronRightIcon className="h-5 w-5 flex-none text-gray-400" aria-hidden="true" />
- </li>
- ))}
- </ul>
- </main>
+ </div>
+ <div
+ className={clsx(
+ environments[deployment.environment as keyof typeof environments],
+ 'rounded-full flex-none py-1 px-2 text-xs font-medium ring-1 ring-inset'
+ )}
+ >
+ {deployment.environment}
+ </div>
+ <ChevronRightIcon className="h-5 w-5 flex-none text-gray-400" aria-hidden="true" />
+ </li>
+ ))}
+ </ul>
+ </main>
- </div>
</div>
- </>
+ </div>
)
}
diff --git a/pages/[projectID].tsx b/pages/[projectID].tsx
index 74281a648..8d110354c 100644
--- a/pages/[projectID].tsx
+++ b/pages/[projectID].tsx
@@ -1,12 +1,10 @@
import type { GetServerSideProps } from 'next'
import { createServerSupabaseClient } from '@supabase/auth-helpers-nextjs'
-import { useSupabaseClient } from '@supabase/auth-helpers-react'
import type { ParsedUrlQuery } from 'querystring'
-import { prisma, projects } from 'db/prisma'
-import { StoreProvider } from 'state/StoreProvider'
-import { Database } from 'db/supabase'
+import { prisma, projects, deployments } from 'db/prisma'
import { serverCreds } from 'db/credentials'
+import AgentDetail from 'components/AgentDetail'
interface PathProps extends ParsedUrlQuery {
projectID: string
@@ -44,6 +42,9 @@ export const getServerSideProps: GetServerSideProps<Props, PathProps> = async (c
teams: {
include: {
projects: {
+ include: {
+ deployments: true,
+ },
where: {
id: {
equals: projectID,
@@ -76,19 +77,15 @@ export const getServerSideProps: GetServerSideProps<Props, PathProps> = async (c
}
interface Props {
- project: projects
+ project: projects & { deployments: deployments[] }
}
-function EditorPage({ project }: Props) {
- const client = useSupabaseClient<Database>()
-
+function ProjectPage({ project }: Props) {
return (
- <StoreProvider
- client={client}
+ <AgentDetail
project={project}
- >
- </StoreProvider>
+ />
)
}
-export default EditorPage
+export default ProjectPage
diff --git a/pages/index.tsx b/pages/index.tsx
index 92fdfc59a..ed8ee24c1 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -54,7 +54,7 @@ export const getServerSideProps: GetServerSideProps<Props> = async (ctx) => {
const hasDefaultTeam = user?.users_teams.some(t => t.teams.is_default)
if (!hasDefaultTeam) {
- // User is without default team -> create default team.
+ // If user is without default team create default team.
await prisma.teams.create({
data: {
name: session.user.email || session.user.id,
diff --git a/pages/sign.tsx b/pages/sign.tsx
index 8e27d9e80..696cd2878 100644
--- a/pages/sign.tsx
+++ b/pages/sign.tsx
@@ -1,45 +1,62 @@
import { useRouter } from 'next/router'
-import { useUser } from '@supabase/auth-helpers-react'
+import { useSessionContext, useSupabaseClient, useUser } from '@supabase/auth-helpers-react'
+import { useEffect, useState } from 'react'
+import Spinner from 'components/Spinner'
+import { Github } from 'lucide-react'
function SignIn() {
- const router = useRouter()
+ const supabaseClient = useSupabaseClient()
const user = useUser()
+ const router = useRouter()
+ const sessionCtx = useSessionContext()
+ const [isSigningIn, setIsSigningIn] = useState(false)
- return (
- <>
- <div className="flex min-h-full flex-1 flex-col justify-center px-6 py-12 lg:px-8">
- <div className="sm:mx-auto sm:w-full sm:max-w-sm">
- <img
- className="mx-auto h-10 w-auto"
- src="https://tailwindui.com/img/logos/mark.svg?color=indigo&shade=500"
- alt="Your Company"
- />
- </div>
+ const isLoading = isSigningIn || sessionCtx.isLoading || !!sessionCtx.session
+
+ useEffect(() => {
+ if (user) {
+ router.push('/')
+ }
+ }, [user, router])
- <div className="mt-10 sm:mx-auto sm:w-full sm:max-w-sm">
- <a
- href="#"
- className="flex w-full items-center justify-center gap-3 rounded-md bg-[#24292F] px-3 py-1.5 text-white focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#24292F]"
- >
- <svg className="h-5 w-5" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20">
- <path
- fillRule="evenodd"
- d="M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z"
- clipRule="evenodd"
- />
- </svg>
- <span className="text-sm font-semibold leading-6">Continue with GitHub</span>
- </a>
- <p className="mt-10 text-center text-sm text-gray-400">
- Not a member?{' '}
- <a href="#" className="font-semibold leading-6 text-indigo-400 hover:text-indigo-300">
- Start a 14 day free trial
- </a>
- </p>
- </div>
+ async function signInWithGitHub() {
+ try {
+ setIsSigningIn(true)
+ await supabaseClient.auth.signInWithOAuth({
+ provider: 'github',
+ options: {
+ scopes: 'email',
+ }
+ })
+ } finally {
+ setIsSigningIn(false)
+ }
+ }
+
+ return (
+ <div className="flex min-h-full flex-1 flex-col justify-center px-6 py-12 lg:px-8">
+ <div className="sm:mx-auto sm:w-full sm:max-w-sm flex justify-center">
+ <h2 className="text-3xl font-semibold text-white sm:text-3xl">
+ Log in to e2b
+ </h2>
+ </div>
+ <div className="mt-10 sm:mx-auto sm:w-full sm:max-w-sm justify-center flex">
+ <button
+ className="flex items-center space-x-2 rounded-md bg-white px-3.5 py-2.5 text-sm font-semibold text-gray-900 shadow-sm hover:bg-gray-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
+ onClick={signInWithGitHub}
+ disabled={isLoading}
+ >
+ {isLoading &&
+ <Spinner />
+ }
+ {!isLoading &&
+ <Github size={16} />
+ }
+ <span>Continue with GitHub</span>
+ </button>
</div>
- </>
+ </div>
)
}
diff --git a/styles/global.css b/styles/global.css
index c008c2918..ad1eef442 100644
--- a/styles/global.css
+++ b/styles/global.css
@@ -18,7 +18,7 @@
html,
body {
- @apply h-full;
+ @apply h-full bg-gray-800;
@apply antialiased;
text-rendering: optimizeLegibility;
overflow: overlay;