-
Notifications
You must be signed in to change notification settings - Fork 89
/
types.ts
86 lines (74 loc) · 2.33 KB
/
types.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
import { TradeUrlParams } from 'modules/trade/types/TradeRawState'
import { Routes } from 'constants/routes'
export enum MenuItemKind {
DROP_DOWN = 'DROP_DOWN',
EXTERNAL_LINK = 'EXTERNAL_LINK',
DARK_MODE_BUTTON = 'DARK_MODE_BUTTON',
PARAMETRIZED_LINK = 'PARAMETRIZED_LINK',
CUSTOM_ITEM = 'CUSTOM_ITEM',
}
export enum MainMenuItemId {
SWAP = 'SWAP',
LIMIT_ORDERS = 'LIMIT_ORDERS',
ADVANCED_ORDERS = 'ADVANCED_ORDERS',
FAQ_OVERVIEW = 'FAQ_OVERVIEW',
FAQ_PROTOCOL = 'FAQ_PROTOCOL',
FAQ_TOKEN = 'FAQ_TOKEN',
FAQ_TRADING = 'FAQ_TRADING',
FAQ_AFFILIATE = 'FAQ_AFFILIATE',
FAQ_LIMIT_ORDERS = 'FAQ_LIMIT_ORDERS',
FAQ_ETH_FLOW = 'FAQ_ETH_FLOW',
ACCOUNT_OVERVIEW = 'ACCOUNT_OVERVIEW',
ACCOUNT_TOKENS = 'ACCOUNT_TOKENS',
MORE_DOCUMENTATION = 'MORE_DOCUMENTATION',
MORE_ABOUT = 'MORE_ABOUT',
MORE_EXPLORER = 'MORE_EXPLORER',
MORE_STATISTICS = 'MORE_STATISTICS',
MORE_CONTRACT = 'MORE_CONTRACT',
MORE_DISCORD = 'MORE_DISCORD',
MORE_TWITTER = 'MORE_TWITTER',
OTHER_COW_RUNNER = 'OTHER_COW_RUNNER',
OTHER_MEV_SLICER = 'OTHER_MEV_SLICER',
OTHER_TERMS_AND_CONDITIONS = 'OTHER_TERMS_AND_CONDITIONS',
OTHER_COOKIE_POLICY = 'OTHER_COOKIE_POLICY',
OTHER_PRIVACY_POLICY = 'OTHER_PRIVACY_POLICY',
}
export interface BasicMenuLink {
id: MainMenuItemId
title: string
url: string
icon?: string // If icon uses a regular <img /> tag
iconSVG?: string
}
export interface InternalLink extends BasicMenuLink {
kind?: undefined
}
export interface ExternalLink extends BasicMenuLink {
kind: MenuItemKind.EXTERNAL_LINK
}
export interface ParametrizedLink extends BasicMenuLink {
kind: MenuItemKind.PARAMETRIZED_LINK
url: Routes
}
export interface CustomItem {
kind: MenuItemKind.CUSTOM_ITEM
Item: () => React.ReactNode
}
export type DarkModeLink = { kind: MenuItemKind.DARK_MODE_BUTTON }
export type MenuLink = InternalLink | ExternalLink | DarkModeLink | ParametrizedLink | CustomItem
export interface DropDownSubItem {
sectionTitle?: string
links: MenuLink[]
}
export interface DropDownItem {
kind: MenuItemKind.DROP_DOWN
title: string
items: DropDownSubItem[]
}
export type MenuTreeItem = InternalLink | ExternalLink | DropDownItem | ParametrizedLink | CustomItem
export interface MainMenuContext {
darkMode: boolean
toggleDarkMode: () => void
handleMobileMenuOnClick: () => void
tradeContext: TradeUrlParams
}