feat(desktop): add menu and shortcuts to reload page

and update links
pull/105/head
moonrailgun 2 years ago
parent 1a81281ad1
commit 0c8da55a2c

@ -54,17 +54,17 @@ export default class MenuBuilder {
buildDarwinTemplate(): MenuItemConstructorOptions[] { buildDarwinTemplate(): MenuItemConstructorOptions[] {
const subMenuAbout: DarwinMenuItemConstructorOptions = { const subMenuAbout: DarwinMenuItemConstructorOptions = {
label: 'Electron', label: 'Tailchat',
submenu: [ submenu: [
{ {
label: 'About ElectronReact', label: 'About Tailchat',
selector: 'orderFrontStandardAboutPanel:', selector: 'orderFrontStandardAboutPanel:',
}, },
{ type: 'separator' }, { type: 'separator' },
{ label: 'Services', submenu: [] }, { label: 'Services', submenu: [] },
{ type: 'separator' }, { type: 'separator' },
{ {
label: 'Hide ElectronReact', label: 'Hide Tailchat',
accelerator: 'Command+H', accelerator: 'Command+H',
selector: 'hide:', selector: 'hide:',
}, },
@ -100,7 +100,7 @@ export default class MenuBuilder {
}, },
], ],
}; };
const subMenuViewDev: MenuItemConstructorOptions = { const subMenuView: MenuItemConstructorOptions = {
label: 'View', label: 'View',
submenu: [ submenu: [
{ {
@ -126,18 +126,6 @@ export default class MenuBuilder {
}, },
], ],
}; };
const subMenuViewProd: MenuItemConstructorOptions = {
label: 'View',
submenu: [
{
label: 'Toggle Full Screen',
accelerator: 'Ctrl+Command+F',
click: () => {
this.mainWindow.setFullScreen(!this.mainWindow.isFullScreen());
},
},
],
};
const subMenuWindow: DarwinMenuItemConstructorOptions = { const subMenuWindow: DarwinMenuItemConstructorOptions = {
label: 'Window', label: 'Window',
submenu: [ submenu: [
@ -157,38 +145,30 @@ export default class MenuBuilder {
{ {
label: 'Learn More', label: 'Learn More',
click() { click() {
shell.openExternal('https://electronjs.org'); shell.openExternal('https://tailchat.msgbyte.com/');
}, },
}, },
{ {
label: 'Documentation', label: 'Documentation',
click() { click() {
shell.openExternal( shell.openExternal('https://tailchat.msgbyte.com/docs/intro');
'https://github.com/electron/electron/tree/main/docs#readme'
);
}, },
}, },
{ {
label: 'Community Discussions', label: 'Github',
click() { click() {
shell.openExternal('https://www.electronjs.org/community'); shell.openExternal('https://github.com/msgbyte/tailchat');
}, },
}, },
{ {
label: 'Search Issues', label: 'Search Issues',
click() { click() {
shell.openExternal('https://github.com/electron/electron/issues'); shell.openExternal('https://github.com/msgbyte/tailchat/issues');
}, },
}, },
], ],
}; };
const subMenuView =
process.env.NODE_ENV === 'development' ||
process.env.DEBUG_PROD === 'true'
? subMenuViewDev
: subMenuViewProd;
return [subMenuAbout, subMenuEdit, subMenuView, subMenuWindow, subMenuHelp]; return [subMenuAbout, subMenuEdit, subMenuView, subMenuWindow, subMenuHelp];
} }
@ -212,45 +192,29 @@ export default class MenuBuilder {
}, },
{ {
label: '&View', label: '&View',
submenu: submenu: [
process.env.NODE_ENV === 'development' || {
process.env.DEBUG_PROD === 'true' label: '&Reload',
? [ accelerator: 'Ctrl+R',
{ click: () => {
label: '&Reload', this.mainWindow.webContents.reload();
accelerator: 'Ctrl+R', },
click: () => { },
this.mainWindow.webContents.reload(); {
}, label: 'Toggle &Full Screen',
}, accelerator: 'F11',
{ click: () => {
label: 'Toggle &Full Screen', this.mainWindow.setFullScreen(!this.mainWindow.isFullScreen());
accelerator: 'F11', },
click: () => { },
this.mainWindow.setFullScreen( {
!this.mainWindow.isFullScreen() label: 'Toggle &Developer Tools',
); accelerator: 'Alt+Ctrl+I',
}, click: () => {
}, this.mainWindow.webContents.toggleDevTools();
{ },
label: 'Toggle &Developer Tools', },
accelerator: 'Alt+Ctrl+I', ],
click: () => {
this.mainWindow.webContents.toggleDevTools();
},
},
]
: [
{
label: 'Toggle &Full Screen',
accelerator: 'F11',
click: () => {
this.mainWindow.setFullScreen(
!this.mainWindow.isFullScreen()
);
},
},
],
}, },
{ {
label: 'Help', label: 'Help',
@ -258,27 +222,25 @@ export default class MenuBuilder {
{ {
label: 'Learn More', label: 'Learn More',
click() { click() {
shell.openExternal('https://electronjs.org'); shell.openExternal('https://tailchat.msgbyte.com/');
}, },
}, },
{ {
label: 'Documentation', label: 'Documentation',
click() { click() {
shell.openExternal( shell.openExternal('https://tailchat.msgbyte.com/docs/intro');
'https://github.com/electron/electron/tree/main/docs#readme'
);
}, },
}, },
{ {
label: 'Community Discussions', label: 'Github',
click() { click() {
shell.openExternal('https://www.electronjs.org/community'); shell.openExternal('https://github.com/msgbyte/tailchat');
}, },
}, },
{ {
label: 'Search Issues', label: 'Search Issues',
click() { click() {
shell.openExternal('https://github.com/electron/electron/issues'); shell.openExternal('https://github.com/msgbyte/tailchat/issues');
}, },
}, },
], ],

Loading…
Cancel
Save