diff --git a/src/components/Shakespeare/ChatPane.tsx b/src/components/Shakespeare/ChatPane.tsx index 7b4ba44f..039ea930 100644 --- a/src/components/Shakespeare/ChatPane.tsx +++ b/src/components/Shakespeare/ChatPane.tsx @@ -288,6 +288,7 @@ export const ChatPane = forwardRef(({ messages, streamingMessage, isLoading: internalIsLoading, + isLoadingHistory, totalCost, lastInputTokens, addMessage, @@ -701,8 +702,53 @@ export const ChatPane = forwardRef(({ )} + {/* Loading skeleton while loading history */} + {isLoadingHistory && ( +
+ {/* User message skeleton */} +
+
+
+ + +
+
+
+ + {/* Assistant message skeleton */} +
+
+
+ + + +
+
+
+ + {/* Another user message skeleton */} +
+
+
+ +
+
+
+ + {/* Another assistant message skeleton */} +
+
+
+ + +
+
+
+
+ )} + {/* Empty state when no messages and not loading */} - {messages.length === 0 && !streamingMessage && !isLoading && ( + {!isLoadingHistory && messages.length === 0 && !streamingMessage && !isLoading && (
@@ -726,7 +772,7 @@ export const ChatPane = forwardRef(({
)} - {messages.map((message, index) => { + {!isLoadingHistory && messages.map((message, index) => { // Find the corresponding tool call for tool messages let toolCall: OpenAI.Chat.Completions.ChatCompletionMessageToolCall | undefined = undefined; if (message.role === 'tool') { @@ -749,7 +795,7 @@ export const ChatPane = forwardRef(({ ); })} - {renderStreamingMessage()} + {!isLoadingHistory && renderStreamingMessage()} {/* Error Alert (Console or AI) - Don't show while assistant is loading */} {displayError && !isLoading && ( diff --git a/src/components/Shakespeare/PreviewPane.tsx b/src/components/Shakespeare/PreviewPane.tsx index f84270af..49ed6ab7 100644 --- a/src/components/Shakespeare/PreviewPane.tsx +++ b/src/components/Shakespeare/PreviewPane.tsx @@ -526,6 +526,7 @@ export function PreviewPane({ projectId, activeTab, onToggleView, isPreviewable className="h-8 gap-2 relative" > + Logs {hasConsoleErrors && ( )} @@ -618,7 +619,7 @@ export function PreviewPane({ projectId, activeTab, onToggleView, isPreviewable size="sm" onClick={toggleFullscreen} className="h-8 w-8 p-0" - title={isFullscreen ? 'Exit immersive view' : 'Enter immersive view'} + title={isFullscreen ? 'Exit fullscreen' : 'Enter fullscreen'} > {isFullscreen ? ( @@ -661,6 +662,7 @@ export function PreviewPane({ projectId, activeTab, onToggleView, isPreviewable ) : ( )} + Build {(!isMobile && onToggleView && isPreviewable) && ( )} @@ -837,6 +840,7 @@ export function PreviewPane({ projectId, activeTab, onToggleView, isPreviewable className="gap-2 text-muted-foreground hover:text-foreground" > + Terminal
)} @@ -851,6 +855,7 @@ export function PreviewPane({ projectId, activeTab, onToggleView, isPreviewable className="gap-2 text-muted-foreground hover:text-foreground" > + Terminal
diff --git a/src/components/git-sync/steps/SyncStep.tsx b/src/components/git-sync/steps/SyncStep.tsx index 52b2fb48..b712cbdf 100644 --- a/src/components/git-sync/steps/SyncStep.tsx +++ b/src/components/git-sync/steps/SyncStep.tsx @@ -253,14 +253,6 @@ export function SyncStep({ projectId, remoteUrl }: SyncStepProps) {

{providerInfo?.name}

- +
diff --git a/src/components/ui/browser-address-bar.tsx b/src/components/ui/browser-address-bar.tsx index d7356951..ddb3fc9b 100644 --- a/src/components/ui/browser-address-bar.tsx +++ b/src/components/ui/browser-address-bar.tsx @@ -123,7 +123,7 @@ export function BrowserAddressBar({ variant="ghost" size="sm" onClick={onRefresh} - className="size-6 absolute right-1 top-1/2 -translate-y-1/2 hover:bg-muted/50 rounded-full transition-colors group" + className="size-6 absolute right-1 top-1/2 -translate-y-1/2 hover:bg-muted/50 rounded-full transition-colors group px-1.5" title="Refresh" > diff --git a/src/hooks/useAIChat.ts b/src/hooks/useAIChat.ts index 74ac1435..925b8317 100644 --- a/src/hooks/useAIChat.ts +++ b/src/hooks/useAIChat.ts @@ -43,16 +43,22 @@ export function useAIChat({ const [isLoading, setIsLoading] = useState(false); const [totalCost, setTotalCost] = useState(0); const [lastInputTokens, setLastInputTokens] = useState(0); + const [isLoadingHistory, setIsLoadingHistory] = useState(true); const initSession = useCallback(async () => { - // Load or update session - const session = await sessionManager.loadSession(projectId, tools, customTools, maxSteps); - // Initialize individual state variables from existing session - setMessages([...session.messages]); - setStreamingMessage(session.streamingMessage ? { ...session.streamingMessage } : undefined); - setIsLoading(session.isLoading); - setTotalCost(session.totalCost || 0); - setLastInputTokens(session.lastInputTokens || 0); + setIsLoadingHistory(true); + try { + // Load or update session + const session = await sessionManager.loadSession(projectId, tools, customTools, maxSteps); + // Initialize individual state variables from existing session + setMessages([...session.messages]); + setStreamingMessage(session.streamingMessage ? { ...session.streamingMessage } : undefined); + setIsLoading(session.isLoading); + setTotalCost(session.totalCost || 0); + setLastInputTokens(session.lastInputTokens || 0); + } finally { + setIsLoadingHistory(false); + } }, [sessionManager, projectId, tools, customTools, maxSteps]); // Initialize session @@ -166,6 +172,7 @@ export function useAIChat({ messages, streamingMessage, isLoading, + isLoadingHistory, totalCost, lastInputTokens, sendMessage, diff --git a/src/pages/ProjectView.tsx b/src/pages/ProjectView.tsx index bbba5077..9de1889d 100644 --- a/src/pages/ProjectView.tsx +++ b/src/pages/ProjectView.tsx @@ -40,6 +40,7 @@ import { useGitFetch } from '@/hooks/useGitFetch'; import { useQueryClient } from '@tanstack/react-query'; import JSZip from 'jszip'; import { cn } from '@/lib/utils'; +import { useProjectSessionStatus } from '@/hooks/useProjectSessionStatus'; export function ProjectView() { const { projectId } = useParams<{ projectId: string }>(); @@ -72,6 +73,7 @@ export function ProjectView() { const build = useBuildProject(projectId!); const { data: isPreviewable = false } = useIsProjectPreviewable(projectId!); + const { hasRunningSessions } = useProjectSessionStatus(projectId || ''); // Automatically fetch from remote to keep git status updated useGitFetch(projectId ? `${projectsPath}/${projectId}` : undefined); @@ -402,7 +404,11 @@ export function ProjectView() { className={cn("flex-1 rounded-none mobile-nav-button text-muted-foreground", { "text-foreground": mobileView === 'chat' })} disabled={!project} > - + {project && hasRunningSessions ? ( + + ) : ( + + )} {t('chat')} {isPreviewable && (