diff --git a/frontend/src/components/message/MessageSkeleton.tsx b/frontend/src/components/message/MessageSkeleton.tsx new file mode 100644 index 00000000..170a3375 --- /dev/null +++ b/frontend/src/components/message/MessageSkeleton.tsx @@ -0,0 +1,103 @@ + + +export function MessageSkeleton() { + return ( +
+ {/* User message skeleton */} +
+
+
+
+
+
+
+
+
+
+
+
+ + {/* Assistant message skeleton */} +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + {/* Assistant message skeleton */} +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + {/* Second user message skeleton */} +
+
+
+
+
+
+
+
+
+
+
+ + {/* Loading assistant message */} +
+
+
+
+
+
+ ● +
+
+
+
+ ▋ +
+
+
+
+
+ ); +} + diff --git a/frontend/src/pages/SessionDetail.tsx b/frontend/src/pages/SessionDetail.tsx index f1aa265b..cd5e8bf3 100644 --- a/frontend/src/pages/SessionDetail.tsx +++ b/frontend/src/pages/SessionDetail.tsx @@ -19,7 +19,7 @@ import { useSettingsDialog } from "@/hooks/useSettingsDialog"; import { usePermissionRequests } from "@/hooks/usePermissionRequests"; import { useAutoScroll } from "@/hooks/useAutoScroll"; import { useEffect, useRef, useCallback } from "react"; -import { Loader2 } from "lucide-react"; +import { MessageSkeleton } from "@/components/message/MessageSkeleton"; import type { PermissionResponse } from "@/api/types"; export function SessionDetail() { @@ -47,7 +47,7 @@ export function SessionDetail() { const repoDirectory = repo?.fullPath; - const { data: messages } = useMessages(opcodeUrl, sessionId, repoDirectory); + const { data: messages, isLoading: messagesLoading } = useMessages(opcodeUrl, sessionId, repoDirectory); const { scrollToBottom } = useAutoScroll({ containerRef: messageContainerRef, @@ -131,37 +131,33 @@ export function SessionDetail() { await openCodeClient.respondToPermission(permissionSessionID, permissionID, response) }, [openCodeClient]); - if (repoLoading || sessionLoading) { + + + if (!sessionId) { return ( -
- +
+ Session not found
); } - if (!repo || !sessionId) { + if (!repo) { return ( -
- Session not found +
+
+
+ Loading repository... +
); } - - if (!session) { - return ( -
- Session not found -
- ); - } - - + return (
- {opcodeUrl && repoDirectory && ( + {repoLoading || sessionLoading || messagesLoading ? ( + + ) : opcodeUrl && repoDirectory ? ( - )} + ) : null}
{opcodeUrl && repoDirectory && (
diff --git a/shared/src/schemas/opencode.ts b/shared/src/schemas/opencode.ts index 94c8fe08..35b96782 100644 --- a/shared/src/schemas/opencode.ts +++ b/shared/src/schemas/opencode.ts @@ -44,6 +44,4 @@ export const MessageSchema = z.object({ }), }) -export type FileDiff = z.infer -export type Session = z.infer -export type Message = z.infer \ No newline at end of file +export type FileDiff = z.infer \ No newline at end of file