-
Notifications
You must be signed in to change notification settings - Fork 2
/
nav.ts
126 lines (116 loc) · 2.16 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
export interface Route {
path: string
title: string
}
export interface Translation {
lang: string
url: string
}
export const TRANSLATIONS: Translation[] = []
export const SOL_ROUTES: Route[] = [
{
path: "initialize",
title: "Initialize Pool",
},
{
path: "create-liquidity",
title: "Create Liquidity",
},
{
path: "swap",
title: "Swap",
},
{
path: "quoter",
title: "Quoter"
}
]
export const HOOK_ROUTES: Route[] = [
{
path: "no-op",
title: "NoOp Swap"
},
{
path: "custom-curve",
title: "Custom Curve"
},
{
path: "msg-sender",
title: "Access msg.sender"
}
]
const FEE_ROUTES: Route[] = [
{
path: "swap-fee",
title: "Swap Fee"
},
{
path: "fixed-hook-fee",
title: "Static Hook Fee"
},
{
path: "dynamic-fee",
title: "Dynamic Swap Fee"
}
]
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: "Hooks",
routes: HOOK_ROUTES.map((route) => ({
...route,
path: `/hooks/${route.path}`,
})),
},
{
title: "Fees",
routes: FEE_ROUTES.map((route) => ({
...route,
path: `/fees/${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,
}
}