From ef572a873d728248f5d0c9094d4bfd13cfca149e Mon Sep 17 00:00:00 2001 From: kleap-admin Date: Fri, 16 Jan 2026 17:09:41 +0000 Subject: [PATCH] Update components/chatbot.tsx --- components/chatbot.tsx | 94 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 components/chatbot.tsx diff --git a/components/chatbot.tsx b/components/chatbot.tsx new file mode 100644 index 0000000..ad7285a --- /dev/null +++ b/components/chatbot.tsx @@ -0,0 +1,94 @@ +"use client"; +import { useState } from "react"; +import { Button } from "@/components/ui/button"; +import { Card } from "@/components/ui/card"; +import { MessageCircle, X, Send } from "lucide-react"; +import { motion, AnimatePresence } from "framer-motion"; + +export function Chatbot() { + const [isOpen, setIsOpen] = useState(false); + const [messages, setMessages] = useState([ + { role: "bot", text: "Hi! I'm the Apex Assistant. I'm powered by AI to help you while I'm out detailing cars. How can I help you today?" } + ]); + const [input, setInput] = useState(""); + + const handleSend = () => { + if (!input.trim()) return; + const newMessages = [...messages, { role: "user", text: input }]; + setMessages(newMessages); + setInput(""); + + // Simple automated responses + setTimeout(() => { + let response = "I'm not sure about that, but you can book a detail and I'll answer all your questions in person!"; + const lowerInput = input.toLowerCase(); + if (lowerInput.includes("price") || lowerInput.includes("cost")) response = "Our prices vary by car size: Full Interior starts at $80, Exterior Hand Wash at $40, and Full Detail at $110!"; + if (lowerInput.includes("where") || lowerInput.includes("location")) response = "I'm based in Cedar Rapids and I'm mobile—I come right to your driveway!"; + if (lowerInput.includes("equipment") || lowerInput.includes("tools")) response = "I use professional-grade pressure washers, steam cleaners, and industrial vacuums to get that better-than-pro finish."; + if (lowerInput.includes("who") || lowerInput.includes("old")) response = "I'm a 13-year-old entrepreneur saving up for my first car and college!"; + if (lowerInput.includes("book") || lowerInput.includes("schedule")) response = "You can book directly on our site using the 'Book a Detail' button. We accept Stripe for secure payments!"; + + setMessages([...newMessages, { role: "bot", text: response }]); + }, 1000); + }; + + return ( +
+ + {!isOpen ? ( + + + + ) : ( + + +
+
+
+ Apex AI Assistant +
+ setIsOpen(false)} /> +
+
+ {messages.map((m, i) => ( + +
+ {m.text} +
+
+ ))} +
+
+ (setInput(e.target.value))} + onKeyDown={(e) => e.key === "Enter" && handleSend()} + /> + +
+ + + )} + +
+ ); +}