50 lines
1.7 KiB
TypeScript
50 lines
1.7 KiB
TypeScript
|
|
import { lazy, Suspense } from 'react';
|
||
|
|
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
||
|
|
import { ToastProvider, useToastContext } from './contexts/ToastContext';
|
||
|
|
import { ThemeProvider } from './contexts/ThemeContext';
|
||
|
|
import Navbar from './components/Navbar';
|
||
|
|
import ToastContainer from './components/Toast';
|
||
|
|
import LoadingSpinner from './components/LoadingSpinner';
|
||
|
|
|
||
|
|
const Dashboard = lazy(() => import('./pages/Dashboard'));
|
||
|
|
const Jobs = lazy(() => import('./pages/Jobs'));
|
||
|
|
const Executions = lazy(() => import('./pages/Executions'));
|
||
|
|
const ExecutionDetail = lazy(() => import('./pages/ExecutionDetail'));
|
||
|
|
const Schedules = lazy(() => import('./pages/Schedules'));
|
||
|
|
const Timeline = lazy(() => import('./pages/Timeline'));
|
||
|
|
|
||
|
|
function AppLayout() {
|
||
|
|
const { toasts, removeToast } = useToastContext();
|
||
|
|
|
||
|
|
return (
|
||
|
|
<div className="min-h-screen bg-wing-bg text-wing-text">
|
||
|
|
<div className="max-w-7xl mx-auto px-4 py-6">
|
||
|
|
<Navbar />
|
||
|
|
<Suspense fallback={<LoadingSpinner />}>
|
||
|
|
<Routes>
|
||
|
|
<Route path="/" element={<Dashboard />} />
|
||
|
|
<Route path="/jobs" element={<Jobs />} />
|
||
|
|
<Route path="/executions" element={<Executions />} />
|
||
|
|
<Route path="/executions/:id" element={<ExecutionDetail />} />
|
||
|
|
<Route path="/schedules" element={<Schedules />} />
|
||
|
|
<Route path="/schedule-timeline" element={<Timeline />} />
|
||
|
|
</Routes>
|
||
|
|
</Suspense>
|
||
|
|
</div>
|
||
|
|
<ToastContainer toasts={toasts} onRemove={removeToast} />
|
||
|
|
</div>
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
export default function App() {
|
||
|
|
return (
|
||
|
|
<ThemeProvider>
|
||
|
|
<BrowserRouter basename="/snp-api">
|
||
|
|
<ToastProvider>
|
||
|
|
<AppLayout />
|
||
|
|
</ToastProvider>
|
||
|
|
</BrowserRouter>
|
||
|
|
</ThemeProvider>
|
||
|
|
);
|
||
|
|
}
|