"use client" import { useState } from "react" import { Send, MessageCircle } from "lucide-react" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Overlay } from "./overlay-system/overlay" export function ChatOverlay() { const [message, setMessage] = useState("") const [chatHistory, setChatHistory] = useState([{ role: "bot", content: "Hi! How can I help you today?" }]) const handleSendMessage = () => { if (!message.trim()) return // Add user message to chat setChatHistory([...chatHistory, { role: "user", content: message }]) // Simulate bot response (in a real app, this would call an API) setTimeout(() => { setChatHistory((prev) => [ ...prev, { role: "bot", content: "I can provide information about this area. What would you like to know?", }, ]) }, 1000) setMessage("") } return ( } initialPosition="bottom-right" initialIsOpen={false} width="400px" >
{chatHistory.map((chat, index) => (
{chat.content}
))}
setMessage(e.target.value)} placeholder="Type your message..." className="flex-1" onKeyDown={(e) => { if (e.key === "Enter") { handleSendMessage() } }} />
) }