chore: generate
This commit is contained in:
@@ -7,7 +7,10 @@ import { useCommand } from "@/context/command"
|
|||||||
import { DESKTOP_MENU, desktopMenuVisible, type DesktopMenuAction, type DesktopMenuEntry } from "@/desktop-menu"
|
import { DESKTOP_MENU, desktopMenuVisible, type DesktopMenuAction, type DesktopMenuEntry } from "@/desktop-menu"
|
||||||
import { usePlatform } from "@/context/platform"
|
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
|
let lastFocused: HTMLElement | undefined
|
||||||
|
|
||||||
const rememberFocus = () => {
|
const rememberFocus = () => {
|
||||||
@@ -57,18 +60,20 @@ export function WindowsAppMenu(props: { command: ReturnType<typeof useCommand>;
|
|||||||
<DropdownMenu.GroupLabel class="desktop-app-menu-heading">OpenCode</DropdownMenu.GroupLabel>
|
<DropdownMenu.GroupLabel class="desktop-app-menu-heading">OpenCode</DropdownMenu.GroupLabel>
|
||||||
{DESKTOP_MENU.filter((menu) => desktopMenuVisible(menu, "windows")).map((menu) => (
|
{DESKTOP_MENU.filter((menu) => desktopMenuVisible(menu, "windows")).map((menu) => (
|
||||||
<DesktopMenuSubmenu label={menu.label}>
|
<DesktopMenuSubmenu label={menu.label}>
|
||||||
{menu.items?.filter((entry) => desktopMenuVisible(entry, "windows")).map((entry) =>
|
{menu.items
|
||||||
entry.type === "separator" ? (
|
?.filter((entry) => desktopMenuVisible(entry, "windows"))
|
||||||
<DropdownMenu.Separator />
|
.map((entry) =>
|
||||||
) : (
|
entry.type === "separator" ? (
|
||||||
<DesktopMenuItem
|
<DropdownMenu.Separator />
|
||||||
label={entry.label ?? ""}
|
) : (
|
||||||
keybind={entry.command ? props.command.keybind(entry.command) : entry.accelerator?.windows}
|
<DesktopMenuItem
|
||||||
disabled={entry.command ? commandDisabled(entry.command) : false}
|
label={entry.label ?? ""}
|
||||||
onSelect={() => runEntry(entry)}
|
keybind={entry.command ? props.command.keybind(entry.command) : entry.accelerator?.windows}
|
||||||
/>
|
disabled={entry.command ? commandDisabled(entry.command) : false}
|
||||||
),
|
onSelect={() => runEntry(entry)}
|
||||||
)}
|
/>
|
||||||
|
),
|
||||||
|
)}
|
||||||
</DesktopMenuSubmenu>
|
</DesktopMenuSubmenu>
|
||||||
))}
|
))}
|
||||||
</DropdownMenu.Group>
|
</DropdownMenu.Group>
|
||||||
|
|||||||
@@ -202,8 +202,16 @@ export const DESKTOP_MENU: DesktopMenu[] = [
|
|||||||
{ type: "item", label: "OpenCode Documentation", href: "https://opencode.ai/docs" },
|
{ type: "item", label: "OpenCode Documentation", href: "https://opencode.ai/docs" },
|
||||||
{ type: "item", label: "Support Forum", href: "https://discord.com/invite/opencode" },
|
{ type: "item", label: "Support Forum", href: "https://discord.com/invite/opencode" },
|
||||||
{ type: "separator" },
|
{ 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",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
import { BrowserWindow, Menu, shell } from "electron"
|
import { BrowserWindow, Menu, shell } from "electron"
|
||||||
import type { MenuItemConstructorOptions } 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 { UPDATER_ENABLED } from "./constants"
|
||||||
import { runDesktopMenuAction } from "./desktop-menu-actions"
|
import { runDesktopMenuAction } from "./desktop-menu-actions"
|
||||||
@@ -18,7 +23,9 @@ export function createMenu(deps: Deps) {
|
|||||||
if (menu.role) return { role: nativeRole(menu.role) }
|
if (menu.role) return { role: nativeRole(menu.role) }
|
||||||
return {
|
return {
|
||||||
label: menu.label,
|
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)),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user