Initial commit
This commit is contained in:
86
src/App.jsx
Normal file
86
src/App.jsx
Normal file
@@ -0,0 +1,86 @@
|
||||
import { Toaster } from "@/components/ui/toaster"
|
||||
import { QueryClientProvider } from '@tanstack/react-query'
|
||||
import { queryClientInstance } from '@/lib/query-client'
|
||||
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';
|
||||
import PageNotFound from './lib/PageNotFound';
|
||||
import { AuthProvider, useAuth } from '@/lib/AuthContext';
|
||||
import ScrollToTop from './components/ScrollToTop';
|
||||
import ProtectedRoute from '@/components/ProtectedRoute';
|
||||
import Layout from '@/layouts/Layout';
|
||||
import Overview from '@/pages/Overview';
|
||||
import Positions from '@/pages/Positions';
|
||||
import PositionDetail from '@/pages/PositionDetail';
|
||||
import Candidates from '@/pages/Candidates';
|
||||
import HiredHistory from '@/pages/HiredHistory';
|
||||
import TalentPool from '@/pages/TalentPool';
|
||||
import Apply from '@/pages/Apply';
|
||||
import UserTracking from '@/pages/UserTracking';
|
||||
import Analytics from '@/pages/Analytics';
|
||||
import CreatePosition from '@/pages/CreatePosition';
|
||||
import Profile from '@/pages/Profile';
|
||||
import University from '@/pages/University';
|
||||
import CourseDetail from '@/pages/CourseDetail';
|
||||
import WorkerProfile from '@/pages/WorkerProfile';
|
||||
import KrowIdentity from '@/pages/KrowIdentity';
|
||||
import Owliver from '@/pages/Owliver';
|
||||
import AdminDashboard from '@/pages/AdminDashboard';
|
||||
import EmployeeDashboard from '@/pages/EmployeeDashboard';
|
||||
import DesignSystem from '@/pages/DesignSystem';
|
||||
|
||||
const AuthenticatedApp = () => {
|
||||
const { isLoadingAuth, isLoadingPublicSettings } = useAuth();
|
||||
|
||||
if (isLoadingPublicSettings || isLoadingAuth) {
|
||||
return (
|
||||
<div className="fixed inset-0 flex items-center justify-center">
|
||||
<div className="w-8 h-8 border-4 border-slate-200 border-t-slate-800 rounded-full animate-spin"></div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Routes>
|
||||
<Route element={<ProtectedRoute />}>
|
||||
<Route element={<Layout />}>
|
||||
<Route path="/" element={<Overview />} />
|
||||
<Route path="/positions" element={<Positions />} />
|
||||
<Route path="/positions/new" element={<CreatePosition />} />
|
||||
<Route path="/positions/:id" element={<PositionDetail />} />
|
||||
<Route path="/candidates" element={<Candidates />} />
|
||||
<Route path="/hired" element={<HiredHistory />} />
|
||||
<Route path="/talent-pool" element={<TalentPool />} />
|
||||
<Route path="/apply" element={<Apply />} />
|
||||
<Route path="/tracking" element={<UserTracking />} />
|
||||
<Route path="/analytics" element={<Analytics />} />
|
||||
<Route path="/profile" element={<Profile />} />
|
||||
<Route path="/university" element={<University />} />
|
||||
<Route path="/university/:id" element={<CourseDetail />} />
|
||||
<Route path="/me" element={<WorkerProfile />} />
|
||||
<Route path="/identity" element={<KrowIdentity />} />
|
||||
<Route path="/owliver" element={<Owliver />} />
|
||||
<Route path="/admin" element={<AdminDashboard />} />
|
||||
<Route path="/employee" element={<EmployeeDashboard />} />
|
||||
{/* Design system reference — not in product navigation. */}
|
||||
<Route path="/design-system" element={<DesignSystem />} />
|
||||
</Route>
|
||||
</Route>
|
||||
<Route path="*" element={<PageNotFound />} />
|
||||
</Routes>
|
||||
);
|
||||
};
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<AuthProvider>
|
||||
<QueryClientProvider client={queryClientInstance}>
|
||||
<Router>
|
||||
<ScrollToTop />
|
||||
<AuthenticatedApp />
|
||||
</Router>
|
||||
<Toaster />
|
||||
</QueryClientProvider>
|
||||
</AuthProvider>
|
||||
)
|
||||
}
|
||||
|
||||
export default App
|
||||
Reference in New Issue
Block a user