import React, { useState, useRef, useEffect } from 'react'; import { X, ClipboardList, Linkedin, Instagram, Mail, Layout, Edit3, MonitorPlay, Lightbulb, Image, Plus, Sparkles, Zap, AlertCircle, Video, Megaphone, Link as LinkIcon, Loader2, RefreshCw, CheckCircle2, MessageSquare } from 'lucide-react'; import { GradioService } from '../services/gradioService'; // --- Types --- interface ChatPageProps { onBack: () => void; simulationResult: any; setSimulationResult: (res: any) => void; } // --- Sub-components (Modular Structure) --- const ChatButton: React.FC<{ label: string; primary?: boolean; icon?: React.ReactNode; onClick?: () => void; className?: string }> = ({ label, primary, icon, onClick, className = "" }) => ( ); const CategoryCard: React.FC<{ title: string; options: { label: string; icon: React.ReactNode }[]; selectedVariation: string; onSelect: (label: string) => void; }> = ({ title, options, selectedVariation, onSelect }) => (

{title}

{options.map((option) => (
onSelect(option.label)} className={`group flex items-center gap-3 p-3 rounded-xl cursor-pointer border transition-all duration-200 ${selectedVariation === option.label ? 'bg-teal-900/20 border-teal-500/50 text-white' : 'hover:bg-gray-900/80 border-transparent hover:border-gray-800'}`} >
{option.icon}
{option.label}
))}
); const ChatInput: React.FC<{ onSimulate: (msg: string) => void; onHelpMeCraft: (msg: string) => void; isSimulating: boolean }> = ({ onSimulate, onHelpMeCraft, isSimulating }) => { const [message, setMessage] = useState(''); const [uploadedFiles, setUploadedFiles] = useState([]); const fileInputRef = useRef(null); const handleUploadClick = () => { fileInputRef.current?.click(); }; const handleFileChange = (e: React.ChangeEvent) => { const files = e.target.files; if (files && files.length > 0) { const newFiles = Array.from(files); setUploadedFiles(prev => [...prev, ...newFiles]); console.log("Selected files:", newFiles.map(f => f.name)); } }; const removeFile = (index: number) => { setUploadedFiles(prev => prev.filter((_, i) => i !== index)); }; return (
{uploadedFiles.length > 0 && (
{uploadedFiles.map((file, idx) => (
{file.name}
))}
)}