mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-29 19:35:20 +02:00
feat(menu): add Privacy Policy and Terms of Service options to the application menu
This commit is contained in:
parent
79378db7c8
commit
74fff64779
2 changed files with 31 additions and 10 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { app, Menu } from 'electron';
|
||||
import { app, Menu, shell } from 'electron';
|
||||
import { checkForUpdatesManually } from './auto-updater';
|
||||
|
||||
const checkForUpdatesItem: Electron.MenuItemConstructorOptions = {
|
||||
|
|
@ -8,6 +8,20 @@ const checkForUpdatesItem: Electron.MenuItemConstructorOptions = {
|
|||
},
|
||||
};
|
||||
|
||||
const privacyPolicyItem: Electron.MenuItemConstructorOptions = {
|
||||
label: 'Privacy Policy',
|
||||
click: () => {
|
||||
void shell.openExternal('https://www.surfsense.com/privacy');
|
||||
},
|
||||
};
|
||||
|
||||
const termsOfServiceItem: Electron.MenuItemConstructorOptions = {
|
||||
label: 'Terms of Service',
|
||||
click: () => {
|
||||
void shell.openExternal('https://www.surfsense.com/terms');
|
||||
},
|
||||
};
|
||||
|
||||
export function setupMenu(): void {
|
||||
const isMac = process.platform === 'darwin';
|
||||
const template: Electron.MenuItemConstructorOptions[] = [
|
||||
|
|
@ -32,14 +46,19 @@ export function setupMenu(): void {
|
|||
{ role: 'editMenu' as const },
|
||||
{ role: 'viewMenu' as const },
|
||||
{ role: 'windowMenu' as const },
|
||||
...(!isMac
|
||||
? [{
|
||||
role: 'help' as const,
|
||||
submenu: [
|
||||
checkForUpdatesItem,
|
||||
],
|
||||
}]
|
||||
: []),
|
||||
{
|
||||
role: 'help' as const,
|
||||
submenu: [
|
||||
...(!isMac
|
||||
? [
|
||||
checkForUpdatesItem,
|
||||
{ type: 'separator' as const },
|
||||
]
|
||||
: []),
|
||||
privacyPolicyItem,
|
||||
termsOfServiceItem,
|
||||
],
|
||||
},
|
||||
];
|
||||
Menu.setApplicationMenu(Menu.buildFromTemplate(template));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue