-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathApp.tsx
More file actions
82 lines (74 loc) · 3.03 KB
/
App.tsx
File metadata and controls
82 lines (74 loc) · 3.03 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
80
81
82
import React, { Suspense, lazy } from "react";
import {
BrowserRouter,
Routes,
Route,
Navigate,
} from "react-router-dom";
import { AuthProvider } from "./contexts/AuthContext";
import { NotificationsProvider } from "./contexts/NotificationsContext";
import { ChatProvider } from "./contexts/ChatContext";
import { PaymentProvider } from "./contexts/PaymentContext";
const SplashPage = lazy(() => import("./pages/SplashPage"));
const LoginPage = lazy(() => import("./pages/LoginPage"));
const HomePage = lazy(() => import("./pages/HomePage"));
const PaymentPage = lazy(() => import("./pages/PaymentPage"));
const HistoryPage = lazy(() => import("./pages/HistoryPage"));
const NotificationsPage = lazy(() => import("./pages/NotificationsPage"));
const ProfilePage = lazy(() => import("./pages/ProfilePage"));
const ChatPage = lazy(() => import("./pages/ChatPage"));
const DrinksPage = lazy(() => import("./pages/DrinksPage"));
const DashboardLayout = lazy(() => import("./components/layout/DashboardLayout"));
const ProtectedRoute = lazy(() => import("./components/auth/ProtectedRoute"));
const TargetCursor = lazy(() => import("./components/common/TargetCursor"));
const RouteFallback: React.FC = () => (
<div className="min-h-screen flex items-center justify-center bg-[#1a1a1a] text-white">
Loading...
</div>
);
const App: React.FC = () => {
return (
<AuthProvider>
<NotificationsProvider>
<PaymentProvider>
<ChatProvider>
<Suspense fallback={<RouteFallback />}>
<TargetCursor
spinDuration={2}
hideDefaultCursor
parallaxOn
hoverDuration={0.2}
/>
<BrowserRouter>
<Routes>
<Route path="/" element={<SplashPage />} />
<Route path="/login" element={<LoginPage />} />
<Route
path="/dashboard"
element={
<ProtectedRoute>
<DashboardLayout />
</ProtectedRoute>
}
>
<Route index element={<Navigate to="home" replace />} />
<Route path="home" element={<HomePage />} />
<Route path="payment" element={<PaymentPage />} />
<Route path="drinks" element={<DrinksPage />} />
<Route path="history" element={<HistoryPage />} />
<Route path="notifications" element={<NotificationsPage />} />
<Route path="chat" element={<ChatPage />} />
<Route path="profile" element={<ProfilePage />} />
<Route path="profile/:userId" element={<ProfilePage />} />
</Route>
<Route path="*" element={<Navigate to="/" />} />
</Routes>
</BrowserRouter>
</Suspense>
</ChatProvider>
</PaymentProvider>
</NotificationsProvider>
</AuthProvider>
);
};
export default App;