chore: handle opening docs and community via external shell

This commit is contained in:
haritabh-z01 2025-07-06 22:09:06 +05:30
parent 3be5f9b1a5
commit 018c0c73c5
4 changed files with 23 additions and 1 deletions

View file

@ -34,7 +34,13 @@ export function NavSecondary({
<SidebarMenuItem key={item.title}>
<SidebarMenuButton
isActive={currentView === item.title}
onClick={() => onNavigate?.(item)}
onClick={async () => {
if (item.external && item.url) {
await window.electronAPI.openExternal(item.url);
} else {
onNavigate?.(item);
}
}}
>
<item.icon />
<span>{item.title}</span>

View file

@ -1,6 +1,7 @@
import { HelperEvent } from "@amical/types";
import { AppManager } from "./app-manager";
import { logger } from "../logger";
import { ipcMain, shell } from "electron";
export class EventHandlers {
private appManager: AppManager;
@ -11,6 +12,7 @@ export class EventHandlers {
setupEventHandlers(): void {
this.setupSwiftBridgeEventHandlers();
this.setupGeneralIPCHandlers();
// Note: Audio IPC handlers are now managed by RecordingService
}
@ -43,4 +45,12 @@ export class EventHandlers {
logger.main.warn("Swift bridge not available for event handlers");
}
}
private setupGeneralIPCHandlers(): void {
// Handle opening external links
ipcMain.handle("open-external", async (event, url: string) => {
await shell.openExternal(url);
logger.main.debug("Opening external URL", { url });
});
}
}

View file

@ -130,6 +130,9 @@ const api: ElectronAPI = {
ipcRenderer.invoke("log-message", "debug", name, ...args),
}),
},
// External link handling
openExternal: (url: string) => ipcRenderer.invoke("open-external", url),
};
contextBridge.exposeInMainWorld("electronAPI", api);

View file

@ -65,4 +65,7 @@ export interface ElectronAPI {
debug: (...args: any[]) => void;
};
};
// External link handling
openExternal: (url: string) => Promise<void>;
}