import React, { useState, useEffect } from 'react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import TypingAnimation from './TypingAnimation'; import { getPromptContent } from '../utils/promptContent'; interface ChatInterfaceProps { onPromptSelect: (prompt: string, content: any) => void; isExpanded: boolean; } const prompts = [ "What can you help me with?", "What is MCP?", "Who is this for?", "Show me how I can earn" ]; const ChatInterface: React.FC = ({ onPromptSelect, isExpanded }) => { const [messages, setMessages] = useState>([]); const [inputValue, setInputValue] = useState(''); const [isThinking, setIsThinking] = useState(false); const handlePromptClick = (prompt: string) => { setMessages(prev => [...prev, { text: prompt, isUser: true }]); setIsThinking(true); setTimeout(() => { setIsThinking(false); setMessages(prev => [...prev, { text: `Let me show you detailed information about "${prompt}"`, isUser: false, isTyping: true }]); setTimeout(() => { const content = getPromptContent(prompt); onPromptSelect(prompt, content); }, 1500); }, 1000); }; const handleSendMessage = () => { if (!inputValue.trim()) return; const prompt = inputValue; setInputValue(''); handlePromptClick(prompt); }; const handleKeyPress = (e: React.KeyboardEvent) => { if (e.key === 'Enter') { handleSendMessage(); } }; return (
{/* Hero Section */} {messages.length === 0 && (

Build an MCP server and become part of the new world

Where AI chatbots are the modern interface

{/* Glassmorphism card with prompts */}

How can I help you today?

{prompts.map((prompt, index) => ( ))}
)} {/* Chat Messages */} {messages.length > 0 && (
{messages.map((message, index) => (
{message.isTyping ? ( ) : ( message.text )}
))} {isThinking && (
AI is thinking...
)}
)} {/* Input Area */}
setInputValue(e.target.value)} onKeyPress={handleKeyPress} placeholder="Ask me anything about MCP..." className="flex-1 border-0 bg-transparent focus:ring-0 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400" />
); }; export default ChatInterface;