import React, { useState } from 'react'; import { GeminiService } from '../geminiService'; import { Tool } from '../types'; interface CreateViewProps { onCreateTool: (tool: Tool) => void; } const CreateView: React.FC = ({ onCreateTool }) => { const [name, setName] = useState(''); const [desc, setDesc] = useState(''); const [category, setCategory] = useState<'Text' | 'Image' | 'Video' | 'Voice'>('Text'); const [price, setPrice] = useState('15.00'); const [isBuilding, setIsBuilding] = useState(false); const [isSuggesting, setIsSuggesting] = useState(false); const handleBuild = async () => { if (!name || !desc) return; setIsBuilding(true); // Create a proper Tool object const newTool: Tool = { id: `custom-${Date.now()}`, name, description: desc, category, icon: category === 'Text' ? 'M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z' : 'M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z', gradient: category === 'Text' ? 'from-blue-500 to-indigo-500' : 'from-indigo-600 to-purple-600', author: 'Merchant (Me)', usageCount: 0, epc: parseFloat(price), isUserCreated: true, status: 'new' }; // Simulate node syncing await new Promise(r => setTimeout(r, 2000)); setIsBuilding(false); onCreateTool(newTool); }; const handleSuggest = async () => { setIsSuggesting(true); try { const { text } = await GeminiService.chat( "Suggest a high-utility AI tool for the Indian market. Format: Name|Description|Category(Text, Image, Video, or Voice)" ); const parts = text.split('|'); if (parts.length >= 3) { setName(parts[0].trim()); setDesc(parts[1].trim()); const cat = parts[2].trim() as any; if (['Text', 'Image', 'Video', 'Voice'].includes(cat)) setCategory(cat); } else { setName("Hindi Legal Bot"); setDesc("Instant simplified Hindi translations for complex English legal documents."); setCategory("Text"); } } catch (err) { setName("Wedding Invite AI"); setDesc("Generates personalized Indian wedding cards from guest lists."); setCategory("Image"); } finally { setIsSuggesting(false); } }; const templates = [ { name: 'Viral Reels AI', desc: 'Creates high-engagement Instagram reels from simple text scripts.', cat: 'Video' as const }, { name: 'Cinematic Trailer', desc: 'Generates 4K cinematic movie trailers based on your story concept.', cat: 'Video' as const }, { name: 'LegalEase Pro', desc: 'Simplifies complex legal documents into easy-to-understand summaries.', cat: 'Text' as const }, { name: 'Logo Architect', desc: 'Generates professional vector-style logos for startups.', cat: 'Image' as const }, ]; return (
Architect Terminal v2.5

Publish to Market.

Deploy specialized AI assets to the global exchange and receive instant settlements in ₹.

{templates.map((t, i) => ( ))}
setName(e.target.value)} placeholder="e.g. LegalEase Pro" className="w-full bg-[#020617] border border-slate-800 rounded-2xl px-6 py-4 text-white font-medium focus:ring-2 focus:ring-indigo-500 outline-none" />