From 7478be317ce0f059766e7d6283b01df1334cf43c Mon Sep 17 00:00:00 2001 From: lemonknowsall Date: Fri, 19 Dec 2025 20:12:33 -0800 Subject: [PATCH 1/7] add full-screen preview mode --- src/components/Shakespeare/PreviewPane.tsx | 33 +++++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/src/components/Shakespeare/PreviewPane.tsx b/src/components/Shakespeare/PreviewPane.tsx index f9a434ad..21bba287 100644 --- a/src/components/Shakespeare/PreviewPane.tsx +++ b/src/components/Shakespeare/PreviewPane.tsx @@ -10,7 +10,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, Rocket, X, Terminal } from 'lucide-react'; +import { FolderOpen, ArrowLeft, Bug, Copy, Check, Play, Loader2, MenuIcon, Code, Rocket, X, Terminal, Maximize, Minimize } from 'lucide-react'; import { useIsMobile } from '@/hooks/useIsMobile'; import { GitStatusIndicator } from '@/components/GitStatusIndicator'; import { BrowserAddressBar } from '@/components/ui/browser-address-bar'; @@ -89,6 +89,8 @@ export function PreviewPane({ projectId, activeTab, onToggleView, projectName, o const [historyIndex, setHistoryIndex] = useState(0); const [deployDialogOpen, setDeployDialogOpen] = useState(false); + const [isFullscreen, setIsFullscreen] = useState(false); + const previewContainerRef = useRef(null); const iframeRef = useRef(null); const { fs } = useFS(); const { projectsPath } = useFSPaths(); @@ -319,6 +321,10 @@ export function PreviewPane({ projectId, activeTab, onToggleView, projectName, o } }, [historyIndex, navigationHistory, sendNavigationCommand]); + const toggleFullscreen = useCallback(() => { + setIsFullscreen(prev => !prev); + }, []); + const handleFetch = useCallback(async (request: JSONRPCRequest) => { const { params, id } = request; const { request: fetchRequest } = params; @@ -563,7 +569,7 @@ export function PreviewPane({ projectId, activeTab, onToggleView, projectName, o @@ -643,7 +649,7 @@ export function PreviewPane({ projectId, activeTab, onToggleView, projectName, o Open menu - + {isPreviewable && ( -
+
{/* Always show browser address bar */}
+ {(!isMobile && onToggleView && isPreviewable) && ( + )} extraContent={(
- {(!isMobile && onToggleView && isPreviewable) && ( } + /> + ); + + expect(screen.getByTestId('left-button')).toBeInTheDocument(); + }); + + it('renders extraContent when provided', () => { + render( + Extra} + /> + ); + + expect(screen.getByTestId('extra-button')).toBeInTheDocument(); + }); }); \ No newline at end of file diff --git a/src/components/ui/browser-address-bar.tsx b/src/components/ui/browser-address-bar.tsx index 64b207a9..2b8b10dc 100644 --- a/src/components/ui/browser-address-bar.tsx +++ b/src/components/ui/browser-address-bar.tsx @@ -1,7 +1,7 @@ import { useState, useEffect } from 'react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; -import { ChevronLeft, ChevronRight, RefreshCw } from 'lucide-react'; +import { RefreshCw } from 'lucide-react'; import { cn } from '@/lib/utils'; import { ReactNode } from 'react'; @@ -9,24 +9,18 @@ interface BrowserAddressBarProps { currentPath?: string; onNavigate?: (path: string) => void; onRefresh?: () => void; - onBack?: () => void; - onForward?: () => void; - canGoBack?: boolean; - canGoForward?: boolean; className?: string; extraContent?: ReactNode; + leftContent?: ReactNode; } export function BrowserAddressBar({ currentPath = '/', onNavigate, onRefresh, - onBack, - onForward, - canGoBack = false, - canGoForward = false, className, extraContent, + leftContent, }: BrowserAddressBarProps) { const [inputValue, setInputValue] = useState(currentPath); @@ -55,53 +49,34 @@ export function BrowserAddressBar({ return (
- {/* Navigation buttons */} -
- - - -
+ {/* Left content (e.g., maximize button) */} + {leftContent} - {/* Address bar */} -
+ {/* Address bar with refresh button inside */} + + {onRefresh && ( + + )}
{/* Extra content */} From b74259f5f7534b1679b79084627b1f43f15ddb56 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 20 Dec 2025 15:55:48 -0600 Subject: [PATCH 3/7] Browser input style improvements --- src/components/ui/browser-address-bar.tsx | 8 ++++---- src/components/ui/button-variants.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/ui/browser-address-bar.tsx b/src/components/ui/browser-address-bar.tsx index 2b8b10dc..fd2141b6 100644 --- a/src/components/ui/browser-address-bar.tsx +++ b/src/components/ui/browser-address-bar.tsx @@ -56,13 +56,13 @@ export function BrowserAddressBar({ {leftContent} {/* Address bar with refresh button inside */} -
+ {onRefresh && ( @@ -71,10 +71,10 @@ export function BrowserAddressBar({ variant="ghost" size="sm" onClick={onRefresh} - className="h-6 w-6 p-0 absolute right-5 top-1/2 -translate-y-1/2 hover:bg-transparent" + className="size-6 absolute right-7 top-1/2 -translate-y-1/2 hover:bg-muted/50 rounded-full transition-colors group" title="Refresh" > - + )} diff --git a/src/components/ui/button-variants.ts b/src/components/ui/button-variants.ts index 102facd2..0cd815e6 100644 --- a/src/components/ui/button-variants.ts +++ b/src/components/ui/button-variants.ts @@ -1,7 +1,7 @@ import { cva } from "class-variance-authority" export const buttonVariants = cva( - "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", + "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", { variants: { variant: { From 45038c9b9633ab9665aac293332860b16d3133d9 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 20 Dec 2025 16:24:23 -0600 Subject: [PATCH 4/7] Allow easy navigating in address bar --- src/components/Shakespeare/PreviewPane.tsx | 1 + .../ui/browser-address-bar.test.tsx | 76 +++++++++++++ src/components/ui/browser-address-bar.tsx | 107 ++++++++++++++---- 3 files changed, 162 insertions(+), 22 deletions(-) diff --git a/src/components/Shakespeare/PreviewPane.tsx b/src/components/Shakespeare/PreviewPane.tsx index 2d832269..d3db507c 100644 --- a/src/components/Shakespeare/PreviewPane.tsx +++ b/src/components/Shakespeare/PreviewPane.tsx @@ -665,6 +665,7 @@ export function PreviewPane({ projectId, activeTab, onToggleView, projectName, o currentPath={currentPath} onNavigate={hasBuiltProject ? navigateIframe : undefined} onRefresh={hasBuiltProject ? refreshIframe : undefined} + navigationHistory={navigationHistory} leftContent={( - )} +
+
+ + {onRefresh && ( + + )} + + {/* Navigation history dropdown */} + {showHistory && uniqueHistory.length > 0 && ( +
+ {uniqueHistory.map((path, index) => ( + + ))} +
+ )} +
{/* Extra content */} From 6cccf6e2d96a94b92ccc18e9ae661d7010c65e3a Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 20 Dec 2025 16:38:51 -0600 Subject: [PATCH 5/7] Highlight the active navigation --- src/components/ui/browser-address-bar.tsx | 27 ++++++++++++++--------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/components/ui/browser-address-bar.tsx b/src/components/ui/browser-address-bar.tsx index 1f4ef784..809a3bfd 100644 --- a/src/components/ui/browser-address-bar.tsx +++ b/src/components/ui/browser-address-bar.tsx @@ -1,7 +1,7 @@ -import { useState, useEffect, useRef } from 'react'; +import { useState, useEffect, useRef, useMemo } from 'react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; -import { RefreshCw } from 'lucide-react'; +import { CheckIcon, RefreshCw } from 'lucide-react'; import { cn } from '@/lib/utils'; import { ReactNode } from 'react'; @@ -37,12 +37,11 @@ export function BrowserAddressBar({ // Close dropdown when clicking outside useEffect(() => { const handleClickOutside = (event: MouseEvent) => { - if ( - dropdownRef.current && - !dropdownRef.current.contains(event.target as Node) && - inputRef.current && - !inputRef.current.contains(event.target as Node) - ) { + const target = event.target as Node | null; + const dropdownElement = dropdownRef.current; + const inputElement = inputRef.current; + + if (target && !dropdownElement?.contains(target) && !inputElement?.contains(target)) { setShowHistory(false); } }; @@ -85,7 +84,7 @@ export function BrowserAddressBar({ }; // Get unique history items (reverse to show most recent first, remove duplicates) - const uniqueHistory = Array.from(new Set([...navigationHistory].reverse())); + const uniqueHistory = useMemo(() => Array.from(new Set([...navigationHistory].reverse())), [navigationHistory]); return (
handleHistoryItemClick(path)} - className="w-full p-3 text-left text-xs hover:bg-muted/50 transition-colors flex items-center gap-2 border-b last:border-b-0" + className={cn( + "w-full p-3 text-left text-xs hover:bg-muted/50 transition-colors flex items-center gap-2 border-b last:border-b-0", + { + "bg-muted/30 font-medium": path === currentPath, + }, + )} > {path} + {path === currentPath && ( + + )} ))}
From e012c74b418e9fc73acb84d3fd90eb88e08d25ba Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 20 Dec 2025 16:42:15 -0600 Subject: [PATCH 6/7] Change preview fullscreen icon --- src/components/Shakespeare/PreviewPane.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Shakespeare/PreviewPane.tsx b/src/components/Shakespeare/PreviewPane.tsx index d3db507c..ee669899 100644 --- a/src/components/Shakespeare/PreviewPane.tsx +++ b/src/components/Shakespeare/PreviewPane.tsx @@ -10,7 +10,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, Rocket, X, Terminal, Maximize, Minimize } from 'lucide-react'; +import { FolderOpen, ArrowLeft, Bug, Copy, Check, Play, Loader2, MenuIcon, Code, Rocket, X, Terminal, Expand, Shrink } from 'lucide-react'; import { useIsMobile } from '@/hooks/useIsMobile'; import { GitStatusIndicator } from '@/components/GitStatusIndicator'; import { BrowserAddressBar } from '@/components/ui/browser-address-bar'; @@ -675,9 +675,9 @@ export function PreviewPane({ projectId, activeTab, onToggleView, projectName, o title={isFullscreen ? 'Exit immersive view' : 'Enter immersive view'} > {isFullscreen ? ( - + ) : ( - + )} )} From 7b9310c6acad9817813c40b96bcdfb15e150090c Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 20 Dec 2025 16:47:14 -0600 Subject: [PATCH 7/7] Shrink default chat area a tad --- src/pages/ProjectView.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/ProjectView.tsx b/src/pages/ProjectView.tsx index 3abc4939..142e8330 100644 --- a/src/pages/ProjectView.tsx +++ b/src/pages/ProjectView.tsx @@ -335,7 +335,7 @@ export function ProjectView() {
{/* Chat Panel */} - +
{/* Chat Header */}
@@ -429,7 +429,7 @@ export function ProjectView() { {/* Preview/Code Panel */} - +
{project ? (