From 458eec0e27242caafc7a61c4c416c07691881532 Mon Sep 17 00:00:00 2001 From: Chad Curtis Date: Wed, 24 Sep 2025 16:09:25 +0000 Subject: [PATCH] Iniitial console output redesign v2 --- src/components/Shakespeare/PreviewPane.tsx | 64 ++++++++++++++++------ 1 file changed, 46 insertions(+), 18 deletions(-) diff --git a/src/components/Shakespeare/PreviewPane.tsx b/src/components/Shakespeare/PreviewPane.tsx index 03fede3f..53ebbf09 100644 --- a/src/components/Shakespeare/PreviewPane.tsx +++ b/src/components/Shakespeare/PreviewPane.tsx @@ -7,7 +7,7 @@ import { useBuildProject } from '@/hooks/useBuildProject'; import { Tabs, TabsContent } from '@/components/ui/tabs'; import { ScrollArea, ScrollBar } from '@/components/ui/scroll-area'; import { Button } from '@/components/ui/button'; -import { FolderOpen, ArrowLeft, Bug, Copy, Check, Play, Loader2, MenuIcon, Code, CloudUpload } from 'lucide-react'; +import { FolderOpen, ArrowLeft, Bug, Copy, Check, Play, Loader2, MenuIcon, Code, CloudUpload, Trash2, Download, X } from 'lucide-react'; import { useIsMobile } from '@/hooks/useIsMobile'; import { GitStatusIndicator } from '@/components/GitStatusIndicator'; import { BrowserAddressBar } from '@/components/ui/browser-address-bar'; @@ -16,7 +16,13 @@ import { DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, + DropdownMenuSeparator, } from '@/components/ui/dropdown-menu'; +import { + Popover, + PopoverContent, + PopoverTrigger, +} from '@/components/ui/popover'; import { cn } from '@/lib/utils'; import { ConsoleMessage } from '@/types/console'; @@ -91,7 +97,7 @@ export function PreviewPane({ projectId, activeTab, config = {} }: PreviewPanePr const [currentPath, setCurrentPath] = useState('/'); const [navigationHistory, setNavigationHistory] = useState(['/']); const [historyIndex, setHistoryIndex] = useState(0); - const [copiedMessageId, setCopiedMessageId] = useState(null); + const [deployDialogOpen, setDeployDialogOpen] = useState(false); // Use external state if provided, otherwise use internal state @@ -429,26 +435,36 @@ export function PreviewPane({ projectId, activeTab, config = {} }: PreviewPanePr }; const ConsoleDropdown = () => { + const [isOpen, setIsOpen] = useState(false); + const copiedMessageRef = useRef(null); + const [_, setCopyUpdate] = useState(0); + const copyMessageToClipboard = async (msg: ConsoleMessage) => { try { await navigator.clipboard.writeText(msg.message); - setCopiedMessageId(msg.id); + copiedMessageRef.current = msg.id; + setCopyUpdate(prev => prev + 1); // Reset the copied state after 2 seconds setTimeout(() => { - setCopiedMessageId(null); + copiedMessageRef.current = null; + setCopyUpdate(prev => prev + 1); }, 2000); } catch (error) { console.error('Failed to copy message to clipboard:', error); } }; + const closePanel = () => { + setIsOpen(false); + }; + const hasErrors = consoleMessages.some(msg => msg.level === 'error'); const messageCount = consoleMessages.length; return ( - - + + - - + + {/* Messages */} - -
+
+
{messageCount === 0 ? (
-

No console messages

Messages from your project will appear here

@@ -478,7 +494,11 @@ export function PreviewPane({ projectId, activeTab, config = {} }: PreviewPanePr consoleMessages.map((msg) => (
{ + e.stopPropagation(); + copyMessageToClipboard(msg); + }} >
- {copiedMessageId === msg.id ? ( + {copiedMessageRef.current === msg.id ? ( ) : ( @@ -509,9 +529,17 @@ export function PreviewPane({ projectId, activeTab, config = {} }: PreviewPanePr )) )}
- - - +
+ + {/* Close button */} + + + ); };