diff --git a/frontend/src/components/ChatArea.tsx b/frontend/src/components/ChatArea.tsx index 48a1c32..605e2b9 100644 --- a/frontend/src/components/ChatArea.tsx +++ b/frontend/src/components/ChatArea.tsx @@ -89,6 +89,24 @@ export default function ChatArea({ const messagesEndRef = useRef(null); const previousMessageCountRef = useRef(0); + const hasMessages = messages.length > 0; + const [welcomeRendered, setWelcomeRendered] = useState(!hasMessages); + const [welcomeVisible, setWelcomeVisible] = useState(!hasMessages); + + useEffect(() => { + if (!hasMessages) { + setWelcomeRendered(true); + setWelcomeVisible(true); + return; + } + + if (!welcomeVisible) return; + + setWelcomeVisible(false); + const timer = window.setTimeout(() => setWelcomeRendered(false), 350); + return () => window.clearTimeout(timer); + }, [hasMessages, welcomeVisible]); + const handleSendMessage = async (query: string) => { await sendQuery(query); }; @@ -212,11 +230,18 @@ export default function ChatArea({ {/* Chat messages area */}
0 ? 'overflow-y-auto' : 'overflow-hidden'}`} + className={`relative flex-1 p-4 ${hasMessages ? 'overflow-y-auto' : 'overflow-hidden'}`} > - {messages.length === 0 ? ( - - ) : ( + {welcomeRendered && ( +
+ +
+ )} + {hasMessages && (
{messages.map((message, index) => { // Find if this is the first user message diff --git a/frontend/src/components/MessageBubble.tsx b/frontend/src/components/MessageBubble.tsx index 92adfdf..6c02944 100644 --- a/frontend/src/components/MessageBubble.tsx +++ b/frontend/src/components/MessageBubble.tsx @@ -125,7 +125,7 @@ export default function MessageBubble({ if (message.role === 'user') { return (
-
+

{message.content}

diff --git a/frontend/src/components/WelcomeScreen.tsx b/frontend/src/components/WelcomeScreen.tsx index ae4f00c..42ab005 100644 --- a/frontend/src/components/WelcomeScreen.tsx +++ b/frontend/src/components/WelcomeScreen.tsx @@ -1,3 +1,4 @@ +import { useState } from 'react'; import { exampleQuestions } from '../data/exampleQuestions'; import { welcomeScreenContent } from '../data/welcomeScreenContent'; @@ -5,7 +6,11 @@ interface WelcomeScreenProps { onQuestionSelect: (question: string) => void; } +const LIFT_DURATION_MS = 180; + export default function WelcomeScreen({ onQuestionSelect }: WelcomeScreenProps) { + const [liftedIndex, setLiftedIndex] = useState(null); + const featuredQuestions = welcomeScreenContent.featuredQuestionIds .map((id) => exampleQuestions.find((question) => question.id === id)?.question) .filter((question): question is string => Boolean(question)); @@ -15,6 +20,12 @@ export default function WelcomeScreen({ onQuestionSelect }: WelcomeScreenProps) return delays[index] || ''; }; + const handleQuestionClick = (question: string, index: number) => { + if (liftedIndex !== null) return; + setLiftedIndex(index); + window.setTimeout(() => onQuestionSelect(question), LIFT_DURATION_MS); + }; + return (
@@ -33,8 +44,11 @@ export default function WelcomeScreen({ onQuestionSelect }: WelcomeScreenProps) {featuredQuestions.map((question, index) => (