Browse Source

chore: generate

opencode-agent[bot] 2 tháng trước cách đây
mục cha
commit
4702cddb3e

+ 18 - 13
packages/app/src/components/windows-app-menu.tsx

@@ -7,7 +7,10 @@ import { useCommand } from "@/context/command"
 import { DESKTOP_MENU, desktopMenuVisible, type DesktopMenuAction, type DesktopMenuEntry } from "@/desktop-menu"
 import { usePlatform } from "@/context/platform"
 
-export function WindowsAppMenu(props: { command: ReturnType<typeof useCommand>; platform: ReturnType<typeof usePlatform> }) {
+export function WindowsAppMenu(props: {
+  command: ReturnType<typeof useCommand>
+  platform: ReturnType<typeof usePlatform>
+}) {
   let lastFocused: HTMLElement | undefined
 
   const rememberFocus = () => {
@@ -57,18 +60,20 @@ export function WindowsAppMenu(props: { command: ReturnType<typeof useCommand>;
             <DropdownMenu.GroupLabel class="desktop-app-menu-heading">OpenCode</DropdownMenu.GroupLabel>
             {DESKTOP_MENU.filter((menu) => desktopMenuVisible(menu, "windows")).map((menu) => (
               <DesktopMenuSubmenu label={menu.label}>
-                {menu.items?.filter((entry) => desktopMenuVisible(entry, "windows")).map((entry) =>
-                  entry.type === "separator" ? (
-                    <DropdownMenu.Separator />
-                  ) : (
-                    <DesktopMenuItem
-                      label={entry.label ?? ""}
-                      keybind={entry.command ? props.command.keybind(entry.command) : entry.accelerator?.windows}
-                      disabled={entry.command ? commandDisabled(entry.command) : false}
-                      onSelect={() => runEntry(entry)}
-                    />
-                  ),
-                )}
+                {menu.items
+                  ?.filter((entry) => desktopMenuVisible(entry, "windows"))
+                  .map((entry) =>
+                    entry.type === "separator" ? (
+                      <DropdownMenu.Separator />
+                    ) : (
+                      <DesktopMenuItem
+                        label={entry.label ?? ""}
+                        keybind={entry.command ? props.command.keybind(entry.command) : entry.accelerator?.windows}
+                        disabled={entry.command ? commandDisabled(entry.command) : false}
+                        onSelect={() => runEntry(entry)}
+                      />
+                    ),
+                  )}
               </DesktopMenuSubmenu>
             ))}
           </DropdownMenu.Group>

+ 10 - 2
packages/app/src/desktop-menu.ts

@@ -202,8 +202,16 @@ export const DESKTOP_MENU: DesktopMenu[] = [
       { type: "item", label: "OpenCode Documentation", href: "https://opencode.ai/docs" },
       { type: "item", label: "Support Forum", href: "https://discord.com/invite/opencode" },
       { type: "separator" },
-      { type: "item", label: "Share Feedback", href: "https://github.com/anomalyco/opencode/issues/new?template=feature_request.yml" },
-      { type: "item", label: "Report a Bug", href: "https://github.com/anomalyco/opencode/issues/new?template=bug_report.yml" },
+      {
+        type: "item",
+        label: "Share Feedback",
+        href: "https://github.com/anomalyco/opencode/issues/new?template=feature_request.yml",
+      },
+      {
+        type: "item",
+        label: "Report a Bug",
+        href: "https://github.com/anomalyco/opencode/issues/new?template=bug_report.yml",
+      },
     ],
   },
 ]

+ 9 - 2
packages/desktop/src/main/menu.ts

@@ -1,6 +1,11 @@
 import { BrowserWindow, Menu, shell } from "electron"
 import type { MenuItemConstructorOptions } from "electron"
-import { DESKTOP_MENU, desktopMenuVisible, type DesktopMenuEntry, type DesktopMenuRole } from "@opencode-ai/app/desktop-menu"
+import {
+  DESKTOP_MENU,
+  desktopMenuVisible,
+  type DesktopMenuEntry,
+  type DesktopMenuRole,
+} from "@opencode-ai/app/desktop-menu"
 
 import { UPDATER_ENABLED } from "./constants"
 import { runDesktopMenuAction } from "./desktop-menu-actions"
@@ -18,7 +23,9 @@ export function createMenu(deps: Deps) {
     if (menu.role) return { role: nativeRole(menu.role) }
     return {
       label: menu.label,
-      submenu: menu.items?.filter((entry) => desktopMenuVisible(entry, "macos")).map((entry) => nativeItem(entry, deps)),
+      submenu: menu.items
+        ?.filter((entry) => desktopMenuVisible(entry, "macos"))
+        .map((entry) => nativeItem(entry, deps)),
     }
   })