Astra: security review, left-on-pod ledger, chosen scenarios all run, GL navigation and Create Order popup on 26D, health check (ed9256cd4029)
348eedc verified Download web/src/App.tsx from EnergyVenom/patchwise-agent-studio: direct link, hf CLI and curl.
- Browser
- Download file 8.26 kB
-
https://huggingface.co/spaces/EnergyVenom/patchwise-agent-studio/resolve/main/web/src/App.tsx
- Command line
-
hf download hf://spaces/EnergyVenom/patchwise-agent-studio/web/src/App.tsx
-
curl -L -o App.tsx https://huggingface.co/spaces/EnergyVenom/patchwise-agent-studio/resolve/main/web/src/App.tsx
8.26 kB
| import { Center, Loader } from '@mantine/core'; | |
| import { lazy, Suspense, type ReactNode } from 'react'; | |
| import { Navigate, Route, Routes, useLocation, useSearchParams } from 'react-router-dom'; | |
| import { AssistantPage } from './pages/insights/AssistantPage'; | |
| import { AuthProvider, useAuth } from './auth/AuthContext'; | |
| import { Layout } from './components/Layout'; | |
| import { AdminOnly } from './components/AdminOnly'; | |
| import { NotFoundPage } from './components/ErrorPages'; | |
| import { PodsPage } from './pages/setup/PodsPage'; | |
| import { ReadinessPage } from './pages/home/ReadinessPage'; | |
| import { TicketsPage } from './pages/insights/QueuesPages'; | |
| import { RunWorkspace } from './pages/run/RunWorkspace'; | |
| import { RunsPage } from './pages/runs/RunsPage'; | |
| // Pages opened less often load on demand, so the first visit downloads less (Home, test runs, environments and defects | |
| // stay in the main bundle: they are the daily path). | |
| const named = <T extends Record<string, unknown>>(load: () => Promise<T>, name: keyof T) => | |
| lazy(() => load().then((m) => ({ default: m[name] as React.ComponentType }))); | |
| const AgentTeamPage = named(() => import('./pages/insights/AgentTeamPage'), 'AgentTeamPage'); | |
| const SettingsPage = named(() => import('./pages/setup/SettingsPage'), 'SettingsPage'); | |
| const AutonomyPage = named(() => import('./pages/setup/AdminPages'), 'AutonomyPage'); | |
| const KillSwitchPage = named(() => import('./pages/setup/AdminPages'), 'KillSwitchPage'); | |
| const SchedulerPage = named(() => import('./pages/setup/AdminPages'), 'SchedulerPage'); | |
| const UsersPage = named(() => import('./pages/setup/AdminPages'), 'UsersPage'); | |
| const AuditPage = named(() => import('./pages/insights/InsightPages'), 'AuditPage'); | |
| const LearnerPage = named(() => import('./pages/insights/InsightPages'), 'LearnerPage'); | |
| const ReportsPage = named(() => import('./pages/library/LibraryPages'), 'ReportsPage'); | |
| const ScenarioDetailPage = named(() => import('./pages/library/LibraryPages'), 'ScenarioDetailPage'); | |
| const ScenariosLibraryPage = named(() => import('./pages/library/LibraryPages'), 'ScenariosLibraryPage'); | |
| const HealPage = named(() => import('./pages/insights/QueuesPages'), 'HealPage'); | |
| const ScriptsPage = named(() => import('./pages/insights/QueuesPages'), 'ScriptsPage'); | |
| const AccountPage = named(() => import('./pages/account/AccountPage'), 'AccountPage'); | |
| const IntegrationsPage = named(() => import('./pages/setup/IntegrationsPage'), 'IntegrationsPage'); | |
| const LeftOnPodPage = named(() => import('./pages/setup/LeftOnPodPage'), 'LeftOnPodPage'); | |
| const AgentStudioPage = named(() => import('./pages/setup/AgentStudioPage'), 'AgentStudioPage'); | |
| const AiMonitoringPage = named(() => import('./pages/setup/AiMonitoringPage'), 'AiMonitoringPage'); | |
| const ImportCasesPage = named(() => import('./pages/library/ImportCasesPage'), 'ImportCasesPage'); | |
| // the sign-in page carries the beUI animation library: only people who sign in download it | |
| const LoginPage = named(() => import('./pages/auth/LoginPage'), 'LoginPage'); | |
| const RegisterPage = named(() => import('./pages/auth/RegisterPage'), 'RegisterPage'); | |
| const ForgotPage = named(() => import('./pages/auth/PasswordPages'), 'ForgotPage'); | |
| const ResetPage = named(() => import('./pages/auth/PasswordPages'), 'ResetPage'); | |
| // Dev-only fixture screens for design review; the branch is removed from the production build. | |
| const DevFixtures = import.meta.env.DEV ? lazy(() => import('./pages/dev/DevFixtures').then((m) => ({ default: m.DevFixtures }))) : null; | |
| const DevApprovalFixtures = import.meta.env.DEV ? lazy(() => import('./pages/dev/DevFixtures').then((m) => ({ default: m.DevApprovalFixtures }))) : null; | |
| /** The fixture routes this build registers (none outside dev builds). */ | |
| export const DEV_FIXTURE_PATHS: string[] = import.meta.env.DEV ? ['/dev/board-fixture', '/dev/approval-fixture'] : []; | |
| /** The account pages (sign in, register, forgot, reset) load on demand: they carry the beUI and 3D libraries. */ | |
| function SignInRoute({ children }: { children: ReactNode }) { | |
| return <Suspense fallback={<Center h="100vh" bg="#0a0a0c"><Loader color="gray" aria-label="Loading" /></Center>}>{children}</Suspense>; | |
| } | |
| function RequireAuth({ children }: { children: ReactNode }) { | |
| const { user, loading } = useAuth(); | |
| const loc = useLocation(); | |
| if (loading) return <Center h="100vh"><Loader aria-label="loading" /></Center>; | |
| if (!user) return <Navigate to="/login" replace state={{ from: loc.pathname }} />; | |
| return <>{children}</>; | |
| } | |
| /** The old "new test run" page is now the Start sheet over the home page. */ | |
| function NewRunRedirect() { | |
| const [p] = useSearchParams(); | |
| const area = p.get('area'); | |
| return <Navigate to={`/?new=1${area ? `&area=${encodeURIComponent(area)}` : ''}`} replace />; | |
| } | |
| export function AppRoutes() { | |
| return ( | |
| <Routes> | |
| <Route path="/login" element={<SignInRoute><LoginPage /></SignInRoute>} /> | |
| <Route path="/register" element={<SignInRoute><RegisterPage /></SignInRoute>} /> | |
| <Route path="/forgot" element={<SignInRoute><ForgotPage /></SignInRoute>} /> | |
| <Route path="/reset" element={<SignInRoute><ResetPage /></SignInRoute>} /> | |
| <Route element={<RequireAuth><Layout /></RequireAuth>}> | |
| <Route index element={<ReadinessPage />} /> | |
| <Route path="/runs" element={<RunsPage />} /> | |
| <Route path="/runs/new" element={<NewRunRedirect />} /> | |
| <Route path="/runs/:id" element={<RunWorkspace />} /> | |
| <Route path="/runs/:id/:tab" element={<RunWorkspace />} /> | |
| <Route path="/assistant" element={<AssistantPage />} /> | |
| <Route path="/assistant/:id" element={<AssistantPage />} /> | |
| <Route path="/scenarios" element={<ScenariosLibraryPage />} /> | |
| <Route path="/scenarios/import" element={<ImportCasesPage />} /> | |
| <Route path="/scenarios/:id" element={<ScenarioDetailPage />} /> | |
| <Route path="/tickets" element={<TicketsPage />} /> | |
| <Route path="/pods" element={<PodsPage />} /> | |
| <Route path="/pods/left" element={<LeftOnPodPage />} /> | |
| <Route path="/reports" element={<ReportsPage />} /> | |
| <Route path="/account" element={<AccountPage />} /> | |
| {/* Admin & under the hood (engineering views) */} | |
| <Route path="/admin" element={<AdminOnly><SettingsPage /></AdminOnly>} /> | |
| <Route path="/agents" element={<AdminOnly title="Agent team"><AgentTeamPage /></AdminOnly>} /> | |
| <Route path="/heal" element={<AdminOnly title="Self-heal review"><HealPage /></AdminOnly>} /> | |
| <Route path="/scripts" element={<AdminOnly title="Scripts and drafts"><ScriptsPage /></AdminOnly>} /> | |
| <Route path="/learner" element={<AdminOnly title="Learner"><LearnerPage /></AdminOnly>} /> | |
| <Route path="/audit" element={<AdminOnly title="Audit log"><AuditPage /></AdminOnly>} /> | |
| <Route path="/admin/kill-switch" element={<AdminOnly title="Emergency stop"><KillSwitchPage /></AdminOnly>} /> | |
| <Route path="/admin/autonomy" element={<AdminOnly title="Automatic approval"><AutonomyPage /></AdminOnly>} /> | |
| <Route path="/admin/scheduler" element={<AdminOnly title="Scheduled runs"><SchedulerPage /></AdminOnly>} /> | |
| <Route path="/schedules" element={<AdminOnly title="Scheduled runs"><SchedulerPage /></AdminOnly>} /> | |
| <Route path="/admin/users" element={<AdminOnly title="Users"><UsersPage /></AdminOnly>} /> | |
| <Route path="/integrations" element={<AdminOnly title="Integrations"><IntegrationsPage /></AdminOnly>} /> | |
| <Route path="/agent-studio" element={<AdminOnly title="Oracle AI Agent Studio"><AgentStudioPage /></AdminOnly>} /> | |
| <Route path="/ai-monitoring" element={<AdminOnly title="AI monitoring"><AiMonitoringPage /></AdminOnly>} /> | |
| {DevFixtures && DEV_FIXTURE_PATHS.includes('/dev/board-fixture') && <Route path="/dev/board-fixture" element={<Suspense fallback={null}><DevFixtures /></Suspense>} />} | |
| {DevApprovalFixtures && DEV_FIXTURE_PATHS.includes('/dev/approval-fixture') && <Route path="/dev/approval-fixture" element={<Suspense fallback={null}><DevApprovalFixtures /></Suspense>} />} | |
| <Route path="*" element={<NotFoundPage />} /> | |
| </Route> | |
| </Routes> | |
| ); | |
| } | |
| export function App() { | |
| return <AuthProvider><AppRoutes /></AuthProvider>; | |
| } | |