main
tsx 74 lines 2.14 KB
Raw
1 import { Routes, Route, useLocation } from "react-router-dom";
2 import * as Tooltip from "@radix-ui/react-tooltip";
3 import Navbar from "./components/Navbar";
4 import AnimatedPage from "./components/AnimatedPage";
5 import Home from "./pages/Home";
6 import Profile from "./pages/Profile";
7 import { AccountProvider } from "./context/AccountContext";
8 import Pay from "./pages/Pay";
9 import SendMoney from "./pages/SendMoney";
10 import Recipients from "./pages/Recipients";
11 import { useLang } from "./context/LanguageContext";
12
13 export default function App() {
14 const location = useLocation();
15 const { lang } = useLang();
16 const isRTL = lang === "fa";
17
18 return (
19 <Tooltip.Provider>
20 <div
21 className="bg-gradient-to-tr from-primary to-sky-100 min-h-screen w-full font-sans relative safe-area"
22 dir={isRTL ? "rtl" : "ltr"}
23 >
24 <Navbar />
25 <main className="py-4 bottom-nav-safe max-w-2xl mx-auto px-4">
26 <AccountProvider>
27 <Routes location={location} key={location.pathname}>
28 <Route
29 path="/"
30 element={
31 <AnimatedPage>
32 <Home />
33 </AnimatedPage>
34 }
35 />
36 <Route
37 path="/pay"
38 element={
39 <AnimatedPage>
40 <Pay />
41 </AnimatedPage>
42 }
43 />
44 <Route
45 path="/send"
46 element={
47 <AnimatedPage>
48 <SendMoney />
49 </AnimatedPage>
50 }
51 />
52 <Route
53 path="/recipients"
54 element={
55 <AnimatedPage>
56 <Recipients />
57 </AnimatedPage>
58 }
59 />
60 <Route
61 path="/profile"
62 element={
63 <AnimatedPage>
64 <Profile />
65 </AnimatedPage>
66 }
67 />
68 </Routes>
69 </AccountProvider>
70 </main>
71 </div>
72 </Tooltip.Provider>
73 );
74 }