Skip to content

armgit / E2B

Public Imported from GitHub
0

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

team + saving progress

ErikKaumk18e9cbba85b2
diff --git a/apps/docs/src/app/(main)/dashboard/page.tsx b/apps/docs/src/app/(main)/dashboard/page.tsx
index 0f19dd1e5..794910fcc 100644
--- a/apps/docs/src/app/(main)/dashboard/page.tsx
+++ b/apps/docs/src/app/(main)/dashboard/page.tsx
@@ -6,6 +6,7 @@ import { ChevronRight, CreditCard, LayoutPanelTop, LucideIcon, Package, PlusCirc
import { GeneralContent } from '@/components/Dashboard/General'
import { BillingContent } from '@/components/Dashboard/Billing'
import { SandboxesContent } from '@/components/Dashboard/Sandboxes'
+import { TeamContent } from '@/components/Dashboard/Team'
import {
DropdownMenu,
@@ -16,7 +17,7 @@ import {
} from '@/components/ui/dropdown-menu'
-const menuLabels = ['General', 'Billing', 'Sandboxes', 'People', 'Templates'] as const
+const menuLabels = ['General', 'Billing', 'Sandboxes', 'Team', 'Templates'] as const
type MenuLabel = typeof menuLabels[number]
export default function Dashboard() {
@@ -59,9 +60,9 @@ const Sidebar = ({ selectedItem, setSelectedItem }) => (
/>
<MenuItem
icon={Users}
- label="People"
- selected={selectedItem === 'People'}
- onClick={() => setSelectedItem('People')}
+ label="Team"
+ selected={selectedItem === 'Team'}
+ onClick={() => setSelectedItem('Team')}
/>
<MenuItem
icon={LayoutPanelTop}
@@ -111,7 +112,7 @@ const AccountSelectItem = () => {
)
}
-const MainContent = ({ selectedItem }) => {
+const MainContent = ({ selectedItem }: { selectedItem: MenuLabel }) => {
switch (selectedItem) {
case 'General':
return <GeneralContent />
@@ -119,8 +120,8 @@ const MainContent = ({ selectedItem }) => {
return <BillingContent />
case 'Sandboxes':
return <SandboxesContent />
- case 'People':
- return <PeopleContent />
+ case 'Team':
+ return <TeamContent />
case 'Templates':
return <TemplatesContent />
default:
@@ -128,7 +129,6 @@ const MainContent = ({ selectedItem }) => {
}
}
-const PeopleContent = () => <div>People Content</div>
const TemplatesContent = () => <div>Templates Content</div>
const ErrorContent = () => <div>Error Content</div>
diff --git a/apps/docs/src/components/Dashboard/General.tsx b/apps/docs/src/components/Dashboard/General.tsx
index 8ff8b78b9..cf225f082 100644
--- a/apps/docs/src/components/Dashboard/General.tsx
+++ b/apps/docs/src/components/Dashboard/General.tsx
@@ -2,7 +2,7 @@
import { useState } from 'react'
import { useToast } from '../ui/use-toast'
-import uuidv4 from 'uuid'
+import { v4 as uuidv4 } from 'uuid'
import { Copy, Delete } from 'lucide-react'
import { Button } from '../Button'
diff --git a/apps/docs/src/components/Dashboard/Team.tsx b/apps/docs/src/components/Dashboard/Team.tsx
new file mode 100644
index 000000000..39624d1ee
--- /dev/null
+++ b/apps/docs/src/components/Dashboard/Team.tsx
@@ -0,0 +1,111 @@
+'use client'
+
+import {
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+} from '@/components/ui/table'
+
+import {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogTitle,
+ AlertDialogTrigger,
+} from '@/components/ui/alert-dialog'
+
+import { useState } from 'react'
+import { Delete } from 'lucide-react'
+import { Button } from '../Button'
+
+const fakeTeam = {
+ id: '1',
+ name: 'Default Team',
+ users: [{ id: '1', name: 'User1', role: 'admin' }, { id: '2', name: 'User2', role: 'user' }]
+}
+
+export const TeamContent = () => {
+ const [isDialogOpen, setIsDialogOpen] = useState(false)
+ const [currentKeyId, setCurrentUserId] = useState<string | null>(null)
+ const [team, setTeam] = useState(fakeTeam)
+
+ const closeDialog = () => setIsDialogOpen(false)
+ const openDialog = (id: string) => {
+ setCurrentUserId(id)
+ setIsDialogOpen(true)
+ }
+
+ const deleteUserFromTeam = () => {
+ // setApiKeys(apiKeys.filter(apiKey => apiKey.id !== currentKeyId))
+ closeDialog()
+ }
+
+ return (
+ <div className='flex flex-col justify-center'>
+ <h2 className="text-xl font-bold pb-4">Team name</h2>
+ <div className='flex items-center space-x-2 pb-10'>
+ <input
+ type="text"
+ className="w-1/3 border border-white/10 text-sm focus:outline-none outline-none rounded-md p-2"
+ placeholder={team.name}
+ value={team.name}
+ onChange={(e) => setTeam({ ...team, name: e.target.value })}
+ />
+ <Button variant='outline'>Save changes</Button>
+ </div>
+
+ <h2 className="text-xl font-bold pb-4">Team members</h2>
+ <Table>
+ <TableHeader>
+ <TableRow className='hover:bg-orange-500/10 dark:hover:bg-orange-500/10 border-b border-white/5 '>
+ <TableHead>Name</TableHead>
+ <TableHead>Role</TableHead>
+ <TableHead></TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {team.users.map((user) => (
+ <TableRow
+ className='hover:bg-orange-300/10 dark:hover:bg-orange-300/10 border-b border-white/5'
+ key={user.id}>
+ <TableCell>{user.name}</TableCell>
+ <TableCell>{user.role}</TableCell>
+ <TableCell>
+ <Delete className='hover:cursor-pointer' color='red' width={20} height={20} onClick={() => openDialog(user.id)} />
+ </TableCell>
+ </TableRow>
+ ))}
+ </TableBody>
+ </Table>
+
+ <h2 className="text-xl font-bold pt-10 pb-4">Invite new members</h2>
+
+ <AlertDialog open={isDialogOpen} onOpenChange={setIsDialogOpen}>
+ <AlertDialogTrigger asChild>
+ <Button variant="outline" style={{ display: 'none' }}>Show Dialog</Button>
+ </AlertDialogTrigger>
+ <AlertDialogContent className="bg-inherit text-white border-black">
+ <AlertDialogHeader>
+ <AlertDialogTitle>You are about to delete a member from the team</AlertDialogTitle>
+ <AlertDialogDescription className='text-white/90'>
+ This action cannot be undone. This will permanently delete the
+ member from the team.
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ <AlertDialogCancel className='border-white/10' onClick={closeDialog}>Cancel</AlertDialogCancel>
+ <AlertDialogAction className='bg-red-500 text-white hover:bg-red-600' onClick={deleteUserFromTeam}>Continue</AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
+
+ </div>
+ )
+}
\ No newline at end of file
diff --git a/supabase/seed.sql b/supabase/seed.sql
index 53302307f..81d49c4d6 100644
--- a/supabase/seed.sql
+++ b/supabase/seed.sql
@@ -4,11 +4,11 @@
INSERT INTO auth.users (instance_id, id, aud, role, email, encrypted_password, email_confirmed_at, invited_at, confirmation_token, confirmation_sent_at, recovery_token, recovery_sent_at, email_change_token_new, email_change, email_change_sent_at, last_sign_in_at, raw_app_meta_data, raw_user_meta_data, is_super_admin, created_at, updated_at, phone, phone_confirmed_at, phone_change, phone_change_token, phone_change_sent_at, email_change_token_current, email_change_confirm_status, banned_until, reauthentication_token, reauthentication_sent_at)
VALUES
- ('00000000-0000-0000-0000-000000000000', '5899f99d-a449-4bfa-8769-19c097aaf1f5', 'authenticated', 'authenticated', '[email protected]', '$2a$12$1f9CpolPKQUmH7.wyiq3deC9NdXd6AqpiMSOdmVYT4XbW4VxrfMK6', '2022-10-04 03:41:27.39308+00', NULL, '', NULL, '', NULL, '', '', NULL, NULL, '{"provider": "email", "providers": ["email"]}', '{}', NULL, '2022-10-04 03:41:27.391146+00', '2022-10-04 03:41:27.39308+00', NULL, NULL, '', '', NULL, '', 0, NULL, '', NULL);
+ ('00000000-0000-0000-0000-000000000000', '5899f99d-a449-4bfa-8769-19c097aaf1f5', 'authenticated', 'authenticated', '[email protected]', '$2a$10$yLZXHGHl7mgJ.Ax3cBhQ6uJ77CBuqTkt3EnF2hj26KAgMuBPUWekS', '2022-10-04 03:41:27.39308+00', NULL, '', NULL, '', NULL, '', '', NULL, NULL, '{"provider": "email", "providers": ["email"]}', '{}', NULL, '2022-10-04 03:41:27.391146+00', '2022-10-04 03:41:27.39308+00', NULL, NULL, '', '', NULL, '', 0, NULL, '', NULL);
-INSERT INTO auth.identities (id, user_id, identity_data, provider, provider_id, last_sign_in_at, created_at, updated_at)
+INSERT INTO auth.identities (id,user_id,identity_data,provider,last_sign_in_at,created_at,updated_at)
VALUES
- ('5899f99d-a449-4bfa-8769-19c097aaf1f5', '5899f99d-a449-4bfa-8769-19c097aaf1f5'::uuid, '{"sub": "5899f99d-a449-4bfa-8769-19c097aaf1f5"}', 'email', 'email_provider_id', '2022-10-04 04:45:00.000+00', '2022-10-04 03:41:27.391146+00', '2022-10-04 03:41:27.39308+00');
+ ('5899f99d-a449-4bfa-8769-19c097aaf1f5', '5899f99d-a449-4bfa-8769-19c097aaf1f5'::uuid, '{"sub": "5899f99d-a449-4bfa-8769-19c097aaf1f5"}', 'email', '2022-10-04 04:45:00.000+00', '2022-10-04 03:41:27.391146+00', '2022-10-04 03:41:27.39308+00');
INSERT INTO "public"."teams" (id, created_at, name, is_default)
VALUES ('21d2e330-95fa-4b78-b677-47d0713de3da', NOW(), '[email protected]', true);