Skip to content

Commit 88f3452

Browse files
huntiefacebook-github-bot
authored andcommitted
Add website links to Help menu (#53741)
Summary: Pull Request resolved: #53741 Adds a couple of web link options to populate the "Help" menu in the RNDT desktop app. The default menu is otherwise unchanged. Changelog: [Internal] Reviewed By: vzaidman Differential Revision: D82231524 fbshipit-source-id: 9a57e6067854716691dc35938d6f27735b8c8448
1 parent 408abf6 commit 88f3452

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

packages/debugger-shell/src/electron/MainInstanceEntryPoint.js

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010

1111
// $FlowFixMe[unclear-type] We have no Flow types for the Electron API.
12-
const {BrowserWindow, app, shell, ipcMain} = require('electron') as any;
12+
const {BrowserWindow, Menu, app, shell, ipcMain} = require('electron') as any;
1313
const path = require('path');
1414
const util = require('util');
1515

@@ -91,8 +91,37 @@ function handleLaunchArgs(argv: string[]) {
9191
frontendWindow.focus();
9292
}
9393

94+
function configureAppMenu() {
95+
const template = [
96+
...(process.platform === 'darwin' ? [{role: 'appMenu'}] : []),
97+
{role: 'fileMenu'},
98+
{role: 'editMenu'},
99+
{role: 'viewMenu'},
100+
{role: 'windowMenu'},
101+
{
102+
role: 'help',
103+
submenu: [
104+
{
105+
label: 'React Native Website',
106+
click: () => shell.openExternal('https://reactnative.dev'),
107+
},
108+
{
109+
label: 'Release Notes',
110+
click: () =>
111+
shell.openExternal(
112+
'https://github.com/facebook/react-native/releases',
113+
),
114+
},
115+
],
116+
},
117+
];
118+
const menu = Menu.buildFromTemplate(template);
119+
Menu.setApplicationMenu(menu);
120+
}
121+
94122
app.whenReady().then(() => {
95123
handleLaunchArgs(process.argv.slice(app.isPackaged ? 1 : 2));
124+
configureAppMenu();
96125

97126
app.on(
98127
'second-instance',

0 commit comments

Comments
 (0)