History

Import ContextMenuItem from contracts in desktop app

Remove the duplicate DesktopContextMenuItem interface and use the shared ContextMenuItem type from @t3tools/contracts instead.

Julius Marminge committed 8 months ago

Commit 9e2e73c1 parent c530e5d1 file · +2 −7Browse files

Unified · Split

apps/desktop/src/main.ts+2−7
@@ -8,6 +8,7 @@ import path from "node:path"; · 7 unmodified lines
8import { app, BrowserWindow, dialog, ipcMain, Menu, nativeImage, protocol, shell } from "electron";8import { app, BrowserWindow, dialog, ipcMain, Menu, nativeImage, protocol, shell } from "electron";
9import type { MenuItemConstructorOptions } from "electron";9import type { MenuItemConstructorOptions } from "electron";
10 10
11import type { ContextMenuItem } from "@t3tools/contracts";
11import { showDesktopConfirmDialog } from "./confirmDialog";12import { showDesktopConfirmDialog } from "./confirmDialog";
12import { fixPath } from "./fixPath";13import { fixPath } from "./fixPath";
13 14
@@ -36,12 +37,6 @@ let restartTimer: ReturnType<typeof setTimeout> | null = null; · 22 unmodified lines
36let isQuitting = false;37let isQuitting = false;
37let desktopProtocolRegistered = false;38let desktopProtocolRegistered = false;
38 39
39interface DesktopContextMenuItem {
40 id: string;
41 label: string;
42 destructive?: boolean;
43}
44
45let destructiveMenuIconCache: Electron.NativeImage | null | undefined;40let destructiveMenuIconCache: Electron.NativeImage | null | undefined;
46 41
47function getDestructiveMenuIcon(): Electron.NativeImage | undefined {42function getDestructiveMenuIcon(): Electron.NativeImage | undefined {
@@ -439,7 +434,7 @@ function registerIpcHandlers(): void { · 391 unmodified lines
439 CONTEXT_MENU_CHANNEL,434 CONTEXT_MENU_CHANNEL,
440 async (435 async (
441 _event,436 _event,
442 items: DesktopContextMenuItem[],437 items: ContextMenuItem[],
443 position?: { x: number; y: number },438 position?: { x: number; y: number },
444 ) => {439 ) => {
445 const normalizedItems = items440 const normalizedItems = items

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t