-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.tsx
57 lines (47 loc) · 1.55 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { useEffect } from 'react';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import { useRecoilValue } from 'recoil';
import initialize from './lib/session';
import { themeStore } from './stores';
import About from './routes/AboutRoute';
import Header from './components/Header';
import Notifications from './components/notifications/Notifications';
import Footer from './components/Footer';
import Home from './routes/HomeRoute';
import Gallery from './routes/gallery/GalleryRoute';
import Settings from './routes/SettingsRoute';
import NotFound from './routes/NotFoundRoute';
import SidebarNav from './components/nav/SidebarNav';
let appInitialized = false;
const App = () => {
const theme = useRecoilValue(themeStore);
const useMountEffect = () =>
useEffect(() => {
if (!appInitialized) {
initialize();
appInitialized = true;
}
}, []);
useMountEffect()
return (
<div data-theme={theme.selectedTheme} className="App min-h-screen">
<Router>
<Notifications />
<SidebarNav>
<Header />
<div className="px-4">
<Routes>
<Route path="/about" element={<About />} />
<Route path="/settings" element={<Settings />} />
<Route path="/gallery" element={<Gallery />} />
<Route path="/" element={<Home />} />
<Route path="*" element={<NotFound />} />
</Routes>
</div>
</SidebarNav>
<Footer />
</Router>
</div>
);
};
export default App;