/** * Alpha-Go - Hyper-Futuristic AI Platform (MCP-2099 Style) * * Theme: High-End Cyberpunk / Scientific Visualization * Colors: Cyber-black (#050505) + Neon Orange (#ff4d00) + Neon Blue (#00f3ff) * Fonts: Inter (UI), JetBrains Mono (data) * * Single-file implementation showcasing: * - Particle sphere with breathing animation * - Sentient core with distort material * - Live terminal feed * - Dashboard with Recharts * - Cinematic loader with text scramble */ import React, { useState, useEffect, useRef, useMemo, useCallback } from 'react'; import { Canvas, useFrame } from '@react-three/fiber'; import { Stars, MeshDistortMaterial, Float, OrbitControls } from '@react-three/drei'; import { motion, AnimatePresence } from 'framer-motion'; import { AreaChart, Area, BarChart, Bar, XAxis, YAxis, ResponsiveContainer, Tooltip, LineChart, Line } from 'recharts'; import { Cpu, Brain, Terminal, BarChart3, Shield, Activity, Zap, Network, Database, Lock, Sun, Moon, ChevronRight, Play, Pause, Settings, Bell, User } from 'lucide-react'; import * as THREE from 'three'; // ============================================ // TYPES & INTERFACES // ============================================ type ViewState = 'HERO' | 'NEURAL' | 'DASHBOARD' | 'LOGS'; interface LogEntry { id: string; timestamp: string; level: 'INFO' | 'WARN' | 'SEC' | 'SYS' | 'DEBUG'; message: string; } interface MetricData { time: string; cpu: number; memory: number; network: number; gpu: number; } // ============================================ // CONSTANTS // ============================================ const COLORS = { cyberBlack: '#050505', surface: '#0a0a0a', neonOrange: '#ff4d00', neonBlue: '#00f3ff', neonPurple: '#a855f7', glass: 'rgba(255, 255, 255, 0.05)', border: 'rgba(255, 255, 255, 0.1)', }; const SCRAMBLE_CHARS = '!<>-_\\/[]{}—=+*^?#________'; const LOG_TEMPLATES: Omit[] = [ { level: 'SYS', message: 'Neural mesh synchronization: 847ms' }, { level: 'INFO', message: 'Quantum buffer allocated: 2.4TB' }, { level: 'WARN', message: 'Thermal threshold approaching' }, { level: 'SEC', message: 'Encryption layer refreshed' }, { level: 'DEBUG', message: 'GC pause: 12ms' }, { level: 'INFO', message: 'Model inference: 3.2ms avg' }, { level: 'SYS', message: 'Cache invalidation complete' }, { level: 'SEC', message: 'Token rotation successful' }, ]; // Generate mock performance data const generateMetricData = (): MetricData[] => { return Array.from({ length: 24 }, (_, i) => ({ time: `${i.toString().padStart(2, '0')}:00`, cpu: 30 + Math.random() * 50, memory: 40 + Math.random() * 40, network: 10 + Math.random() * 70, gpu: 20 + Math.random() * 60, })); }; // ============================================ // HOOKS // ============================================ const useTextScramble = (text: string, active: boolean, speed: number = 30) => { const [output, setOutput] = useState(''); useEffect(() => { if (!active) { setOutput(''); return; } let iteration = 0; const interval = setInterval(() => { setOutput( text.split('').map((char, i) => { if (char === ' ') return ' '; if (i < iteration) return char; return SCRAMBLE_CHARS[Math.floor(Math.random() * SCRAMBLE_CHARS.length)]; }).join('') ); if (iteration >= text.length) clearInterval(interval); iteration += 1/3; }, speed); return () => clearInterval(interval); }, [text, active, speed]); return output; }; const useTerminal = (maxLogs: number = 50) => { const [logs, setLogs] = useState([]); useEffect(() => { const interval = setInterval(() => { const template = LOG_TEMPLATES[Math.floor(Math.random() * LOG_TEMPLATES.length)]; const newLog: LogEntry = { id: `${Date.now()}-${Math.random()}`, timestamp: new Date().toISOString().split('T')[1].split('.')[0], ...template, }; setLogs(prev => [...prev.slice(-maxLogs + 1), newLog]); }, 1200); return () => clearInterval(interval); }, [maxLogs]); return logs; }; // ============================================ // 3D COMPONENTS // ============================================ const BreathingParticleSphere: React.FC<{ color?: string; count?: number }> = ({ color = '#ff4d00', count = 3000 }) => { const pointsRef = useRef(null); const { positions, originalPositions } = useMemo(() => { const pos = new Float32Array(count * 3); const orig = new Float32Array(count * 3); for (let i = 0; i < count; i++) { const theta = Math.random() * Math.PI * 2; const phi = Math.acos(Math.random() * 2 - 1); const r = 2; const x = r * Math.sin(phi) * Math.cos(theta); const y = r * Math.sin(phi) * Math.sin(theta); const z = r * Math.cos(phi); pos[i * 3] = x; pos[i * 3 + 1] = y; pos[i * 3 + 2] = z; orig[i * 3] = x; orig[i * 3 + 1] = y; orig[i * 3 + 2] = z; } return { positions: pos, originalPositions: orig }; }, [count]); useFrame((state) => { if (pointsRef.current) { const time = state.clock.elapsedTime; const positions = pointsRef.current.geometry.attributes.position.array as Float32Array; // Breathing effect const breathe = 1 + Math.sin(time * 0.5) * 0.1; for (let i = 0; i < count; i++) { positions[i * 3] = originalPositions[i * 3] * breathe; positions[i * 3 + 1] = originalPositions[i * 3 + 1] * breathe; positions[i * 3 + 2] = originalPositions[i * 3 + 2] * breathe; } pointsRef.current.geometry.attributes.position.needsUpdate = true; pointsRef.current.rotation.y += 0.001; } }); return ( ); }; const SentientCore: React.FC = () => { const meshRef = useRef(null); useFrame((state) => { if (meshRef.current) { meshRef.current.rotation.y += 0.003; meshRef.current.rotation.z = Math.sin(state.clock.elapsedTime * 0.3) * 0.2; } }); return ( {/* Main core */} {/* Inner glow sphere */} {/* Orbital rings */} ); }; const OrbitalRings: React.FC = () => { const ring1Ref = useRef(null); const ring2Ref = useRef(null); useFrame((state) => { if (ring1Ref.current) { ring1Ref.current.rotation.z += 0.005; } if (ring2Ref.current) { ring2Ref.current.rotation.x += 0.003; } }); return ( <> ); }; // ============================================ // UI COMPONENTS // ============================================ const GlassCard: React.FC<{ children: React.ReactNode; className?: string; hover?: boolean; }> = ({ children, className = '', hover = false }) => ( {children} ); const StatCard: React.FC<{ icon: React.ReactNode; label: string; value: string; change?: string; color?: string; }> = ({ icon, label, value, change, color = '#ff4d00' }) => (
{icon}
{change && ( {change} )}
{value}
{label}
); const Terminal: React.FC<{ logs: LogEntry[]; expanded?: boolean }> = ({ logs, expanded = false }) => { const scrollRef = useRef(null); useEffect(() => { if (scrollRef.current) { scrollRef.current.scrollTop = scrollRef.current.scrollHeight; } }, [logs]); const levelColors: Record = { INFO: 'text-[#00f3ff]', WARN: 'text-yellow-400', SEC: 'text-[#ff4d00]', SYS: 'text-purple-400', DEBUG: 'text-zinc-500', }; return (
System Logs
LIVE
{logs.map(log => (
{log.timestamp} [{log.level}] {log.message}
))}
); }; // ============================================ // CINEMATIC LOADER // ============================================ const CinematicLoader: React.FC<{ onComplete: () => void }> = ({ onComplete }) => { const [progress, setProgress] = useState(0); const [phase, setPhase] = useState(0); const finalText = useTextScramble('ALPHA-GO READY', progress >= 100); const phases = [ 'INITIALIZING KERNEL...', 'LOADING NEURAL MESH...', 'DECRYPTING CORE...', 'SYNCHRONIZING...', ]; useEffect(() => { const interval = setInterval(() => { setProgress(prev => { if (prev >= 100) { clearInterval(interval); setTimeout(onComplete, 800); return 100; } return prev + 1; }); }, 25); return () => clearInterval(interval); }, [onComplete]); useEffect(() => { if (progress < 100) { const interval = setInterval(() => { setPhase(p => (p + 1) % phases.length); }, 600); return () => clearInterval(interval); } }, [progress]); return ( {/* Background particles */}
{/* Scanlines */}
{/* Content */}
{/* Holographic ring */}
{progress}%
{/* Phase text */}
{progress < 100 ? phases[phase] : finalText}
{/* Progress bar */}
); }; // ============================================ // VIEW COMPONENTS // ============================================ const HeroView: React.FC = () => { const titleText = useTextScramble('ALPHA-GO', true); return (
{/* 3D Background */}
{/* Content */}
MCP-2099 PLATFORM

