import { useEffect, useRef } from "react"; import { motion } from "motion/react"; import { Bot } from "lucide-react"; import type { Message } from "./types"; import MessageBubble from "./MessageBubble"; import maintivalogo from "@/assets/maintiva-logo.jpg"; const WELCOME_FEATURES = [ { emoji: "📊", title: "Data Analysis", desc: "Get actionable insights and root cause" }, { emoji: "🧠", title: "Knowledge Based", desc: "Handbook, SOP, Documents, or Databases" }, { emoji: "🎤", title: "Voice Mode", desc: "Ask questions using your voice" }, { emoji: "💬", title: "Natural language", desc: "Natural interaction" }, ]; interface ChatWindowProps { messages: Message[]; isLoading: boolean; streamingMsgId: string | null; userName?: string; } export default function ChatWindow({ messages, isLoading, streamingMsgId, userName }: ChatWindowProps) { const firstName = userName?.split(" ")[0] ?? ""; const bottomRef = useRef(null); useEffect(() => { bottomRef.current?.scrollIntoView({ behavior: "smooth" }); }, [messages, isLoading]); if (messages.length === 0 && !isLoading) { return (

{firstName ? `Hi, ${firstName}! 👋` : "Hello! 👋"}

Welcome to{" "} Maintiva Maintiva Agent {" "} Turn your data into fast, intelligent decisions. Instantly uncover root causes, spot hidden patterns, and resolve issues before they escalate.

{WELCOME_FEATURES.map((f) => (
{f.emoji} {f.title} {f.desc}
))}
); } return (
{/* Constrain message width on large/seminar screens */}
{messages.map((message) => ( ))}
); }