-
Notifications
You must be signed in to change notification settings - Fork 0
/
nav.ts
108 lines (99 loc) · 1.92 KB
/
nav.ts
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
export interface Route {
path: string
title: string
}
export interface Translation {
lang: string
url: string
}
export const TRANSLATIONS: Translation[] = []
export const SOL_ROUTES: Route[] = [
{
path: "deploy",
title: "Deploy Pool",
},
{
path: "deploy-collection",
title: "Deploy Collection Pool",
},
{
path: "deploy-subset",
title: "Deploy Subset Pool",
},
]
export const LEND_ROUTES: Route[] = [
{
path: "add-quote",
title: "Add Quote",
},
{
path: "add-collateral",
title: "Add Collateral",
},
{
path: "move-quote",
title: "Move Quote",
},
{
path: "lender-info",
title: "Lender Info",
},
{
path: "remove-quote",
title: "Remove Quote",
},
]
export const TEST_ROUTES: Route[] = []
export const DEFI_ROUTES = []
export const ROUTES_BY_CATEGORY = [
{
title: "",
routes: SOL_ROUTES.map((route) => ({
...route,
path: `/${route.path}`,
})),
},
{
title: "Lend",
routes: LEND_ROUTES.map((route) => ({
...route,
path: `/lend/${route.path}`,
})),
},
// {
// title: "Tests",
// routes: TEST_ROUTES.map((route) => ({
// ...route,
// path: `/tests/${route.path}`,
// })),
// },
// {
// title: "DeFi",
// routes: DEFI_ROUTES.map((route) => ({
// ...route,
// path: `/defi/${route.path}`,
// })),
// },
]
export const ROUTES = ROUTES_BY_CATEGORY.map(({ routes }) => routes).flat()
export const ROUTE_INDEX_BY_PATH = ROUTES.reduce((map, route: Route, i) => {
// @ts-ignore
map[route.path] = i
return map
}, {})
export function getPrevNextPaths(path: string): {
prev: Route | null
next: Route | null
} {
// @ts-ignore
const index = ROUTE_INDEX_BY_PATH[path]
if (index >= 0) {
const prev = ROUTES[index - 1] || null
const next = ROUTES[index + 1] || null
return { prev, next }
}
return {
prev: null,
next: null,
}
}