From c76e1d1b915d9e95fbe9a468d238daa7e11a3518 Mon Sep 17 00:00:00 2001 From: Cole Goldsmith Date: Thu, 20 Nov 2025 12:31:04 -0600 Subject: [PATCH] animate chat dog on new chat and focus input --- .../chat/_components/assistant-message.tsx | 80 ++++++++++++++----- frontend/app/chat/page.tsx | 20 +++++ frontend/components/icons/dog-icon.tsx | 3 + 3 files changed, 85 insertions(+), 18 deletions(-) diff --git a/frontend/app/chat/_components/assistant-message.tsx b/frontend/app/chat/_components/assistant-message.tsx index 91626376..041ee1da 100644 --- a/frontend/app/chat/_components/assistant-message.tsx +++ b/frontend/app/chat/_components/assistant-message.tsx @@ -20,6 +20,7 @@ interface AssistantMessageProps { isInactive?: boolean; animate?: boolean; delay?: number; + isInitialGreeting?: boolean; } export function AssistantMessage({ @@ -35,6 +36,7 @@ export function AssistantMessage({ isInactive = false, animate = true, delay = 0.2, + isInitialGreeting = false, }: AssistantMessageProps) { return ( - + {/* Dog icon with bark animation when greeting */} + + + } actions={ @@ -76,20 +99,41 @@ export function AssistantMessage({ onToggle={onToggle} />
- ' - : 'Thinking' - : content - } - /> + {/* Slide animation for initial greeting */} + {isInitialGreeting ? ( + + + + ) : ( + ' + : 'Thinking' + : content + } + /> + )}
diff --git a/frontend/app/chat/page.tsx b/frontend/app/chat/page.tsx index efb54832..9594a0ea 100644 --- a/frontend/app/chat/page.tsx +++ b/frontend/app/chat/page.tsx @@ -293,6 +293,11 @@ function ChatPage() { setIsFilterHighlighted(false); setLoading(false); lastLoadedConversationRef.current = null; + + // Focus input after a short delay to ensure rendering is complete + setTimeout(() => { + chatInputRef.current?.focusInput(); + }, 100); }; const handleFocusInput = () => { @@ -480,6 +485,11 @@ function ChatPage() { ...prev, [conversationData.endpoint]: conversationData.response_id, })); + + // Focus input when loading a conversation + setTimeout(() => { + chatInputRef.current?.focusInput(); + }, 100); } }, [ conversationData, @@ -500,6 +510,11 @@ function ChatPage() { }, ]); lastLoadedConversationRef.current = null; + + // Focus input when starting a new conversation + setTimeout(() => { + chatInputRef.current?.focusInput(); + }, 100); } }, [placeholderConversation, currentConversationId]); @@ -1061,6 +1076,11 @@ function ChatPage() { onFork={(e) => handleForkConversation(index, e)} animate={false} isInactive={index < messages.length - 1} + isInitialGreeting={ + index === 0 && + messages.length === 1 && + message.content === "How can I assist?" + } /> ), diff --git a/frontend/components/icons/dog-icon.tsx b/frontend/components/icons/dog-icon.tsx index 08967af5..541561bb 100644 --- a/frontend/components/icons/dog-icon.tsx +++ b/frontend/components/icons/dog-icon.tsx @@ -44,6 +44,7 @@ const DogIcon = ({ disabled = false, stroke, ...props }: DogIconProps) => { fill={fillColor} {...props} > + Dog Icon { viewBox="0 0 105 77" fill="none" xmlns="http://www.w3.org/2000/svg" + {...props} > + Dog Icon