import { useEffect, useRef } from 'react'; import { Message } from './Message'; import { useChatStore } from '../../store/chatStore'; import { MessageSquare } from 'lucide-react'; export function ChatMessages() { const { getActiveConversation } = useChatStore(); const messagesEndRef = useRef(null); const activeConversation = getActiveConversation(); // Auto-scroll to bottom when new messages arrive useEffect(() => { messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' }); }, [activeConversation?.messages]); if (!activeConversation) { return (

Welcome to ChatSaaS

Start a new conversation by typing a message below. Our AI assistant is here to help you with anything you need.

✨ Supports Markdown formatting

📊 Renders Mermaid diagrams

💻 Syntax highlighting for code

🎨 Multiple themes available

); } if (activeConversation.messages.length === 0) { return (

New Conversation

Send your first message to get started!

); } return (
{activeConversation.messages.map((message) => ( ))}
); }