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,
Server, Layers, Network
} 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 PrivateTerminal = ({ user, onLogout }: { user: UserSession, onLogout: () => void }) => {
const location = useLocation();
const navigate = useNavigate();
const handleTerminate = async () => {
await onLogout();
navigate('/');
};
return (
SYSTEM CONSOLE
ROOT: {user.name.toUpperCase()}
{routes.map((route) => (
} />
))}
} />
);
};
const App: React.FC = () => {
const [currentUser, setCurrentUser] = useState(null);
const [isAuthChecked, setIsAuthChecked] = useState(false);
const checkStatus = useCallback(async () => {
try {
const { user } = await apiClient.auth.me();
setCurrentUser(user);
} catch (e) {
console.error("Session sync failed.");
} finally {
setIsAuthChecked(true);
}
}, []);
useEffect(() => {
checkStatus();
window.addEventListener('auth-update', checkStatus);
return () => window.removeEventListener('auth-update', checkStatus);
}, [checkStatus]);
if (!isAuthChecked) {
return (
Synchronizing Node Registry...
);
}
return (
} />
: } />
} />
} />
} />
{ await apiClient.auth.logout(); setCurrentUser(null); }} />
) : (
)} />
);
};
export default App;