From 1ee0bf36d3c774bcb7f52b858a380ecef34c199b Mon Sep 17 00:00:00 2001 From: Mish Ushakov Date: Fri, 29 Nov 2024 13:39:30 +0100 Subject: [PATCH 1/8] Template management in dashboard --- apps/web/package.json | 1 + .../src/components/Dashboard/Templates.tsx | 301 ++++++++++++-- apps/web/src/components/ui/tooltip.tsx | 30 ++ pnpm-lock.yaml | 386 ++++++++++++++++++ 4 files changed, 681 insertions(+), 37 deletions(-) create mode 100644 apps/web/src/components/ui/tooltip.tsx diff --git a/apps/web/package.json b/apps/web/package.json index 074d2bd73..f3bfb5314 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -27,6 +27,7 @@ "@radix-ui/react-popover": "^1.0.6", "@radix-ui/react-slot": "^1.0.2", "@radix-ui/react-toast": "^1.1.5", + "@radix-ui/react-tooltip": "^1.1.4", "@sentry/nextjs": "^8.18.0", "@sindresorhus/slugify": "^2.1.1", "@supabase/auth-helpers-nextjs": "^0.7.4", diff --git a/apps/web/src/components/Dashboard/Templates.tsx b/apps/web/src/components/Dashboard/Templates.tsx index 87d157a18..7a7d75106 100644 --- a/apps/web/src/components/Dashboard/Templates.tsx +++ b/apps/web/src/components/Dashboard/Templates.tsx @@ -10,6 +10,31 @@ import { import { useState } from 'react' import { useEffect } from 'react' import { E2BUser } from '@/utils/useUser' +import { Lock, LockOpen, MoreVertical, Trash } from 'lucide-react' +import { + DropdownMenu, + DropdownMenuItem, + DropdownMenuContent, + DropdownMenuTrigger, +} from '@/components/ui/dropdown-menu' +import { + AlertDialog, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, + AlertDialogAction, +} from '../ui/alert-dialog' +import { toast } from '../ui/use-toast' +import { Button } from '../ui/button' +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from '../ui/tooltip' interface Template { aliases: string[] @@ -18,6 +43,12 @@ interface Template { memoryMB: number public: boolean templateID: string + createdAt: string + updatedAt: string + createdBy: { + email: string + id: string + } | null } export function TemplatesContent({ @@ -28,43 +59,128 @@ export function TemplatesContent({ teamId: string }) { const [templates, setTemplates] = useState([]) + const [currentTemplate, setCurrentTemplate] = useState