1
- import { Grid , Typography } from "@material-ui/core" ;
1
+ import { Grid } from "@material-ui/core" ;
2
2
import Box from "@material-ui/core/Box" ;
3
- import Drawer from "@material-ui/core/Drawer" ;
4
- import List from "@material-ui/core/List" ;
5
3
import { createStyles , makeStyles , Theme } from "@material-ui/core/styles" ;
6
- import AccountBalanceWalletOutlinedIcon from "@material-ui/icons/AccountBalanceWalletOutlined" ;
7
- import CachedIcon from "@material-ui/icons/Cached" ;
8
- import HistoryIcon from "@material-ui/icons/History" ;
9
- import RemoveRedEyeOutlinedIcon from "@material-ui/icons/RemoveRedEyeOutlined" ;
10
- import SettingsIcon from "@material-ui/icons/Settings" ;
11
- import SportsEsportsIcon from "@material-ui/icons/SportsEsports" ;
12
- import TrendingUpIcon from "@material-ui/icons/TrendingUp" ;
13
4
import React , { ReactElement , useEffect , useState } from "react" ;
14
5
import {
15
6
Redirect ,
@@ -29,25 +20,16 @@ import {
29
20
takeUntil ,
30
21
} from "rxjs/operators" ;
31
22
import api from "../api" ;
32
- import Button from "../common/components/input/buttons/Button" ;
33
- import MenuItem , {
34
- MenuItemProps ,
35
- } from "../common/components/navigation/MenuItem" ;
36
23
import NotFound from "../common/components/NotFound" ;
37
- import { isElectron , sendMessageToParent } from "../common/utils/appUtil" ;
38
24
import { SetupStatusResponse } from "../models/SetupStatusResponse" ;
39
25
import { Status } from "../models/Status" ;
40
26
import { Path } from "../router/Path" ;
41
27
import Settings from "../settings/Settings" ;
42
- import Console from "./console/Console" ;
43
- import Overview from "./overview/Overview" ;
44
28
import SetupWarning from "./SetupWarning" ;
45
- import Trade from "./trade/Trade" ;
46
- import Tradehistory from "./tradehistory/Tradehistory" ;
47
- import Wallets from "./wallet/Wallets" ;
48
29
import { isOpendexdReady } from "../common/utils/serviceUtil" ;
49
30
import { ServiceStore , SERVICE_STORE } from "../stores/serviceStore" ;
50
31
import { inject , observer } from "mobx-react" ;
32
+ import { Menu , menuItems } from "../common/components/navigation/Menu" ;
51
33
52
34
type DashboardProps = {
53
35
serviceStore ?: ServiceStore ;
@@ -57,19 +39,6 @@ export const drawerWidth = 200;
57
39
58
40
const useStyles = makeStyles ( ( theme : Theme ) =>
59
41
createStyles ( {
60
- drawerPaper : {
61
- width : drawerWidth ,
62
- justifyContent : "space-between" ,
63
- } ,
64
- menuContainer : {
65
- width : "100%" ,
66
- } ,
67
- header : {
68
- padding : "16px" ,
69
- } ,
70
- drawerButton : {
71
- margin : theme . spacing ( 2 ) ,
72
- } ,
73
42
content : {
74
43
marginLeft : drawerWidth ,
75
44
backgroundColor : theme . palette . background . default ,
@@ -95,44 +64,6 @@ const Dashboard = inject(SERVICE_STORE)(
95
64
[ ]
96
65
) ;
97
66
98
- const menuItems : MenuItemProps [ ] = [
99
- {
100
- path : Path . OVERVIEW ,
101
- text : "Overview" ,
102
- component : Overview ,
103
- icon : RemoveRedEyeOutlinedIcon ,
104
- isFallback : true ,
105
- } ,
106
- {
107
- path : Path . TRADE ,
108
- text : "Trade" ,
109
- component : Trade ,
110
- icon : TrendingUpIcon ,
111
- } ,
112
- {
113
- path : Path . TRADEHISTORY ,
114
- text : "Trade History" ,
115
- component : Tradehistory ,
116
- icon : HistoryIcon ,
117
- } ,
118
- {
119
- path : Path . WALLETS ,
120
- text : "Wallets" ,
121
- component : Wallets ,
122
- icon : AccountBalanceWalletOutlinedIcon ,
123
- } ,
124
- {
125
- path : Path . CONSOLE ,
126
- text : "Console" ,
127
- component : Console ,
128
- icon : SportsEsportsIcon ,
129
- } ,
130
- ] ;
131
-
132
- const disconnect = ( ) : void => {
133
- sendMessageToParent ( "disconnect" ) ;
134
- } ;
135
-
136
67
useEffect ( ( ) => {
137
68
if ( syncInProgress ) {
138
69
return ;
@@ -204,63 +135,10 @@ const Dashboard = inject(SERVICE_STORE)(
204
135
205
136
return (
206
137
< Box >
207
- < Drawer
208
- variant = "permanent"
209
- classes = { {
210
- paper : classes . drawerPaper ,
211
- } }
212
- anchor = "left"
213
- >
214
- < Grid container item >
215
- < Typography
216
- className = { classes . header }
217
- variant = "overline"
218
- component = "p"
219
- color = "textSecondary"
220
- >
221
- OpenDEX
222
- </ Typography >
223
- < List className = { classes . menuContainer } >
224
- { menuItems . map ( ( item ) => (
225
- < MenuItem
226
- path = { item . path }
227
- text = { item . text }
228
- component = { item . component }
229
- key = { item . text }
230
- icon = { item . icon }
231
- isFallback = { item . isFallback }
232
- isDisabled = { item . path !== Path . OVERVIEW && syncInProgress }
233
- tooltipTextRows = { menuItemTooltipMsg }
234
- />
235
- ) ) }
236
- </ List >
237
- </ Grid >
238
- < Grid container item direction = "column" justify = "flex-end" >
239
- < Grid item container >
240
- < MenuItem
241
- path = { Path . SETTINGS }
242
- text = { "Settings" }
243
- component = { Settings }
244
- icon = { SettingsIcon }
245
- />
246
- </ Grid >
247
- { isElectron ( ) && (
248
- < Grid item container justify = "center" >
249
- < Button
250
- text = "Disconnect"
251
- tooltipTitle = "Disconnect from opendex-docker"
252
- tooltipPlacement = "top"
253
- size = "small"
254
- startIcon = { < CachedIcon /> }
255
- variant = "outlined"
256
- className = { classes . drawerButton }
257
- fullWidth
258
- onClick = { disconnect }
259
- />
260
- </ Grid >
261
- ) }
262
- </ Grid >
263
- </ Drawer >
138
+ < Menu
139
+ syncInProgress = { syncInProgress }
140
+ menuItemTooltipMsg = { menuItemTooltipMsg }
141
+ />
264
142
< main className = { classes . content } >
265
143
< Grid item container >
266
144
{ opendexdReady &&
0 commit comments