chore: initial project scaffold with admin web, backend, desktop client, and deployment setup
Add monorepo structure for NexaVPN WireGuard control plane including: - .gitignore for node_modules, build artifacts, and environment files - README with project overview, monorepo layout, and quick start guide - Admin web UI with React, Vite, TypeScript, and nginx reverse proxy - API client with type definitions for users, devices, policies, gateways, and audit logs - Admin pages for dashboard, users, devices, policies, g
This commit is contained in:
40
admin-web/src/app/App.tsx
Normal file
40
admin-web/src/app/App.tsx
Normal file
@@ -0,0 +1,40 @@
|
||||
import { useMemo, useState } from "react";
|
||||
import { Navigate, Route, Routes } from "react-router-dom";
|
||||
|
||||
import { Layout } from "../components/Layout";
|
||||
import { AuditPage } from "../features/audit/AuditPage";
|
||||
import { LoginPage } from "../features/auth/LoginPage";
|
||||
import { DashboardPage } from "../features/dashboard/DashboardPage";
|
||||
import { DevicesPage } from "../features/devices/DevicesPage";
|
||||
import { GatewaysPage } from "../features/gateways/GatewaysPage";
|
||||
import { PoliciesPage } from "../features/policies/PoliciesPage";
|
||||
import { SettingsPage } from "../features/settings/SettingsPage";
|
||||
import { UsersPage } from "../features/users/UsersPage";
|
||||
|
||||
export function App() {
|
||||
const [token, setToken] = useState(() => localStorage.getItem("nexavpn_admin_token") ?? "");
|
||||
const authenticated = useMemo(() => token.length > 0, [token]);
|
||||
|
||||
function handleAuthenticated(accessToken: string) {
|
||||
localStorage.setItem("nexavpn_admin_token", accessToken);
|
||||
setToken(accessToken);
|
||||
}
|
||||
|
||||
return (
|
||||
<Routes>
|
||||
<Route
|
||||
path="/login"
|
||||
element={authenticated ? <Navigate to="/" replace /> : <LoginPage onAuthenticated={handleAuthenticated} />}
|
||||
/>
|
||||
<Route element={authenticated ? <Layout /> : <Navigate to="/login" replace />}>
|
||||
<Route path="/" element={<DashboardPage />} />
|
||||
<Route path="/users" element={<UsersPage />} />
|
||||
<Route path="/devices" element={<DevicesPage />} />
|
||||
<Route path="/policies" element={<PoliciesPage />} />
|
||||
<Route path="/gateways" element={<GatewaysPage />} />
|
||||
<Route path="/audit" element={<AuditPage />} />
|
||||
<Route path="/settings" element={<SettingsPage />} />
|
||||
</Route>
|
||||
</Routes>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user