Skip to content

Commit c5dc2d3

Browse files
committed
feat: Landing Page
Routing, Hooks
1 parent 6578fdd commit c5dc2d3

12 files changed

Lines changed: 181 additions & 24 deletions

File tree

frontend/src/components/Common/Navbar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function Navbar() {
1919
top={0}
2020
p={4}
2121
>
22-
<Link to="/">
22+
<Link to="/dashboard">
2323
<Image src={Logo} alt="Logo" maxW="3xs" p={2} />
2424
</Link>
2525
<Flex gap={2} alignItems="center">

frontend/src/components/Common/NotFound.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const NotFound = () => {
3131
The page you are looking for was not found.
3232
</Text>
3333
<Center zIndex={1}>
34-
<Link to="/">
34+
<Link to="/landing">
3535
<Button variant="solid" colorScheme="teal" mt={4} alignSelf="center">
3636
Go Back
3737
</Button>

frontend/src/components/Common/SidebarItems.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { IconType } from "react-icons/lib"
77
import type { UserPublic } from "@/client"
88

99
const items = [
10-
{ icon: FiHome, title: "Dashboard", path: "/" },
10+
{ icon: FiHome, title: "Dashboard", path: "/dashboard" },
1111
{ icon: FiBriefcase, title: "Items", path: "/items" },
1212
{ icon: FiSettings, title: "User Settings", path: "/settings" },
1313
]

frontend/src/hooks/useAuth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const useAuth = () => {
5151
const loginMutation = useMutation({
5252
mutationFn: login,
5353
onSuccess: () => {
54-
navigate({ to: "/" })
54+
navigate({ to: "/dashboard" })
5555
},
5656
onError: (err: ApiError) => {
5757
handleError(err)

frontend/src/routeTree.gen.ts

Lines changed: 57 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ import { Route as SignupRouteImport } from './routes/signup'
1313
import { Route as ResetPasswordRouteImport } from './routes/reset-password'
1414
import { Route as RecoverPasswordRouteImport } from './routes/recover-password'
1515
import { Route as LoginRouteImport } from './routes/login'
16+
import { Route as LandingRouteImport } from './routes/landing'
1617
import { Route as LayoutRouteImport } from './routes/_layout'
17-
import { Route as LayoutIndexRouteImport } from './routes/_layout/index'
18+
import { Route as IndexRouteImport } from './routes/index'
1819
import { Route as LayoutSettingsRouteImport } from './routes/_layout/settings'
1920
import { Route as LayoutItemsRouteImport } from './routes/_layout/items'
21+
import { Route as LayoutDashboardRouteImport } from './routes/_layout/dashboard'
2022
import { Route as LayoutAdminRouteImport } from './routes/_layout/admin'
2123

2224
const SignupRoute = SignupRouteImport.update({
@@ -39,14 +41,19 @@ const LoginRoute = LoginRouteImport.update({
3941
path: '/login',
4042
getParentRoute: () => rootRouteImport,
4143
} as any)
44+
const LandingRoute = LandingRouteImport.update({
45+
id: '/landing',
46+
path: '/landing',
47+
getParentRoute: () => rootRouteImport,
48+
} as any)
4249
const LayoutRoute = LayoutRouteImport.update({
4350
id: '/_layout',
4451
getParentRoute: () => rootRouteImport,
4552
} as any)
46-
const LayoutIndexRoute = LayoutIndexRouteImport.update({
53+
const IndexRoute = IndexRouteImport.update({
4754
id: '/',
4855
path: '/',
49-
getParentRoute: () => LayoutRoute,
56+
getParentRoute: () => rootRouteImport,
5057
} as any)
5158
const LayoutSettingsRoute = LayoutSettingsRouteImport.update({
5259
id: '/settings',
@@ -58,80 +65,99 @@ const LayoutItemsRoute = LayoutItemsRouteImport.update({
5865
path: '/items',
5966
getParentRoute: () => LayoutRoute,
6067
} as any)
68+
const LayoutDashboardRoute = LayoutDashboardRouteImport.update({
69+
id: '/dashboard',
70+
path: '/dashboard',
71+
getParentRoute: () => LayoutRoute,
72+
} as any)
6173
const LayoutAdminRoute = LayoutAdminRouteImport.update({
6274
id: '/admin',
6375
path: '/admin',
6476
getParentRoute: () => LayoutRoute,
6577
} as any)
6678

6779
export interface FileRoutesByFullPath {
80+
'/': typeof IndexRoute
81+
'/landing': typeof LandingRoute
6882
'/login': typeof LoginRoute
6983
'/recover-password': typeof RecoverPasswordRoute
7084
'/reset-password': typeof ResetPasswordRoute
7185
'/signup': typeof SignupRoute
7286
'/admin': typeof LayoutAdminRoute
87+
'/dashboard': typeof LayoutDashboardRoute
7388
'/items': typeof LayoutItemsRoute
7489
'/settings': typeof LayoutSettingsRoute
75-
'/': typeof LayoutIndexRoute
7690
}
7791
export interface FileRoutesByTo {
92+
'/': typeof IndexRoute
93+
'/landing': typeof LandingRoute
7894
'/login': typeof LoginRoute
7995
'/recover-password': typeof RecoverPasswordRoute
8096
'/reset-password': typeof ResetPasswordRoute
8197
'/signup': typeof SignupRoute
8298
'/admin': typeof LayoutAdminRoute
99+
'/dashboard': typeof LayoutDashboardRoute
83100
'/items': typeof LayoutItemsRoute
84101
'/settings': typeof LayoutSettingsRoute
85-
'/': typeof LayoutIndexRoute
86102
}
87103
export interface FileRoutesById {
88104
__root__: typeof rootRouteImport
105+
'/': typeof IndexRoute
89106
'/_layout': typeof LayoutRouteWithChildren
107+
'/landing': typeof LandingRoute
90108
'/login': typeof LoginRoute
91109
'/recover-password': typeof RecoverPasswordRoute
92110
'/reset-password': typeof ResetPasswordRoute
93111
'/signup': typeof SignupRoute
94112
'/_layout/admin': typeof LayoutAdminRoute
113+
'/_layout/dashboard': typeof LayoutDashboardRoute
95114
'/_layout/items': typeof LayoutItemsRoute
96115
'/_layout/settings': typeof LayoutSettingsRoute
97-
'/_layout/': typeof LayoutIndexRoute
98116
}
99117
export interface FileRouteTypes {
100118
fileRoutesByFullPath: FileRoutesByFullPath
101119
fullPaths:
120+
| '/'
121+
| '/landing'
102122
| '/login'
103123
| '/recover-password'
104124
| '/reset-password'
105125
| '/signup'
106126
| '/admin'
127+
| '/dashboard'
107128
| '/items'
108129
| '/settings'
109-
| '/'
110130
fileRoutesByTo: FileRoutesByTo
111131
to:
132+
| '/'
133+
| '/landing'
112134
| '/login'
113135
| '/recover-password'
114136
| '/reset-password'
115137
| '/signup'
116138
| '/admin'
139+
| '/dashboard'
117140
| '/items'
118141
| '/settings'
119-
| '/'
120142
id:
121143
| '__root__'
144+
| '/'
122145
| '/_layout'
146+
| '/landing'
123147
| '/login'
124148
| '/recover-password'
125149
| '/reset-password'
126150
| '/signup'
127151
| '/_layout/admin'
152+
| '/_layout/dashboard'
128153
| '/_layout/items'
129154
| '/_layout/settings'
130-
| '/_layout/'
131155
fileRoutesById: FileRoutesById
132156
}
133157
export interface RootRouteChildren {
158+
IndexRoute: typeof IndexRoute
134159
LayoutRoute: typeof LayoutRouteWithChildren
160+
LandingRoute: typeof LandingRoute
135161
LoginRoute: typeof LoginRoute
136162
RecoverPasswordRoute: typeof RecoverPasswordRoute
137163
ResetPasswordRoute: typeof ResetPasswordRoute
@@ -168,19 +194,26 @@ declare module '@tanstack/react-router' {
168194
preLoaderRoute: typeof LoginRouteImport
169195
parentRoute: typeof rootRouteImport
170196
}
197+
'/landing': {
198+
id: '/landing'
199+
path: '/landing'
200+
fullPath: '/landing'
201+
preLoaderRoute: typeof LandingRouteImport
202+
parentRoute: typeof rootRouteImport
203+
}
171204
'/_layout': {
172205
id: '/_layout'
173206
path: ''
174207
fullPath: ''
175208
preLoaderRoute: typeof LayoutRouteImport
176209
parentRoute: typeof rootRouteImport
177210
}
178-
'/_layout/': {
179-
id: '/_layout/'
211+
'/': {
212+
id: '/'
180213
path: '/'
181214
fullPath: '/'
182-
preLoaderRoute: typeof LayoutIndexRouteImport
183-
parentRoute: typeof LayoutRoute
215+
preLoaderRoute: typeof IndexRouteImport
216+
parentRoute: typeof rootRouteImport
184217
}
185218
'/_layout/settings': {
186219
id: '/_layout/settings'
@@ -196,6 +229,13 @@ declare module '@tanstack/react-router' {
196229
preLoaderRoute: typeof LayoutItemsRouteImport
197230
parentRoute: typeof LayoutRoute
198231
}
232+
'/_layout/dashboard': {
233+
id: '/_layout/dashboard'
234+
path: '/dashboard'
235+
fullPath: '/dashboard'
236+
preLoaderRoute: typeof LayoutDashboardRouteImport
237+
parentRoute: typeof LayoutRoute
238+
}
199239
'/_layout/admin': {
200240
id: '/_layout/admin'
201241
path: '/admin'
@@ -208,23 +248,25 @@ declare module '@tanstack/react-router' {
208248

209249
interface LayoutRouteChildren {
210250
LayoutAdminRoute: typeof LayoutAdminRoute
251+
LayoutDashboardRoute: typeof LayoutDashboardRoute
211252
LayoutItemsRoute: typeof LayoutItemsRoute
212253
LayoutSettingsRoute: typeof LayoutSettingsRoute
213-
LayoutIndexRoute: typeof LayoutIndexRoute
214254
}
215255

216256
const LayoutRouteChildren: LayoutRouteChildren = {
217257
LayoutAdminRoute: LayoutAdminRoute,
258+
LayoutDashboardRoute: LayoutDashboardRoute,
218259
LayoutItemsRoute: LayoutItemsRoute,
219260
LayoutSettingsRoute: LayoutSettingsRoute,
220-
LayoutIndexRoute: LayoutIndexRoute,
221261
}
222262

223263
const LayoutRouteWithChildren =
224264
LayoutRoute._addFileChildren(LayoutRouteChildren)
225265

226266
const rootRouteChildren: RootRouteChildren = {
267+
IndexRoute: IndexRoute,
227268
LayoutRoute: LayoutRouteWithChildren,
269+
LandingRoute: LandingRoute,
228270
LoginRoute: LoginRoute,
229271
RecoverPasswordRoute: RecoverPasswordRoute,
230272
ResetPasswordRoute: ResetPasswordRoute,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { createFileRoute } from "@tanstack/react-router"
33

44
import useAuth from "@/hooks/useAuth"
55

6-
export const Route = createFileRoute("/_layout/")({
6+
export const Route = createFileRoute("/_layout/dashboard")({
77
component: Dashboard,
88
})
99

frontend/src/routes/index.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { useEffect } from "react"
2+
3+
import { createFileRoute, useNavigate } from "@tanstack/react-router"
4+
5+
import { isLoggedIn } from "@/hooks/useAuth"
6+
7+
export const Route = createFileRoute("/")({
8+
component: RootRedirect,
9+
})
10+
11+
function RootRedirect() {
12+
const navigate = useNavigate()
13+
14+
useEffect(() => {
15+
navigate({
16+
to: isLoggedIn() ? "/dashboard" : "/landing",
17+
replace: true,
18+
})
19+
}, [navigate])
20+
21+
return null
22+
}
23+
24+
export default RootRedirect

frontend/src/routes/landing.tsx

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
import { Box, Button, Container, Flex, Heading, Text } from "@chakra-ui/react"
2+
import { Link as RouterLink, createFileRoute } from "@tanstack/react-router"
3+
4+
import { isLoggedIn } from "@/hooks/useAuth"
5+
6+
export const Route = createFileRoute("/landing")({
7+
component: LandingPage,
8+
})
9+
10+
function LandingPage() {
11+
const loggedIn = isLoggedIn()
12+
13+
return (
14+
<Container
15+
maxW="6xl"
16+
minH="100vh"
17+
display="flex"
18+
flexDir="column"
19+
justifyContent="center"
20+
gap={16}
21+
py={12}
22+
>
23+
<Flex direction="column" gap={6}>
24+
<Heading as="h1" size="3xl">
25+
Seamless Arbitrage Insights
26+
</Heading>
27+
<Text fontSize="xl" color="fg.muted" maxW="2xl">
28+
Track market opportunities, monitor performance, and make decisions
29+
with confidence. All from a single, intuitive dashboard.
30+
</Text>
31+
<Flex gap={4} wrap="wrap">
32+
<RouterLink to={loggedIn ? "/dashboard" : "/signup"}>
33+
<Button size="lg" colorScheme="teal">
34+
{loggedIn ? "Go to Dashboard" : "Get Started"}
35+
</Button>
36+
</RouterLink>
37+
{!loggedIn && (
38+
<RouterLink to="/login">
39+
<Button size="lg" variant="outline">
40+
Log In
41+
</Button>
42+
</RouterLink>
43+
)}
44+
</Flex>
45+
</Flex>
46+
47+
<Flex
48+
direction={{ base: "column", md: "row" }}
49+
gap={8}
50+
align="stretch"
51+
>
52+
<Feature
53+
title="Real-time Monitoring"
54+
description="Stay updated with live price tracking across your connected exchanges."
55+
/>
56+
<Feature
57+
title="Actionable Alerts"
58+
description="Receive instant notifications when profitable spreads appear."
59+
/>
60+
<Feature
61+
title="Collaboration Ready"
62+
description="Invite your team and share insights to coordinate faster trades."
63+
/>
64+
</Flex>
65+
</Container>
66+
)
67+
}
68+
69+
interface FeatureProps {
70+
title: string
71+
description: string
72+
}
73+
74+
function Feature({ title, description }: FeatureProps) {
75+
return (
76+
<Box
77+
borderWidth="1px"
78+
borderRadius="lg"
79+
p={6}
80+
bg="bg.surface"
81+
shadow="sm"
82+
>
83+
<Heading as="h2" size="md" mb={3}>
84+
{title}
85+
</Heading>
86+
<Text color="fg.muted">{description}</Text>
87+
</Box>
88+
)
89+
}
90+
91+
export default LandingPage

frontend/src/routes/login.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const Route = createFileRoute("/login")({
2121
beforeLoad: async () => {
2222
if (isLoggedIn()) {
2323
throw redirect({
24-
to: "/",
24+
to: "/dashboard",
2525
})
2626
}
2727
},

frontend/src/routes/recover-password.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const Route = createFileRoute("/recover-password")({
2121
beforeLoad: async () => {
2222
if (isLoggedIn()) {
2323
throw redirect({
24-
to: "/",
24+
to: "/dashboard",
2525
})
2626
}
2727
},

0 commit comments

Comments
 (0)