Skip to content

Commit 018c0c7

Browse files
committed
chore: handle opening docs and community via external shell
1 parent 3be5f9b commit 018c0c7

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

apps/desktop/src/components/nav-secondary.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ export function NavSecondary({
3434
<SidebarMenuItem key={item.title}>
3535
<SidebarMenuButton
3636
isActive={currentView === item.title}
37-
onClick={() => onNavigate?.(item)}
37+
onClick={async () => {
38+
if (item.external && item.url) {
39+
await window.electronAPI.openExternal(item.url);
40+
} else {
41+
onNavigate?.(item);
42+
}
43+
}}
3844
>
3945
<item.icon />
4046
<span>{item.title}</span>

apps/desktop/src/main/core/event-handlers.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { HelperEvent } from "@amical/types";
22
import { AppManager } from "./app-manager";
33
import { logger } from "../logger";
4+
import { ipcMain, shell } from "electron";
45

56
export class EventHandlers {
67
private appManager: AppManager;
@@ -11,6 +12,7 @@ export class EventHandlers {
1112

1213
setupEventHandlers(): void {
1314
this.setupSwiftBridgeEventHandlers();
15+
this.setupGeneralIPCHandlers();
1416
// Note: Audio IPC handlers are now managed by RecordingService
1517
}
1618

@@ -43,4 +45,12 @@ export class EventHandlers {
4345
logger.main.warn("Swift bridge not available for event handlers");
4446
}
4547
}
48+
49+
private setupGeneralIPCHandlers(): void {
50+
// Handle opening external links
51+
ipcMain.handle("open-external", async (event, url: string) => {
52+
await shell.openExternal(url);
53+
logger.main.debug("Opening external URL", { url });
54+
});
55+
}
4656
}

apps/desktop/src/main/preload.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ const api: ElectronAPI = {
130130
ipcRenderer.invoke("log-message", "debug", name, ...args),
131131
}),
132132
},
133+
134+
// External link handling
135+
openExternal: (url: string) => ipcRenderer.invoke("open-external", url),
133136
};
134137

135138
contextBridge.exposeInMainWorld("electronAPI", api);

apps/desktop/src/types/electron-api.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,7 @@ export interface ElectronAPI {
6565
debug: (...args: any[]) => void;
6666
};
6767
};
68+
69+
// External link handling
70+
openExternal: (url: string) => Promise<void>;
6871
}

0 commit comments

Comments
 (0)