import React, { useState, useEffect } from 'react'; import { AppView, Tool, AffiliateStats, GlobalStats } from './types'; import LandingPage from './components/LandingPage'; import ExplorerView from './components/ExplorerView'; import CreateView from './components/CreateView'; import DashboardView from './components/DashboardView'; import PricingView from './components/PricingView'; import ToolExecutionView from './components/ToolExecutionView'; import Sidebar from './components/Sidebar'; import AdminView from './components/AdminView'; import AdminLogin from './components/AdminLogin'; const INITIAL_TOOLS: Tool[] = [ { id: '20', name: 'Gemini 3 Pro Intelligence', description: 'Deep logical reasoning for complex business strategies and coding.', category: 'Text', icon: 'M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z', gradient: 'from-blue-600 to-indigo-900', author: 'Google_Cloud', usageCount: 22000, epc: 40.00, isVerified: true, status: 'hot' }, { id: '18', name: 'Imagen 4.0 Studio', description: 'Next-level 4K photorealism for marketing and digital art.', category: 'Image', icon: '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: 'from-blue-400 to-indigo-600', author: 'Z-Labs', usageCount: 6500, epc: 60.00, isVerified: true, status: 'new' }, { id: '15', name: 'Veo Cinematic Lab', description: 'High-fidelity cinematic videos with physically accurate motion.', category: 'Video', icon: 'M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14', gradient: 'from-indigo-400 via-purple-500 to-pink-500', author: 'LumaLabs', usageCount: 4500, epc: 180.00, isVerified: true, status: 'hot' }, { id: '17', name: 'Gemini Live Voice', description: 'Ultra-low latency human-like voice conversations.', category: 'Voice', icon: 'M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7', gradient: 'from-cyan-400 to-blue-600', author: 'Google_Node', usageCount: 12300, epc: 110.00, isVerified: true, status: 'hot' }, { id: '21', name: 'MoltBot Multimodal', description: 'Advanced AI agent that sees, hears, and reasons across all media types simultaneously.', category: 'Agent', icon: 'M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z', gradient: 'from-orange-500 via-red-500 to-pink-600', author: 'Omni_Core', usageCount: 8900, epc: 250.00, isVerified: true, status: 'new' }, ]; const App: React.FC = () => { // Hardcoded Primary Founder UPI const FOUNDER_UPI = 'adityaverma05@ptyes'; const [credits, setCredits] = useState(() => Number(localStorage.getItem('omni_credits')) || 500); const [earnings, setEarnings] = useState(() => Number(localStorage.getItem('omni_earnings')) || 0); const [payoutMethod, setPayoutMethod] = useState(() => localStorage.getItem('omni_upi') || FOUNDER_UPI); const [currentView, setCurrentView] = useState(AppView.LANDING); const [isSidebarOpen, setIsSidebarOpen] = useState(false); const [activeTool, setActiveTool] = useState(null); const [customTools, setCustomTools] = useState([]); const [notifications, setNotifications] = useState<{id: number, text: string, type?: 'success' | 'info'}[]>([]); const [isMasterMode, setIsMasterMode] = useState(false); const [isAdminAuthenticated, setIsAdminAuthenticated] = useState(false); const [isNodeActive, setIsNodeActive] = useState(() => { const saved = localStorage.getItem('omni_node_active'); return saved === null ? true : saved === 'true'; }); const [globalStats, setGlobalStats] = useState({ totalUsers: 4820, activeNodes: 142, totalPlatformRevenue: 2845000, totalRuns: 112400, serverStatus: 'online' }); const [affiliateStats] = useState({ referralCode: "Nexus-" + Math.random().toString(36).substring(7).toUpperCase(), totalReferrals: 18, referralEarnings: 650, conversionRate: "14%" }); useEffect(() => { localStorage.setItem('omni_credits', credits.toString()); localStorage.setItem('omni_earnings', earnings.toString()); localStorage.setItem('omni_upi', payoutMethod); localStorage.setItem('omni_node_active', isNodeActive.toString()); }, [credits, earnings, payoutMethod, isNodeActive]); // Passive Income Simulation: Every 30 seconds, add a small royalty if node is active useEffect(() => { if (!isNodeActive) return; const interval = setInterval(() => { const passiveGain = Math.random() * 0.5 + 0.1; setEarnings(prev => prev + passiveGain); addNotification(`Passive Node Yield: +₹${passiveGain.toFixed(2)}`, 'success'); }, 30000); return () => clearInterval(interval); }, [isNodeActive]); const addNotification = (text: string, type: 'success' | 'info' = 'info') => { const id = Date.now(); setNotifications(prev => [{ id, text, type }, ...prev]); setTimeout(() => setNotifications(prev => prev.filter(n => n.id !== id)), 4000); }; useEffect(() => { const checkHash = () => { if (window.location.hash === '#master') { setIsMasterMode(true); if (!isAdminAuthenticated) setCurrentView(AppView.ADMIN_LOGIN); else setCurrentView(AppView.ADMIN_PANEL); } else { setIsMasterMode(false); if (currentView === AppView.ADMIN_PANEL || currentView === AppView.ADMIN_LOGIN) { setCurrentView(AppView.EXPLORER); } } }; checkHash(); window.addEventListener('hashchange', checkHash); return () => window.removeEventListener('hashchange', checkHash); }, [currentView, isAdminAuthenticated]); const handleNavigate = (view: AppView, toolId?: string) => { setCurrentView(view); if (toolId) { const tool = [...INITIAL_TOOLS, ...customTools].find(t => t.id === toolId); if (tool) setActiveTool(tool); } setIsSidebarOpen(false); }; const handleToolRun = (toolEpc: number) => { if (credits < 10) { addNotification("Credits Low! Buy Fuel to continue.", 'info'); setCurrentView(AppView.PRICING); return false; } setCredits(prev => prev - 10); // Founder Earns 10% of EPC as Passive Income for every tool run const royalty = (toolEpc || 10) * 0.1; setEarnings(prev => prev + royalty); addNotification(`₹${royalty.toFixed(2)} Royalty Added to Vault!`, 'success'); return true; }; const handleCreateTool = (newTool: Tool) => { setCustomTools(prev => [newTool, ...prev]); addNotification(`Asset "${newTool.name}" deployed to Market!`, 'success'); setCurrentView(AppView.EXPLORER); }; const handleWithdraw = () => { if (!payoutMethod) { addNotification("Please set your UPI ID in Vault first.", 'info'); return; } const amount = earnings; if (amount < 100) { addNotification("Minimum ₹100 required for UPI withdrawal.", 'info'); return; } setEarnings(0); addNotification(`₹${amount.toFixed(2)} Transfer initiated to ${payoutMethod}!`, 'success'); }; const handlePaymentSuccess = (amount: number, creditAmount: number) => { setCredits(prev => prev + creditAmount); setGlobalStats(prev => ({ ...prev, totalPlatformRevenue: prev.totalPlatformRevenue + amount })); addNotification(`${creditAmount} Fuel added to your Node.`, 'success'); setCurrentView(AppView.EXPLORER); }; // ADMIN SIMULATOR: Allows the owner to simulate global user traffic and see revenue const simulateGlobalTraffic = () => { const mockRoyalty = Math.floor(Math.random() * 20) + 5; setEarnings(prev => prev + mockRoyalty); setGlobalStats(prev => ({ ...prev, totalRuns: prev.totalRuns + 1 })); addNotification(`Mock Traffic: ₹${mockRoyalty} Royalty Captured!`, 'success'); }; if (currentView === AppView.ADMIN_LOGIN) { return setIsAdminAuthenticated(true)} onCancel={() => { window.location.hash = ''; setCurrentView(AppView.EXPLORER); }} />; } if (isMasterMode && isAdminAuthenticated) { return (
); } if (currentView === AppView.LANDING) { return setCurrentView(AppView.EXPLORER)} />; } return (
{}} />

{currentView.replace('_', ' ')}

Master Node: Active
{credits} Fuel
{currentView === AppView.EXPLORER && handleNavigate(AppView.TOOL_EXECUTION, tool.id)} availableTools={[...INITIAL_TOOLS, ...customTools]} />} {currentView === AppView.CREATE && } {currentView === AppView.TOOL_EXECUTION && activeTool && handleToolRun(activeTool.epc || 10)} />} {currentView === AppView.DASHBOARD && ( setIsNodeActive(!isNodeActive)} /> )} {currentView === AppView.PRICING && }
{/* Global Notifications */}
{notifications.map(n => (

{n.text}

))}
); }; export default App;