chore: sync local changes to Gitea
This commit is contained in:
31
frontend/src/App.tsx
Normal file
31
frontend/src/App.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
import { Suspense, lazy, useMemo } from 'react';
|
||||
import { BrowserRouter, HashRouter, Route, Routes, useLocation } from 'react-router-dom';
|
||||
import { IS_DESKTOP } from './config/site';
|
||||
import { useSiteBranding } from './hooks/useSiteBranding';
|
||||
|
||||
const Home = lazy(() => import('./pages/Home'));
|
||||
const Admin = lazy(() => import('./pages/Admin'));
|
||||
|
||||
function AppRoutes() {
|
||||
const location = useLocation();
|
||||
const isAdmin = useMemo(() => location.pathname.startsWith('/admin'), [location.pathname]);
|
||||
useSiteBranding(isAdmin);
|
||||
|
||||
return (
|
||||
<Suspense fallback={null}>
|
||||
<Routes>
|
||||
<Route path="/" element={<Home />} />
|
||||
<Route path="/admin" element={<Admin />} />
|
||||
</Routes>
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
const Router = IS_DESKTOP ? HashRouter : BrowserRouter;
|
||||
return (
|
||||
<Router>
|
||||
<AppRoutes />
|
||||
</Router>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user