import { useState, useEffect } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { Header } from './components/dashboard/Header'; import { Sidebar } from './components/dashboard/Sidebar'; import { NetworkStats } from './components/network/NetworkStats'; import { NetworkVisualization } from './components/network/NetworkVisualization'; import { SpecializedNetworks } from './components/network/SpecializedNetworks'; import { CDNPanel } from './components/cdn/CDNPanel'; import { WASMModules } from './components/wasm/WASMModules'; import { MCPTools } from './components/mcp/MCPTools'; import { CreditsPanel } from './components/dashboard/CreditsPanel'; import { ConsolePanel } from './components/dashboard/ConsolePanel'; import { IdentityPanel } from './components/identity/IdentityPanel'; import { DocumentationPanel } from './components/docs/DocumentationPanel'; import { CrystalLoader } from './components/common/CrystalLoader'; import { ConsentWidget } from './components/common/ConsentWidget'; import { useNetworkStore } from './stores/networkStore'; function App() { const [activeTab, setActiveTab] = useState('overview'); const [isSidebarOpen, setIsSidebarOpen] = useState(false); const [isMobile, setIsMobile] = useState(false); const [isLoading, setIsLoading] = useState(true); const { initializeEdgeNet, updateRealStats, isWASMReady } = useNetworkStore(); // Check for mobile viewport useEffect(() => { const checkMobile = () => setIsMobile(window.innerWidth < 768); checkMobile(); window.addEventListener('resize', checkMobile); return () => window.removeEventListener('resize', checkMobile); }, []); // Initialize real EdgeNet WASM module useEffect(() => { const init = async () => { try { await initializeEdgeNet(); console.log('[App] EdgeNet initialized, WASM ready:', isWASMReady); } catch (error) { console.error('[App] EdgeNet initialization failed:', error); } finally { setIsLoading(false); } }; init(); }, [initializeEdgeNet, isWASMReady]); // Update real stats from EdgeNet node useEffect(() => { const interval = setInterval(updateRealStats, 1000); return () => clearInterval(interval); }, [updateRealStats]); // Render active tab content const renderContent = () => { const content = { overview: (

Network Overview

Monitor your distributed compute network in real-time

Quick Actions

), network: (

Network & Communities

Join specialized networks to earn credits by contributing compute

Network Topology

), wasm: (

WASM Modules

), cdn: (

CDN Script Manager

), mcp: , credits: (

Credit Economy

), identity: (

Identity & Networks

Manage your cryptographic identity and network participation

), console: , activity: (

Activity log coming soon...

), settings: (

Settings panel coming soon...

), docs: (

Documentation

Learn how to use Edge-Net and integrate it into your projects

), }; return content[activeTab as keyof typeof content] || content.overview; }; // Loading screen if (isLoading) { return (
); } return (
setIsSidebarOpen(true)} isMobile={isMobile} />
setIsSidebarOpen(false)} isMobile={isMobile} />
{renderContent()}
{/* Floating consent widget for CPU/GPU contribution */}
); } export default App;