forked from MergeFi/frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
90 lines (79 loc) · 3.47 KB
/
Copy pathApp.tsx
File metadata and controls
90 lines (79 loc) · 3.47 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
83
84
85
86
87
88
89
90
import React from 'react'
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
import { WalletProvider } from '@/context/WalletContext'
import { Layout } from '@/components/layout/Layout'
import { shouldRetryQuery } from '@/lib/queryRetry'
// Pages (lazy-loaded for code-splitting)
import { lazy, Suspense } from 'react'
import { PageLoader } from '@/components/ui/Spinner'
const Home = lazy(() => import('@/pages/Home'))
const Dashboard = lazy(() => import('@/pages/Dashboard'))
const Send = lazy(() => import('@/pages/Send'))
const History = lazy(() => import('@/pages/History'))
const Settings = lazy(() => import('@/pages/Settings'))
const Subscriptions = lazy(() => import('@/pages/Subscriptions'))
const BatchSend = lazy(() => import('@/pages/BatchSend'))
const PaymentRequests = lazy(() => import('@/pages/PaymentRequests'))
const PayRequest = lazy(() => import('@/pages/PayRequest'))
const EscrowPage = lazy(() => import('@/pages/Escrow'))
const NotFound = lazy(() => import('@/pages/NotFound'))
// ─── React Query config ───────────────────────────────────────────────────────
const queryClient = new QueryClient({
defaultOptions: {
queries: {
staleTime: 30_000,
gcTime: 5 * 60_000,
retry: shouldRetryQuery,
refetchOnWindowFocus: true,
},
mutations: {
retry: 0,
},
},
})
// ─── App ──────────────────────────────────────────────────────────────────────
export default function App() {
return (
<QueryClientProvider client={queryClient}>
<WalletProvider>
<BrowserRouter>
<Suspense fallback={<FullPageLoader />}>
<Routes>
{/* Landing page (no layout shell) */}
<Route path="/" element={<Home />} />
{/* App shell with Navbar + Sidebar */}
<Route element={<Layout />}>
<Route path="/dashboard" element={<Dashboard />} />
<Route path="/send" element={<Send />} />
<Route path="/history" element={<History />} />
<Route path="/settings" element={<Settings />} />
<Route path="/subscriptions" element={<Subscriptions />} />
<Route path="/batch" element={<BatchSend />} />
<Route path="/requests" element={<PaymentRequests />} />
<Route path="/pay/:id" element={<PayRequest />} />
<Route path="/escrow" element={<EscrowPage />} />
</Route>
{/* Redirects */}
<Route path="/app" element={<Navigate to="/dashboard" replace />} />
{/* 404 */}
<Route path="*" element={<NotFound />} />
</Routes>
</Suspense>
</BrowserRouter>
</WalletProvider>
{/* Only shown in development */}
{import.meta.env.DEV && (
<ReactQueryDevtools initialIsOpen={false} buttonPosition="bottom-right" />
)}
</QueryClientProvider>
)
}
function FullPageLoader() {
return (
<div className="min-h-screen bg-navy-950 flex items-center justify-center">
<PageLoader label="Loading StellarSend..." />
</div>
)
}