import { useState, useCallback, useEffect, useMemo } from "react"; import { motion, AnimatePresence } from "framer-motion"; import { useNavigate, Link } from "react-router-dom"; import IsometricRealmCard, { RealmData } from "./IsometricRealmCard"; import { Button } from "./ui/button"; function TypeWriter({ text, delay = 0 }: { text: string; delay?: number }) { const [displayText, setDisplayText] = useState(""); const [started, setStarted] = useState(false); useEffect(() => { const startTimer = setTimeout(() => setStarted(true), delay); return () => clearTimeout(startTimer); }, [delay]); useEffect(() => { if (!started) return; if (displayText.length < text.length) { const timer = setTimeout(() => { setDisplayText(text.slice(0, displayText.length + 1)); }, 50); return () => clearTimeout(timer); } }, [displayText, text, started]); return ( <> {displayText} {displayText.length < text.length && |} ); } const REALM_COLORS = [ "hsl(250, 100%, 60%)", "hsl(120, 100%, 70%)", "hsl(280, 100%, 70%)", "hsl(50, 100%, 70%)", "hsl(210, 100%, 70%)", "hsl(250, 100%, 70%)", "hsl(180, 100%, 60%)", ]; interface ParticleData { id: number; left: number; top: number; size: number; color: string; duration: number; delay: number; xOffset: number; } function generateParticles(count: number): ParticleData[] { return Array.from({ length: count }, (_, i) => ({ id: i, left: 10 + Math.random() * 80, top: 10 + Math.random() * 80, size: 2 + Math.random() * 4, color: REALM_COLORS[Math.floor(Math.random() * REALM_COLORS.length)], duration: 4 + Math.random() * 4, delay: Math.random() * 4, xOffset: Math.sin(i) * 20, })); } const realms: RealmData[] = [ { id: "nexus", label: "NEXUS", color: "hsl(250, 100%, 60%)", route: "/dashboard/nexus", icon: "🌐", description: "The marketplace hub. Find opportunities, contracts, and commissions.", features: ["Browse opportunities", "Submit proposals", "Track contracts"], }, { id: "gameforge", label: "GAMEFORGE", color: "hsl(120, 100%, 70%)", route: "/gameforge", icon: "🎮", description: "Game development powerhouse. Build immersive experiences together.", features: ["Sprint management", "Team collaboration", "Asset pipeline"], }, { id: "foundation", label: "FOUNDATION", color: "hsl(0, 70%, 55%)", route: "/foundation", icon: "🏛️", description: "Learn and grow. Courses, mentorship, and achievement tracking.", features: ["Structured courses", "1-on-1 mentorship", "Skill badges"], }, { id: "labs", label: "LABS", color: "hsl(50, 100%, 70%)", route: "/dashboard/labs", icon: "🔬", description: "Research & experimentation. Push the boundaries of what's possible.", features: ["Experimental features", "R&D projects", "Tech deep-dives"], }, { id: "corp", label: "CORP", color: "hsl(210, 100%, 70%)", route: "/corp", icon: "🏢", description: "Enterprise solutions. Managed services for teams and organizations.", features: ["Dedicated support", "Custom integrations", "SLA guarantees"], }, { id: "staff", label: "STAFF", color: "hsl(250, 100%, 70%)", route: "/staff", icon: "⚡", description: "Internal operations and team management for AeThex staff members.", features: ["Team coordination", "Admin tools", "Operations hub"], }, ]; // Animated counter component function AnimatedCounter({ target, duration = 2000 }: { target: number; duration?: number }) { const [count, setCount] = useState(0); useEffect(() => { const startTime = Date.now(); const animate = () => { const elapsed = Date.now() - startTime; const progress = Math.min(elapsed / duration, 1); const eased = 1 - Math.pow(1 - progress, 3); setCount(Math.floor(target * eased)); if (progress < 1) requestAnimationFrame(animate); }; const timer = setTimeout(animate, 500); return () => clearTimeout(timer); }, [target, duration]); return <>{count.toLocaleString()}; } export default function IsometricRealmSelector() { const navigate = useNavigate(); const [selectedRealm, setSelectedRealm] = useState(null); const [mousePosition, setMousePosition] = useState({ x: 0.5, y: 0.5 }); const [featuredIndex, setFeaturedIndex] = useState(0); const [isPaused, setIsPaused] = useState(false); const particles = useMemo(() => generateParticles(20), []); // Auto-rotate featured realm useEffect(() => { if (isPaused) return; const interval = setInterval(() => { setFeaturedIndex((prev) => (prev + 1) % realms.length); }, 4000); return () => clearInterval(interval); }, [isPaused]); useEffect(() => { let rafId: number; let lastUpdate = 0; const throttleMs = 50; const handleMouseMove = (e: MouseEvent) => { const now = Date.now(); if (now - lastUpdate < throttleMs) return; lastUpdate = now; rafId = requestAnimationFrame(() => { setMousePosition({ x: e.clientX / window.innerWidth, y: e.clientY / window.innerHeight, }); }); }; window.addEventListener("mousemove", handleMouseMove); return () => { window.removeEventListener("mousemove", handleMouseMove); if (rafId) cancelAnimationFrame(rafId); }; }, []); const handleRealmClick = useCallback( (realm: RealmData) => { setSelectedRealm(realm.id); setTimeout(() => navigate(realm.route), 400); }, [navigate] ); return (
{/* Scanline overlay */}
{/* Tech grid overlay */}
{/* Ambient particles */}
{particles.map((particle) => ( ))}
{/* Main content */}

Build the Future

AeThex is an advanced development platform and community where creators collaborate, learn, and bring ideas to life. Join thousands of developers, designers, and innovators.

{/* Live Stats Strip */}
+ Builders
+ Projects
Realms
Live Now
{/* Featured Realm Spotlight Carousel */} setIsPaused(true)} onMouseLeave={() => setIsPaused(false)} >

Featured Realm

{realms.map((realm, index) => (
{realms[featuredIndex].icon}
{[...Array(6)].map((_, i) => ( ))}
{Math.floor(Math.random() * 200 + 50)} online

{realms[featuredIndex].label}

{realms[featuredIndex].description}

{realms[featuredIndex].features.map((feature, i) => ( {feature} ))}

All Realms

Explore every realm and find your place in the ecosystem

{realms.map((realm, index) => ( ))}
); }