From 7322b0ff41a7b2bec9c9f90e6c581d258bb7debc Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 20 Dec 2025 14:43:19 -0600 Subject: [PATCH] Move refresh button into browser address bar, move fullscreen to the left --- src/components/Shakespeare/PreviewPane.tsx | 64 ++++--------- .../ui/browser-address-bar.test.tsx | 89 ++++++++----------- src/components/ui/browser-address-bar.tsx | 67 +++++--------- 3 files changed, 74 insertions(+), 146 deletions(-) diff --git a/src/components/Shakespeare/PreviewPane.tsx b/src/components/Shakespeare/PreviewPane.tsx index 21bba287..2d832269 100644 --- a/src/components/Shakespeare/PreviewPane.tsx +++ b/src/components/Shakespeare/PreviewPane.tsx @@ -293,34 +293,6 @@ export function PreviewPane({ projectId, activeTab, onToggleView, projectName, o sendNavigationCommand('refresh'); }, [sendNavigationCommand]); - const goBackIframe = useCallback(() => { - if (historyIndex > 0) { - // Move back in history - const newIndex = historyIndex - 1; - const targetPath = navigationHistory[newIndex]; - - setHistoryIndex(newIndex); - setCurrentPath(targetPath); - - // Tell iframe to navigate to this path - sendNavigationCommand('navigate', { url: targetPath }); - } - }, [historyIndex, navigationHistory, sendNavigationCommand]); - - const goForwardIframe = useCallback(() => { - if (historyIndex < navigationHistory.length - 1) { - // Move forward in history - const newIndex = historyIndex + 1; - const targetPath = navigationHistory[newIndex]; - - setHistoryIndex(newIndex); - setCurrentPath(targetPath); - - // Tell iframe to navigate to this path - sendNavigationCommand('navigate', { url: targetPath }); - } - }, [historyIndex, navigationHistory, sendNavigationCommand]); - const toggleFullscreen = useCallback(() => { setIsFullscreen(prev => !prev); }, []); @@ -680,8 +652,8 @@ export function PreviewPane({ projectId, activeTab, onToggleView, projectName, o {isPreviewable && ( -
0} - canGoForward={hasBuiltProject && historyIndex < navigationHistory.length - 1} + leftContent={( + + )} 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 */}