import React, { useEffect, useRef } from 'react'; import { useChat } from '../../hooks/useChat'; import MessageBubble from './MessageBubble'; import MessageInput from './MessageInput'; import StepSequencePanel from './StepSequencePanel'; import './ChatWindow.css'; /** * ChatWindow — main chat container. * * - Full-height layout with scrollable message list above input * - Auto-scrolls to the latest message * - Shows "PC Pal is typing..." indicator */ function ChatWindow({ userId }) { const { messages, sendMessage, isConnected, isTyping, activeSequence } = useChat(userId); const bottomRef = useRef(null); // Auto-scroll to the newest message useEffect(() => { if (bottomRef.current) { bottomRef.current.scrollIntoView({ behavior: 'smooth' }); } }, [messages, isTyping]); return (
Hello! I'm PC Pal, your friendly tech helper.
Ask me anything about your computer!