{titleText}

Next-generation AI infrastructure. Engineering the future, one neural connection at a time.

Initialize Documentation
); }; const NeuralView: React.FC = () => (
{/* 3D Background */}
{/* Floating stats */}
Neural Activity
847.3k
connections/sec
Processing Power
2.4 PF
petaflops
{/* Center label */}
Sentient Core
Model: ALPHA-GO-2099
); const DashboardView: React.FC<{ logs: LogEntry[] }> = ({ logs }) => { const [metricData] = useState(generateMetricData); return (

Mission Control

Real-time system monitoring

{/* Bento Grid */}
} label="CPU Load" value="67.3%" change="+2.4%" color="#00f3ff" /> } label="Memory" value="12.4 GB" change="-0.8%" color="#ff4d00" /> } label="Network" value="847 MB/s" change="+12%" color="#00f3ff" /> } label="Security" value="ACTIVE" color="#22c55e" /> {/* Network Chart */}
Network Traffic
{/* Resource Chart */}
Resource Usage
{/* Terminal */}
{/* Security Widget */}
Security
{[ { label: 'Threats Blocked', value: '2,847', color: 'text-[#ff4d00]' }, { label: 'Uptime', value: '99.99%', color: 'text-green-400' }, { label: 'Sessions', value: '1,203', color: 'text-[#00f3ff]' }, ].map(item => (
{item.label} {item.value}
))}
); }; const LogsView: React.FC<{ logs: LogEntry[] }> = ({ logs }) => (

System Logs

Real-time event monitoring and diagnostics

); // ============================================ // NAVBAR // ============================================ const Navbar: React.FC<{ currentView: ViewState; onViewChange: (view: ViewState) => void; darkMode: boolean; onToggleTheme: () => void; }> = ({ currentView, onViewChange, darkMode, onToggleTheme }) => { const navItems: { id: ViewState; label: string; icon: React.ReactNode }[] = [ { id: 'HERO', label: 'Home', icon: }, { id: 'NEURAL', label: 'Neural', icon: }, { id: 'DASHBOARD', label: 'Dashboard', icon: }, { id: 'LOGS', label: 'Logs', icon: }, ]; return ( ); }; // ============================================ // MAIN APP // ============================================ export default function AlphaGoPlatform() { const [loading, setLoading] = useState(true); const [currentView, setCurrentView] = useState('HERO'); const [darkMode, setDarkMode] = useState(true); const logs = useTerminal(); return ( <> {/* Global Styles */}
{loading && ( setLoading(false)} /> )} {!loading && ( <> setDarkMode(!darkMode)} /> {currentView === 'HERO' && } {currentView === 'NEURAL' && } {currentView === 'DASHBOARD' && } {currentView === 'LOGS' && } )} ); }