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

Loading…
Cancel
Save