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: 21 additions & 8 deletions src/renderer/src/components/settings/ComfyUISettingsContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ import {
EyeOff,
Settings2,
Repeat2,
Server
Server,
Ellipsis
} from 'lucide-vue-next'
import type { Component } from 'vue'
import { useComfyUISettings } from '../../composables/useComfyUISettings'
Expand Down Expand Up @@ -557,9 +558,15 @@ function actionIcon(id: string): Component {
}
}

const pinBottomMenuActions = computed<MenuAction[]>(() =>
pinBottomActions.value.map((action) => ({ ...action, icon: actionIcon(action.id) }))
)
const pinBottomMenuActions = computed<MenuAction[]>(() => {
const firstDanger = pinBottomActions.value.findIndex((action) => action.style === 'danger')
return pinBottomActions.value.map((action, index) => ({
...action,
icon: actionIcon(action.id),
style: action.id === 'untrack' || action.id === 'remove' ? undefined : action.style,
separator: index === firstDanger
}))
})

function handlePrimaryAction(): void {
const selectedInstall = installation.value
Expand Down Expand Up @@ -771,7 +778,10 @@ defineExpose({
:data-testid="TID.settingsTab(tab.key)"
@click="selectTab(tab.key)"
>
<span class="settings-v2-tab-icon-wrap relative inline-flex shrink-0 items-center">
<span
v-if="!isPage || (tab.key === 'update' && showUpdateBadge)"
class="settings-v2-tab-icon-wrap relative inline-flex shrink-0 items-center"
>
<component
:is="tab.icon"
v-if="!isPage"
Expand Down Expand Up @@ -1176,7 +1186,7 @@ defineExpose({
<div class="settings-v2-more-wrap relative inline-flex">
<Button
variant="secondary"
size="md"
:size="isPage ? 'icon' : 'md'"
type="button"
class="settings-v2-more"
data-more-trigger
Expand All @@ -1190,8 +1200,11 @@ defineExpose({
:data-testid="TID.pickerMoreTrigger"
@click="toggleMoreMenu"
>
{{ t('comfyUISettings.more') }}
<component :is="menuChevron" :size="14" />
<Ellipsis v-if="isPage" :size="16" aria-hidden="true" />
<template v-else>
{{ t('comfyUISettings.more') }}
<component :is="menuChevron" :size="14" />
</template>
</Button>
<MoreMenu
:open="moreMenuOpen"
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
48 changes: 25 additions & 23 deletions src/renderer/src/views/comfyUISettings/MoreMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
import { computed, onBeforeUnmount, onMounted, ref, watch, type Component } from 'vue'
import Menu from '@comfyorg/design-system/menu/Menu'
import MenuItem from '@comfyorg/design-system/menu/MenuItem'
import MenuSeparator from '@comfyorg/design-system/menu/MenuSeparator'
import { TID } from '../../../../shared/testIds'
import type { ActionDef } from '../../types/ipc'

export type MenuAction = ActionDef & { icon?: Component }
export type MenuAction = ActionDef & { icon?: Component; separator?: boolean }
const props = defineProps<{
open: boolean
actions: MenuAction[]
Expand Down Expand Up @@ -68,28 +69,29 @@ onBeforeUnmount(() => window.removeEventListener('blur', onWindowBlur))
@close-auto-focus="onCloseAutoFocus"
>
<template #trigger><span hidden aria-hidden="true" /></template>
<MenuItem
v-for="action in actions"
:key="action.id"
as="button"
type="button"
:disabled="action.enabled === false"
class="more-menu-item w-full justify-start text-left"
:class="{
'is-danger text-destructive': action.style === 'danger',
'is-disabled': action.enabled === false
}"
:data-testid="TID.pinBottomAction(action.id)"
@select="handlePick(action)"
>
<span
v-if="hasIcons"
class="more-menu-item-icon inline-flex size-4 shrink-0 items-center justify-center"
aria-hidden="true"
<template v-for="(action, index) in actions" :key="action.id">
<MenuSeparator v-if="action.separator && index > 0" />
<MenuItem
as="button"
type="button"
:disabled="action.enabled === false"
class="more-menu-item w-full justify-start text-left"
:class="{
'is-danger text-destructive': action.style === 'danger',
'is-disabled': action.enabled === false
}"
:data-testid="TID.pinBottomAction(action.id)"
@select="handlePick(action)"
>
<component :is="action.icon" v-if="action.icon" :size="15" />
</span>
<span class="more-menu-item-label flex-auto">{{ action.label }}</span>
</MenuItem>
<span
v-if="hasIcons"
class="more-menu-item-icon inline-flex size-4 shrink-0 items-center justify-center"
aria-hidden="true"
>
<component :is="action.icon" v-if="action.icon" :size="15" />
</span>
<span class="more-menu-item-label flex-auto">{{ action.label }}</span>
</MenuItem>
</template>
</Menu>
</template>
Loading