sections were held in a usePanelChannel, which is exactly the opaque click the navigation audit catalogues: the id lived in an onClick closure, so a section could not be linked to, opened in a new tab or reached with the back button. /headscale/:section is now the source of truth. nav items are real NavLinks with the active class coming from the router rather than derived in js, and the screen redirects bare or unknown sections to a canonical url so the highlight always matches the address bar. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
72 lines
3.8 KiB
TypeScript
72 lines
3.8 KiB
TypeScript
import { BrowserRouter, Routes, Route, Navigate } from 'react-router';
|
|
import * as Authentication from './Screens/Authentication';
|
|
import * as Dashboard from './Screens/Dashboard';
|
|
import { useAuth } from 'hooks/useAuth';
|
|
import { useServerSettings } from 'state/useServerSettings';
|
|
import { useServerEnvironment } from 'state/useServerEnvironment';
|
|
import { useInitialData } from '@/state/useInitialData';
|
|
|
|
export function App() {
|
|
const { isLoading, isAuthenticated } = useAuth();
|
|
const { plugins, isLoading: isServerSettingsLoading } = useServerSettings();
|
|
useServerEnvironment();
|
|
useInitialData();
|
|
|
|
if (isLoading || isServerSettingsLoading) return null;
|
|
|
|
return (
|
|
<BrowserRouter>
|
|
{!isAuthenticated && (
|
|
<Authentication.AuthenticationLayout>
|
|
<Routes>
|
|
<Route path="/" element={<Authentication.LandingPage />} />
|
|
<Route path="/auth/forgot-password" element={<Authentication.ForgotPassword />} />
|
|
<Route path="/auth/reset-password" element={<Authentication.ResetPassword />} />
|
|
<Route path="*" element={<Navigate to="/" replace />} />
|
|
</Routes>
|
|
</Authentication.AuthenticationLayout>
|
|
)}
|
|
{isAuthenticated && (
|
|
<Dashboard.DashboardLayout>
|
|
<Routes>
|
|
<Route path="/" element={<Dashboard.HomeScreen />} />
|
|
<Route path="/settings/profile" element={<Dashboard.ProfileSettings />} />
|
|
<Route path="/settings/ai" element={<Dashboard.AISettings />} />
|
|
<Route path="/settings/system" element={<Dashboard.SystemSettings />} />
|
|
<Route path="/settings/integrations" element={<Dashboard.IntegrationsSettings />} />
|
|
<Route path="/settings/apps" element={<Dashboard.AppsSettings />} />
|
|
<Route path="/chat" element={<Dashboard.SessionListPage />} />
|
|
<Route path="/chat/new" element={<Dashboard.SessionListPage isNew />} />
|
|
<Route path="/chat/:sessionId" element={<Dashboard.SessionListPage />} />
|
|
<Route path="/plans" element={<Dashboard.Plans />} />
|
|
<Route path="/files" element={<Dashboard.FilesScreen />} />
|
|
<Route path="/music" element={<Dashboard.MusicScreen />} />
|
|
<Route path="/soulseek" element={<Dashboard.SoulseekScreen />} />
|
|
<Route path="/headscale" element={<Dashboard.HeadscaleScreen />} />
|
|
<Route path="/headscale/:section" element={<Dashboard.HeadscaleScreen />} />
|
|
<Route path="/system-monitor" element={<Dashboard.SystemMonitorScreen />} />
|
|
<Route path="/activity" element={<Dashboard.ActivityScreen />} />
|
|
|
|
<Route path="/code-editor" element={<Dashboard.CodeEditor />} />
|
|
<Route path="/skills" element={<Dashboard.Skills />} />
|
|
<Route path="/tasks" element={<Dashboard.Tasks />} />
|
|
<Route path="/processes" element={<Dashboard.Processes />} />
|
|
<Route path="/task-logs" element={<Dashboard.TaskLogs />} />
|
|
<Route path="/jobs" element={<Dashboard.JobsPage />} />
|
|
<Route path="/jobs/:id" element={<Dashboard.JobsPage />} />
|
|
<Route path="/dashboards" element={<Dashboard.DashboardsScreen />} />
|
|
<Route path="/dashboards/:id" element={<Dashboard.DashboardScreen />} />
|
|
<Route path="/email" element={<Dashboard.EmailScreen />} />
|
|
<Route path="/email/:emailId" element={<Dashboard.EmailScreen />} />
|
|
<Route path="/browser" element={<Dashboard.BrowserScreen />} />
|
|
<Route path="/terminal" element={<Dashboard.TerminalScreen />} />
|
|
<Route path="/desktop" element={<Dashboard.DesktopScreen />} />
|
|
<Route path="/auth/signout" element={<Authentication.SignoutScreen />} />
|
|
<Route path="*" element={<Navigate to="/" replace />} />
|
|
</Routes>
|
|
</Dashboard.DashboardLayout>
|
|
)}
|
|
</BrowserRouter>
|
|
);
|
|
}
|