Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Cleanup

Tomas Valenta52c5cfc43b55
diff --git a/components/AgentOverview.tsx b/components/AgentOverview.tsx
index 46d72cddd..2542d091c 100644
--- a/components/AgentOverview.tsx
+++ b/components/AgentOverview.tsx
@@ -8,7 +8,6 @@ import clsx from 'clsx'
import { Grid } from 'lucide-react'
import { projects, deployments } from 'db/prisma'
-import { useRouter } from 'next/router'
const navigation = [
{
@@ -19,47 +18,6 @@ const statuses = {
disabled: 'text-gray-500 bg-gray-100/10',
enabled: 'text-green-400 bg-green-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',
-// },
-// ]
-
-export interface DeleteProjectBody {
- id: string
-}
-
-async function handleDeleteProject(url: string, { arg }: { arg: DeleteProjectBody }) {
- return await fetch(url, {
- method: 'DELETE',
- body: JSON.stringify(arg),
- headers: {
- 'Content-Type': 'application/json',
- },
- }).then(r => r.json())
-}
-
export interface Props {
projects: (projects & { deployments: deployments[] })[]
@@ -67,16 +25,6 @@ export interface Props {
export default function AgentOverview({ projects }: Props) {
const [sidebarOpen, setSidebarOpen] = useState(false)
- const router = useRouter()
-
- const {
- trigger: deleteProject,
- } = useSWRMutation('/api/project', handleDeleteProject)
-
- async function handleDelete(id: string) {
- await deleteProject({ id })
- router.replace(router.asPath)
- }
const projectsWithDeployments = projects
.filter(p => p.deployments.length === 1 && p.deployments[0].auth !== null)
@@ -279,6 +227,3 @@ export default function AgentOverview({ projects }: Props) {
</div >
)
}
-function useSWRMutation(arg0: string, handleDeleteProject: (url: string, { arg }: { arg: DeleteProjectBody }) => Promise<any>): { trigger: any } {
- throw new Error('Function not implemented.')
-}
diff --git a/pages/agent/smol-developer/setup.tsx b/pages/agent/smol-developer/setup.tsx
index 6a3e88446..9539c7648 100644
--- a/pages/agent/smol-developer/setup.tsx
+++ b/pages/agent/smol-developer/setup.tsx
@@ -68,7 +68,6 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
},
}
}
-
return { props: {} }
}
diff --git a/pages/api/project.ts b/pages/api/project.ts
deleted file mode 100644
index e72fa79fd..000000000
--- a/pages/api/project.ts
+++ /dev/null
@@ -1,82 +0,0 @@
-import { createServerSupabaseClient } from '@supabase/auth-helpers-nextjs'
-import { NextApiRequest, NextApiResponse } from 'next'
-
-import { prisma } from 'db/prisma'
-import { serverCreds } from 'db/credentials'
-import type { DeleteProjectBody } from 'components/AgentOverview'
-
-async function deleteProject(req: NextApiRequest, res: NextApiResponse) {
- const { id } = req.body as DeleteProjectBody
-
- try {
- const supabase = createServerSupabaseClient({ req, res }, serverCreds)
- const { data: { session } } = await supabase.auth.getSession()
- if (!session) {
- return res.status(401).json({
- error: 'not_authenticated',
- description: 'The user does not have an active session or is not authenticated',
- })
- }
-
- const project = await prisma.projects.findFirst({
- where: {
- AND: [
- {
- id: {
- equals: id,
- }
- },
- {
- teams: {
- users_teams: {
- some: {
- user_id: {
- equals: session.user.id,
- },
- },
- },
- },
- },
- ],
- },
- })
-
- if (!project) {
- res.status(404).json({})
- return
- }
-
- await prisma.deployments.deleteMany({
- where: {
- project_id: id,
- },
- })
-
- await prisma.projects.delete({
- where: {
- id,
- },
- })
-
- res.status(200).json({})
- } catch (err: any) {
- console.error(err)
- res.status(500).json({ statusCode: 500, message: err.message })
- }
-}
-
-async function handler(
- req: NextApiRequest,
- res: NextApiResponse,
-) {
- if (req.method === 'DELETE') {
- await deleteProject(req, res)
- return
- }
-
- res.setHeader('Allow', ['DELETE'])
- res.status(405).json({ statusCode: 405, message: 'Method Not Allowed' })
- return
-}
-
-export default handler
diff --git a/pages/sign.tsx b/pages/sign.tsx
index 696cd2878..9d388f1ec 100644
--- a/pages/sign.tsx
+++ b/pages/sign.tsx
@@ -17,6 +17,9 @@ function SignIn() {
useEffect(() => {
if (user) {
router.push('/')
+
+
+
}
}, [user, router])
@@ -35,13 +38,13 @@ function SignIn() {
}
return (
- <div className="flex min-h-full flex-1 flex-col justify-center px-6 py-12 lg:px-8">
+ <div className="flex min-h-full flex-1 flex-col justify-center px-6 py-12 lg:px-8 items-center space-y-5">
<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">
+ <div className="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}