import React from 'react' import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom' import { AuthProvider, useAuth } from './contexts/AuthContext' import { ThemeProvider } from './contexts/ThemeContext' import Layout from './components/Layout' import Login from './pages/Login' import Dashboard from './pages/Dashboard' import Accounts from './pages/Accounts' import CreateAccount from './pages/CreateAccount' import Packages from './pages/Packages' import Setup from './pages/Setup' // Lazy-loaded pages (built incrementally) const Resellers = React.lazy(() => import('./pages/Resellers')) const DNS = React.lazy(() => import('./pages/DNS')) const Email = React.lazy(() => import('./pages/Email')) const SSL = React.lazy(() => import('./pages/SSL')) const PHP = React.lazy(() => import('./pages/PHP')) const Services = React.lazy(() => import('./pages/Services')) const Backup = React.lazy(() => import('./pages/Backup')) const Security = React.lazy(() => import('./pages/Security')) const System = React.lazy(() => import('./pages/System')) const WebServer = React.lazy(() => import('./pages/WebServer')) const Settings = React.lazy(() => import('./pages/Settings')) // Accounts sub-pages const AccountList = React.lazy(() => import('./pages/accounts/List')) const AccountParkedDomains = React.lazy(() => import('./pages/accounts/ParkedDomains')) const AccountSubdomains = React.lazy(() => import('./pages/accounts/Subdomains')) const AccountSuspended = React.lazy(() => import('./pages/accounts/Suspended')) const AccountOverQuota = React.lazy(() => import('./pages/accounts/OverQuota')) const AccountBandwidth = React.lazy(() => import('./pages/accounts/Bandwidth')) const AccountChangeIP = React.lazy(() => import('./pages/accounts/ChangeIP')) const AccountEmailUsers = React.lazy(() => import('./pages/accounts/EmailUsers')) const AccountForcePassword = React.lazy(() => import('./pages/accounts/ForcePassword')) const AccountLimitBandwidth = React.lazy(() => import('./pages/accounts/LimitBandwidth')) const AccountSuspension = React.lazy(() => import('./pages/accounts/Suspension')) const AccountDemoMode = React.lazy(() => import('./pages/accounts/DemoMode')) const AccountShellAccess = React.lazy(() => import('./pages/accounts/ShellAccess')) const AccountModify = React.lazy(() => import('./pages/accounts/Modify')) const AccountPasswordMod = React.lazy(() => import('./pages/accounts/PasswordMod')) const AccountQuotaMod = React.lazy(() => import('./pages/accounts/QuotaMod')) const AccountApacheLogs = React.lazy(() => import('./pages/accounts/ApacheLogs')) const AccountNginxLogs = React.lazy(() => import('./pages/accounts/NginxLogs')) const AccountRearrange = React.lazy(() => import('./pages/accounts/Rearrange')) const AccountResetBandwidth = React.lazy(() => import('./pages/accounts/ResetBandwidth')) const AccountTerminate = React.lazy(() => import('./pages/accounts/Terminate')) const AccountUnsuspendBW = React.lazy(() => import('./pages/accounts/UnsuspendBandwidth')) const AccountUpgrade = React.lazy(() => import('./pages/accounts/Upgrade')) const AccountWebTemplate = React.lazy(() => import('./pages/accounts/WebTemplate')) const AccountBulkIP = React.lazy(() => import('./pages/accounts/BulkIP')) const AccountBulkModify = React.lazy(() => import('./pages/accounts/BulkModify')) function ProtectedRoute({ children }: { children: React.ReactNode }) { const { user, loading, setupComplete } = useAuth() if (loading) return (