import React, { useState, useEffect, useCallback } from 'react'; import { HashRouter, Routes, Route, Link, useLocation, Navigate, useNavigate } from 'react-router-dom'; import { Bell, LogOut, Activity, ChevronRight, Cpu, Settings as SettingsIcon, Terminal, Loader2, Key, ShieldCheck, Zap, ArrowRight, ShieldAlert, Globe, Lock, Database, Shield, ZapOff, Fingerprint, Code } from 'lucide-react'; import { routes } from './views/routes'; import Login from './views/Login'; import Landing from './views/Landing'; import PrivacyPolicy from './views/PrivacyPolicy'; import Documentation from './views/Documentation'; import Airdrop from './views/Airdrop'; import { apiClient } from './services/api'; import { UserSession } from './types/index'; const SidebarItem: React.FC<{ icon: any, label: string, path: string, active: boolean }> = ({ icon: Icon, label, path, active }) => (
{label}
{active && } ); const Header = ({ user, onLogout }: { user: UserSession, onLogout: () => void }) => { const location = useLocation(); const currentRoute = routes.find(r => r.path === location.pathname); const [typedTitle, setTypedTitle] = useState(''); useEffect(() => { if (!currentRoute) return; let i = 0; const fullText = currentRoute.label; setTypedTitle(''); const timer = setInterval(() => { setTypedTitle(fullText.substring(0, i + 1)); i++; if (i >= fullText.length) clearInterval(timer); }, 40); return () => clearInterval(timer); }, [location.pathname, currentRoute]); return (

{typedTitle || 'CORE'} NODE

ROOT_IDENTIFIER: {user.name.toUpperCase()}

{user.name}

{user.role}

); }; const PrivateTerminal = ({ user, onLogout }: { user: UserSession, onLogout: () => void }) => { const location = useLocation(); const navigate = useNavigate(); const handleTerminate = async () => { await onLogout(); navigate('/'); }; return (
{routes.map((route) => ( } /> ))} } />
); }; const NavigationLinks = () => { const location = useLocation(); const categories = ['core', 'registry', 'finance', 'intelligence', 'system', 'admin']; return (
{categories.map(cat => { const catRoutes = routes.filter(r => r.showInSidebar && r.category === cat); if (catRoutes.length === 0) return null; return (

{cat.toUpperCase()}_SUITE

{catRoutes.map((route) => ( ))}
); })}
); }; const NeuralGate = ({ onAuthorized }: { onAuthorized: (tier: 'enterprise' | 'regular') => void }) => { const [loading, setLoading] = useState(false); const handleEnterpriseLink = async () => { setLoading(true); try { await window.aistudio.openSelectKey(); onAuthorized('enterprise'); } catch (e) { console.error("Enterprise gate refusal."); } finally { setLoading(false); } }; const handleRegularLink = () => { onAuthorized('regular'); }; return (

Neural Gateway

"To initialize the aibanking.dev ledger, establishing a secure neural link is mandatory. Select your protocol tier."

Registry Documentation

v6.5.0 Institutional Registry • Secured via RSA-OAEP

); }; const App: React.FC = () => { const [hasKey, setHasKey] = useState(null); const [tier, setTier] = useState<'enterprise' | 'regular' | null>(null); const [currentUser, setCurrentUser] = useState(null); const [isAuthChecked, setIsAuthChecked] = useState(false); const checkStatus = useCallback(async () => { const keySelected = await window.aistudio.hasSelectedApiKey(); setHasKey(keySelected); const { user } = await apiClient.auth.me(); setCurrentUser(user); setIsAuthChecked(true); }, []); useEffect(() => { checkStatus(); window.addEventListener('auth-update', checkStatus); return () => window.removeEventListener('auth-update', checkStatus); }, [checkStatus]); const handleLogout = async () => { await apiClient.auth.logout(); setCurrentUser(null); }; const onAuthorized = (selectedTier: 'enterprise' | 'regular') => { setTier(selectedTier); if (selectedTier === 'regular') setHasKey(true); else checkStatus(); }; if (!isAuthChecked || (hasKey === null && !tier)) { return (

Synchronizing Node Registry...

); } if (!hasKey && tier !== 'regular') { return ; } return ( : } /> : } /> } /> } /> } /> ) : ( )} /> ); }; export default App;