import { useRef, useEffect } from 'react'; interface Message { id: string; role: 'user' | 'kira'; text: string; timestamp: number; } interface Props { messages: Message[]; isKiraSpeaking: boolean; userName?: string; } export default function ChatBubble({ messages, isKiraSpeaking }: Props) { const bottomRef = useRef(null); useEffect(() => { bottomRef.current?.scrollIntoView({ behavior: 'smooth' }); }, [messages]); return (

💬 Conversation

{messages.length === 0 && (
click the mic or type to talk to Kira
)} {messages.map((msg, i) => { const isLastKira = msg.role === 'kira' && i === messages.length - 1 && isKiraSpeaking; return (
{msg.role === 'kira' && ( 🌸 )}
{msg.text} {isLastKira && ( )}
{msg.role === 'user' && ( 👤 )}
); })}
); }