feat(menu): add Privacy Policy and Terms of Service options to the application menu

This commit is contained in:
Anish Sarkar 2026-05-25 22:26:14 +05:30
parent 79378db7c8
commit 74fff64779
2 changed files with 31 additions and 10 deletions

View file

@ -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));
}

View file

@ -474,8 +474,10 @@ export function AgentPermissionsContent() {
handleConfirmDelete();
}}
disabled={deleteMutation.isPending}
className="relative min-w-[88px]"
>
{deleteMutation.isPending ? "Deleting…" : "Delete"}
<span className={deleteMutation.isPending ? "opacity-0" : ""}>Delete</span>
{deleteMutation.isPending && <Spinner size="sm" className="absolute" />}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>