2026-01-06 20:12:36 +00:00
|
|
|
import { Routes, Route, Navigate } from 'react-router-dom'
|
|
|
|
|
import { useAuthStore } from '@/stores/authStore'
|
2026-01-10 20:49:42 +00:00
|
|
|
import { useFeatureFlags } from '@/hooks/useFeatureFlags'
|
2026-01-06 20:12:36 +00:00
|
|
|
import LoginPage from '@/pages/LoginPage'
|
|
|
|
|
import DashboardPage from '@/pages/DashboardPage'
|
|
|
|
|
import PacksPage from '@/pages/PacksPage'
|
|
|
|
|
import UsersPage from '@/pages/UsersPage'
|
2026-01-09 21:36:49 +00:00
|
|
|
import ThemesPage from '@/pages/ThemesPage'
|
|
|
|
|
import RoomsPage from '@/pages/RoomsPage'
|
2026-01-10 20:49:42 +00:00
|
|
|
import FeatureFlagsPage from '@/pages/FeatureFlagsPage'
|
2026-01-06 20:12:36 +00:00
|
|
|
import Layout from '@/components/layout/Layout'
|
|
|
|
|
import { TokenRefreshProvider } from '@/components/TokenRefreshProvider'
|
|
|
|
|
|
|
|
|
|
function App() {
|
|
|
|
|
const { isAuthenticated } = useAuthStore()
|
2026-01-10 20:49:42 +00:00
|
|
|
const { isThemesEnabled } = useFeatureFlags()
|
2026-01-06 20:12:36 +00:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<TokenRefreshProvider>
|
|
|
|
|
<div className="min-h-screen bg-background">
|
|
|
|
|
<Routes>
|
|
|
|
|
<Route
|
|
|
|
|
path="/login"
|
|
|
|
|
element={isAuthenticated ? <Navigate to="/" replace /> : <LoginPage />}
|
|
|
|
|
/>
|
|
|
|
|
<Route
|
|
|
|
|
path="/*"
|
|
|
|
|
element={
|
|
|
|
|
isAuthenticated ? (
|
|
|
|
|
<Layout>
|
|
|
|
|
<Routes>
|
|
|
|
|
<Route path="/" element={<DashboardPage />} />
|
|
|
|
|
<Route path="/packs" element={<PacksPage />} />
|
|
|
|
|
<Route path="/users" element={<UsersPage />} />
|
2026-01-10 20:49:42 +00:00
|
|
|
{isThemesEnabled() && <Route path="/themes" element={<ThemesPage />} />}
|
2026-01-09 21:36:49 +00:00
|
|
|
<Route path="/rooms" element={<RoomsPage />} />
|
2026-01-10 20:49:42 +00:00
|
|
|
<Route path="/settings" element={<FeatureFlagsPage />} />
|
2026-01-06 20:12:36 +00:00
|
|
|
</Routes>
|
|
|
|
|
</Layout>
|
|
|
|
|
) : (
|
|
|
|
|
<Navigate to="/login" replace />
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
</Routes>
|
|
|
|
|
</div>
|
|
|
|
|
</TokenRefreshProvider>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default App
|