import { useEffect, useRef } from 'react' import MessageBubble from './MessageBubble' import ThinkingIndicator from './ThinkingIndicator' export default function ChatPanel({ messages, isLoading, onReplay, character }) { const bottomRef = useRef(null) const name = character?.name || 'AI' const image = character?.image || null useEffect(() => { bottomRef.current?.scrollIntoView({ behavior: 'smooth' }) }, [messages, isLoading]) if (messages.length === 0 && !isLoading) { return (
{image ? ( {name} ) : (
{name[0]}
)}

Hi, I'm {name}

Type a message or press the mic to talk

) } return (
{messages.map((msg) => ( ))} {isLoading && }
) }