Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/renderer/src/components/ContextMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ onBeforeUnmount(() => window.removeEventListener('blur', onWindowBlur))
<template v-for="(item, index) in entries" :key="item.id">
<MenuSeparator v-if="item.separator && index > 0" class="context-menu-separator" />
<MenuAction :item="item.action">
<component
:is="item.icon"
v-if="item.icon"
:size="15"
class="shrink-0"
aria-hidden="true"
/>
<span
class="context-menu-item-action flex-1"
:title="item.disabled ? item.title : undefined"
Expand Down
29 changes: 25 additions & 4 deletions src/renderer/src/composables/useInstallContextMenu.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
import { ref, computed } from 'vue'
import {
ArrowRightLeft,
ArrowUpCircle,
CircleStop,
CloudUpload,
Copy,
Download,
FolderOpen,
History,
Settings2,
Trash2
} from 'lucide-vue-next'
import { useI18n } from 'vue-i18n'
import { useSessionStore } from '../stores/sessionStore'
import { useProgressStore } from '../stores/progressStore'
Expand Down Expand Up @@ -102,13 +114,15 @@ export function useInstallContextMenu(
if (opts.onManage) {
items.push({
id: 'manage',
label: t('chooser.manageInstall')
label: t('chooser.manageInstall'),
icon: Settings2
})

if (isInstalled(inst) && hasUpdateTag(inst)) {
items.push({
id: 'update',
label: t('chooser.menuUpdate'),
icon: ArrowUpCircle,
disabled: stoppedActionGated,
title: gatedTitle
})
Expand All @@ -117,6 +131,7 @@ export function useInstallContextMenu(
items.push({
id: 'migrate',
label: t('chooser.menuMigrate'),
icon: ArrowRightLeft,
disabled: stoppedActionGated,
title: gatedTitle
})
Expand All @@ -127,6 +142,7 @@ export function useInstallContextMenu(
items.push({
id: 'copy-install',
label: t('actions.copyInstallation'),
icon: Copy,
disabled: stoppedActionGated,
title: gatedTitle
})
Expand All @@ -135,7 +151,8 @@ export function useInstallContextMenu(
if (hasInstallPath(inst) && isLocalLikeInstall(inst)) {
items.push({
id: 'reveal-in-folder',
label: revealInFolderLabel(window.api?.platform)
label: revealInFolderLabel(window.api?.platform),
icon: FolderOpen
})
}

Expand All @@ -144,14 +161,16 @@ export function useInstallContextMenu(
if (supportsSnapshotActions) {
snapshotCluster.push({
id: 'share',
label: t('chooser.menuExportSnapshot')
label: t('chooser.menuExportSnapshot'),
icon: Download
})
}

if (opts.onManage && supportsSnapshotActions) {
snapshotCluster.push({
id: 'restore-snapshot',
label: t('chooser.menuRestoreSnapshot'),
icon: History,
disabled: stoppedActionGated,
title: gatedTitle
})
Expand All @@ -161,6 +180,7 @@ export function useInstallContextMenu(
const promoting = isPromotingToWorkspace(inst)
snapshotCluster.push({
id: 'promote-to-workspace',
icon: CloudUpload,
label: promoting
? t('devPlatform.workspace.promoting')
: t('devPlatform.workspace.promoteToWorkspace'),
Expand All @@ -179,12 +199,13 @@ export function useInstallContextMenu(

const cluster: ContextMenuItem[] = []
if (isLocalLikeInstall(inst) && sessionStore.isRunning(inst.id)) {
cluster.push({ id: 'stop', label: t('actions.stop'), style: 'danger' })
cluster.push({ id: 'stop', label: t('actions.stop'), icon: CircleStop, style: 'danger' })
}
if (isLocalLikeInstall(inst) && (isInstalled(inst) || isBuildInstall(inst))) {
cluster.push({
id: 'delete',
label: t('chooser.menuDelete'),
icon: Trash2,
disabled: stoppedActionGated,
title: gatedTitle,
style: 'danger'
Expand Down
4 changes: 3 additions & 1 deletion src/renderer/src/types/context-menu.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import type { Component } from 'vue'

export interface ContextMenuItem {
id: string
label: string
hint?: string
hintUrl?: string
hintLinkLabel?: string
icon?: string
icon?: Component
disabled?: boolean
title?: string
separator?: boolean
Expand Down
Loading