@@ -5,6 +5,8 @@ import i18n from './i18n'
55import AppController from '../controllers/app'
66import WalletsService from '../services/wallets'
77
8+ const isMac = process . platform === 'darwin'
9+
810const separator : MenuItemConstructorOptions = {
911 type : 'separator' ,
1012}
@@ -45,6 +47,7 @@ export const appMenuItem: MenuItemConstructorOptions = {
4547 } ,
4648 ] ,
4749}
50+
4851export const walletMenuItem : MenuItemConstructorOptions = {
4952 id : 'wallet' ,
5053 label : 'Wallet' ,
@@ -95,10 +98,6 @@ export const walletMenuItem: MenuItemConstructorOptions = {
9598 walletsService . requestPassword ( currentWallet . id , 'deleteWallet' )
9699 } ,
97100 } ,
98- /**
99- * TODO: implement this menu item after alpha release
100- * { id: 'change-password', label: i18n.t('application-menu.wallet.change-password') },
101- */
102101 ] ,
103102}
104103
@@ -120,6 +119,7 @@ export const editMenuItem: MenuItemConstructorOptions = {
120119 } ,
121120 ] ,
122121}
122+
123123export const viewMenuItem : MenuItemConstructorOptions = {
124124 id : 'view' ,
125125 label : i18n . t ( 'application-menu.view.label' ) ,
@@ -154,28 +154,55 @@ export const windowMenuItem: MenuItemConstructorOptions = {
154154 } ,
155155 ] ,
156156}
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+
157201export const helpMenuItem : MenuItemConstructorOptions = {
158202 id : 'help' ,
159203 label : i18n . t ( 'application-menu.help.label' ) ,
160204 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 ,
179206}
180207
181208export const developMenuItem : MenuItemConstructorOptions = {
@@ -197,17 +224,12 @@ export const developMenuItem: MenuItemConstructorOptions = {
197224 ] ,
198225}
199226
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 ]
208230
209- if ( env . isDevMode ) {
210- applicationMenuTemplate . push ( developMenuItem )
231+ if ( isMac ) {
232+ applicationMenuTemplate . unshift ( appMenuItem )
211233}
212234
213235export const updateApplicationMenu = ( wallets : Controller . Wallet [ ] , id : string | null ) => {
0 commit comments