All checks were successful
Deploy Dimension47 / deploy (push) Successful in 35s
- Add library page with tabs for maps and combatants - Create map upload modal with grid configuration - Create NPC/monster template modal with abilities - Add library link to campaign page (GM only) - Add battle feature TODO documentation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
73 lines
2.1 KiB
TypeScript
73 lines
2.1 KiB
TypeScript
import { useEffect } from 'react';
|
|
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
|
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
import { LoginPage, RegisterPage, useAuthStore } from '@/features/auth';
|
|
import { CampaignsPage, CampaignDetailPage } from '@/features/campaigns';
|
|
import { CharacterSheetPage } from '@/features/characters';
|
|
import { BattlePage } from '@/features/battle';
|
|
import { LibraryPage } from '@/features/library';
|
|
import { ProtectedRoute } from '@/shared/components/protected-route';
|
|
import { Layout } from '@/shared/components/layout';
|
|
|
|
// Create a client
|
|
const queryClient = new QueryClient({
|
|
defaultOptions: {
|
|
queries: {
|
|
staleTime: 1000 * 60 * 5, // 5 minutes
|
|
retry: 1,
|
|
},
|
|
},
|
|
});
|
|
|
|
function AppContent() {
|
|
const { checkAuth, isAuthenticated } = useAuthStore();
|
|
|
|
useEffect(() => {
|
|
checkAuth();
|
|
}, [checkAuth]);
|
|
|
|
return (
|
|
<Routes>
|
|
{/* Public Routes */}
|
|
<Route
|
|
path="/login"
|
|
element={
|
|
isAuthenticated ? <Navigate to="/" replace /> : <LoginPage />
|
|
}
|
|
/>
|
|
<Route
|
|
path="/register"
|
|
element={
|
|
isAuthenticated ? <Navigate to="/" replace /> : <RegisterPage />
|
|
}
|
|
/>
|
|
|
|
{/* Protected Routes */}
|
|
<Route element={<ProtectedRoute />}>
|
|
<Route element={<Layout />}>
|
|
<Route path="/" element={<CampaignsPage />} />
|
|
<Route path="/campaigns/:id" element={<CampaignDetailPage />} />
|
|
<Route path="/campaigns/:id/characters/:characterId" element={<CharacterSheetPage />} />
|
|
<Route path="/campaigns/:id/battle" element={<BattlePage />} />
|
|
<Route path="/campaigns/:id/library" element={<LibraryPage />} />
|
|
</Route>
|
|
</Route>
|
|
|
|
{/* Fallback */}
|
|
<Route path="*" element={<Navigate to="/" replace />} />
|
|
</Routes>
|
|
);
|
|
}
|
|
|
|
function App() {
|
|
return (
|
|
<QueryClientProvider client={queryClient}>
|
|
<BrowserRouter>
|
|
<AppContent />
|
|
</BrowserRouter>
|
|
</QueryClientProvider>
|
|
);
|
|
}
|
|
|
|
export default App;
|