-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
79 lines (71 loc) · 2.53 KB
/
App.tsx
File metadata and controls
79 lines (71 loc) · 2.53 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import React, { useEffect } from 'react';
import { BrowserRouter as Router, Routes, Route, useLocation } from 'react-router-dom';
import Navbar from './components/Layout/Navbar';
import Footer from './components/Layout/Footer';
import SmoothScroll from './components/Layout/SmoothScroll';
import TransitionOverlay from './components/UI/TransitionOverlay';
import { SettingsProvider } from './components/Context/SettingsContext';
import { AuthProvider } from './components/Context/AuthContext';
import { Web3Provider } from './components/Context/Web3';
// Pages
import Home from './components/Pages/Home';
import Contact from './components/Pages/Contact';
import Workshop from './components/Pages/Workshop';
import Login from './components/Pages/Login';
import Workspace from './components/Pages/Workspace';
import CustomCursor from './components/Layout/Cursor';
const ScrollHandler = () => {
const { pathname, hash } = useLocation();
useEffect(() => {
if (hash) {
const timer = setTimeout(() => {
const element = document.querySelector(hash);
if (element) {
element.scrollIntoView({ behavior: 'smooth' });
}
}, 100);
return () => clearTimeout(timer);
}
}, [pathname, hash]);
return null;
};
const MainLayout: React.FC<{ children: React.ReactNode }> = ({ children }) => {
const location = useLocation();
const hideFooter = location.pathname === '/workspace' || location.pathname === '/workshop';
return (
<main className="bg-voxel-950 min-h-screen w-full overflow-hidden flex flex-col relative">
<CustomCursor/>
<Navbar />
<div className="flex-grow">
{children}
</div>
{!hideFooter && <Footer />}
</main>
);
};
const App: React.FC = () => {
return (
<Web3Provider>
<AuthProvider>
<SettingsProvider>
<Router>
<SmoothScroll>
<TransitionOverlay />
<ScrollHandler />
<MainLayout>
<Routes>
<Route path="/" element={<Home />} />
<Route path="/contact" element={<Contact />} />
<Route path="/workshop" element={<Workshop />} />
<Route path="/login" element={<Login />} />
<Route path="/workspace" element={<Workspace />} />
</Routes>
</MainLayout>
</SmoothScroll>
</Router>
</SettingsProvider>
</AuthProvider>
</Web3Provider>
);
};
export default App;