@@ -5,6 +5,8 @@ import i18n from './i18n'
5
5
import AppController from '../controllers/app'
6
6
import WalletsService from '../services/wallets'
7
7
8
+ const isMac = process . platform === 'darwin'
9
+
8
10
const separator : MenuItemConstructorOptions = {
9
11
type : 'separator' ,
10
12
}
@@ -45,6 +47,7 @@ export const appMenuItem: MenuItemConstructorOptions = {
45
47
} ,
46
48
] ,
47
49
}
50
+
48
51
export const walletMenuItem : MenuItemConstructorOptions = {
49
52
id : 'wallet' ,
50
53
label : 'Wallet' ,
@@ -95,10 +98,6 @@ export const walletMenuItem: MenuItemConstructorOptions = {
95
98
walletsService . requestPassword ( currentWallet . id , 'deleteWallet' )
96
99
} ,
97
100
} ,
98
- /**
99
- * TODO: implement this menu item after alpha release
100
- * { id: 'change-password', label: i18n.t('application-menu.wallet.change-password') },
101
- */
102
101
] ,
103
102
}
104
103
@@ -120,6 +119,7 @@ export const editMenuItem: MenuItemConstructorOptions = {
120
119
} ,
121
120
] ,
122
121
}
122
+
123
123
export const viewMenuItem : MenuItemConstructorOptions = {
124
124
id : 'view' ,
125
125
label : i18n . t ( 'application-menu.view.label' ) ,
@@ -154,28 +154,55 @@ export const windowMenuItem: MenuItemConstructorOptions = {
154
154
} ,
155
155
] ,
156
156
}
157
+
158
+ const helpSubmenu : MenuItemConstructorOptions [ ] = [
159
+ {
160
+ label : 'Nervos' ,
161
+ click : ( ) => {
162
+ if ( AppController ) {
163
+ AppController . openWebsite ( )
164
+ }
165
+ } ,
166
+ } ,
167
+ {
168
+ label : i18n . t ( 'application-menu.help.sourceCode' ) ,
169
+ click : ( ) => {
170
+ if ( AppController ) {
171
+ AppController . openRepository ( )
172
+ }
173
+ } ,
174
+ } ,
175
+ ]
176
+ if ( ! isMac ) {
177
+ helpSubmenu . push ( separator )
178
+ helpSubmenu . push ( {
179
+ id : 'preference' ,
180
+ label : i18n . t ( 'application-menu.help.settings' ) ,
181
+ click : ( ) => {
182
+ if ( AppController ) {
183
+ AppController . showPreference ( )
184
+ }
185
+ } ,
186
+ } )
187
+ helpSubmenu . push ( {
188
+ id : 'about' ,
189
+ label : i18n . t ( 'application-menu.neuron.about' , {
190
+ app : app . getName ( ) ,
191
+ } ) ,
192
+ role : 'about' ,
193
+ click : ( ) => {
194
+ if ( AppController ) {
195
+ AppController . showAbout ( )
196
+ }
197
+ } ,
198
+ } )
199
+ }
200
+
157
201
export const helpMenuItem : MenuItemConstructorOptions = {
158
202
id : 'help' ,
159
203
label : i18n . t ( 'application-menu.help.label' ) ,
160
204
role : 'help' ,
161
- submenu : [
162
- {
163
- label : 'Nervos' ,
164
- click : ( ) => {
165
- if ( AppController ) {
166
- AppController . openWebsite ( )
167
- }
168
- } ,
169
- } ,
170
- {
171
- label : i18n . t ( 'application-menu.help.sourceCode' ) ,
172
- click : ( ) => {
173
- if ( AppController ) {
174
- AppController . openRepository ( )
175
- }
176
- } ,
177
- } ,
178
- ] ,
205
+ submenu : helpSubmenu ,
179
206
}
180
207
181
208
export const developMenuItem : MenuItemConstructorOptions = {
@@ -197,17 +224,12 @@ export const developMenuItem: MenuItemConstructorOptions = {
197
224
] ,
198
225
}
199
226
200
- export const applicationMenuTemplate = [
201
- appMenuItem ,
202
- walletMenuItem ,
203
- editMenuItem ,
204
- viewMenuItem ,
205
- windowMenuItem ,
206
- helpMenuItem ,
207
- ]
227
+ export const applicationMenuTemplate = env . isDevMode
228
+ ? [ walletMenuItem , editMenuItem , viewMenuItem , developMenuItem , windowMenuItem , helpMenuItem ]
229
+ : [ walletMenuItem , editMenuItem , viewMenuItem , windowMenuItem , helpMenuItem ]
208
230
209
- if ( env . isDevMode ) {
210
- applicationMenuTemplate . push ( developMenuItem )
231
+ if ( isMac ) {
232
+ applicationMenuTemplate . unshift ( appMenuItem )
211
233
}
212
234
213
235
export const updateApplicationMenu = ( wallets : Controller . Wallet [ ] , id : string | null ) => {
0 commit comments