- Added API integration for access lists including listing, creating, updating, deleting, and testing IPs against access lists. - Created AccessListForm component for creating and editing access lists with validation. - Developed AccessListSelector component for selecting access lists with detailed display of selected ACL. - Implemented hooks for managing access lists and handling API interactions. - Added tests for AccessListSelector and useAccessLists hooks to ensure functionality. - Enhanced AccessLists page with UI for managing access lists, including create, edit, delete, and test IP features.
80 lines
3.4 KiB
TypeScript
80 lines
3.4 KiB
TypeScript
import { Suspense, lazy } from 'react'
|
|
import { BrowserRouter as Router, Routes, Route, Outlet } from 'react-router-dom'
|
|
import Layout from './components/Layout'
|
|
import { ToastContainer } from './components/Toast'
|
|
import { SetupGuard } from './components/SetupGuard'
|
|
import { LoadingOverlay } from './components/LoadingStates'
|
|
import RequireAuth from './components/RequireAuth'
|
|
import { AuthProvider } from './context/AuthContext'
|
|
|
|
// Lazy load pages for code splitting
|
|
const Dashboard = lazy(() => import('./pages/Dashboard'))
|
|
const ProxyHosts = lazy(() => import('./pages/ProxyHosts'))
|
|
const RemoteServers = lazy(() => import('./pages/RemoteServers'))
|
|
const ImportCaddy = lazy(() => import('./pages/ImportCaddy'))
|
|
const Certificates = lazy(() => import('./pages/Certificates'))
|
|
const SystemSettings = lazy(() => import('./pages/SystemSettings'))
|
|
const Account = lazy(() => import('./pages/Account'))
|
|
const Settings = lazy(() => import('./pages/Settings'))
|
|
const Backups = lazy(() => import('./pages/Backups'))
|
|
const Tasks = lazy(() => import('./pages/Tasks'))
|
|
const Logs = lazy(() => import('./pages/Logs'))
|
|
const Domains = lazy(() => import('./pages/Domains'))
|
|
const Security = lazy(() => import('./pages/Security'))
|
|
const AccessLists = lazy(() => import('./pages/AccessLists'))
|
|
const Uptime = lazy(() => import('./pages/Uptime'))
|
|
const Notifications = lazy(() => import('./pages/Notifications'))
|
|
const Login = lazy(() => import('./pages/Login'))
|
|
const Setup = lazy(() => import('./pages/Setup'))
|
|
|
|
export default function App() {
|
|
return (
|
|
<AuthProvider>
|
|
<Router>
|
|
<Suspense fallback={<LoadingOverlay message="Loading application..." />}>
|
|
<Routes>
|
|
<Route path="/login" element={<Login />} />
|
|
<Route path="/setup" element={<Setup />} />
|
|
<Route path="/" element={
|
|
<SetupGuard>
|
|
<RequireAuth>
|
|
<Layout>
|
|
<Outlet />
|
|
</Layout>
|
|
</RequireAuth>
|
|
</SetupGuard>
|
|
}>
|
|
<Route index element={<Dashboard />} />
|
|
<Route path="proxy-hosts" element={<ProxyHosts />} />
|
|
<Route path="remote-servers" element={<RemoteServers />} />
|
|
<Route path="domains" element={<Domains />} />
|
|
<Route path="certificates" element={<Certificates />} />
|
|
<Route path="security" element={<Security />} />
|
|
<Route path="access-lists" element={<AccessLists />} />
|
|
<Route path="uptime" element={<Uptime />} />
|
|
<Route path="notifications" element={<Notifications />} />
|
|
<Route path="import" element={<ImportCaddy />} />
|
|
|
|
{/* Settings Routes */}
|
|
<Route path="settings" element={<Settings />}>
|
|
<Route index element={<SystemSettings />} />
|
|
<Route path="system" element={<SystemSettings />} />
|
|
<Route path="account" element={<Account />} />
|
|
</Route>
|
|
|
|
{/* Tasks Routes */}
|
|
<Route path="tasks" element={<Tasks />}>
|
|
<Route index element={<Backups />} />
|
|
<Route path="backups" element={<Backups />} />
|
|
<Route path="logs" element={<Logs />} />
|
|
</Route>
|
|
|
|
</Route>
|
|
</Routes>
|
|
</Suspense>
|
|
<ToastContainer />
|
|
</Router>
|
|
</AuthProvider>
|
|
)
|
|
}
|