diff --git a/src/components/bottomPanel/BottomPanel.vue b/src/components/bottomPanel/BottomPanel.vue index 188314d15..8e5e04a83 100644 --- a/src/components/bottomPanel/BottomPanel.vue +++ b/src/components/bottomPanel/BottomPanel.vue @@ -1,34 +1,42 @@ diff --git a/src/hooks/bottomPanelTabs/integratedTerminalTab.ts b/src/hooks/bottomPanelTabs/integratedTerminalTab.ts new file mode 100644 index 000000000..7c92da551 --- /dev/null +++ b/src/hooks/bottomPanelTabs/integratedTerminalTab.ts @@ -0,0 +1,14 @@ +import { useI18n } from 'vue-i18n' +import { markRaw } from 'vue' +import IntegratedTerminal from '@/components/bottomPanel/tabs/IntegratedTerminal.vue' +import { BottomPanelExtension } from '@/types/extensionTypes' + +export const useIntegratedTerminalTab = (): BottomPanelExtension => { + const { t } = useI18n() + return { + id: 'integrated-terminal', + title: t('terminal'), + component: markRaw(IntegratedTerminal), + type: 'vue' + } +} diff --git a/src/i18n.ts b/src/i18n.ts index d0d7cff20..989fe6c8e 100644 --- a/src/i18n.ts +++ b/src/i18n.ts @@ -2,6 +2,7 @@ import { createI18n } from 'vue-i18n' const messages = { en: { + terminal: 'Terminal', videoFailedToLoad: 'Video failed to load', extensionName: 'Extension Name', reloadToApplyChanges: 'Reload to apply changes', @@ -113,6 +114,7 @@ const messages = { } }, zh: { + terminal: '终端', videoFailedToLoad: '视频加载失败', extensionName: '扩展名称', reloadToApplyChanges: '重新加载以应用更改', @@ -223,6 +225,7 @@ const messages = { } }, ru: { + terminal: 'Терминал', videoFailedToLoad: 'Видео не удалось загрузить', extensionName: 'Название расширения', reloadToApplyChanges: 'Перезагрузите, чтобы применить изменения', diff --git a/src/stores/coreKeybindings.ts b/src/stores/coreKeybindings.ts index aec19029f..77dd4db77 100644 --- a/src/stores/coreKeybindings.ts +++ b/src/stores/coreKeybindings.ts @@ -160,5 +160,12 @@ export const CORE_KEYBINDINGS: Keybinding[] = [ }, commandId: 'Comfy.Canvas.ToggleSelectedNodes.Mute', targetSelector: '#graph-canvas' + }, + { + combo: { + key: '`', + ctrl: true + }, + commandId: 'Workspace.ToggleBottomPanelTab.integrated-terminal' } ] diff --git a/src/stores/workspace/bottomPanelStore.ts b/src/stores/workspace/bottomPanelStore.ts index a308b2523..08acaa2ca 100644 --- a/src/stores/workspace/bottomPanelStore.ts +++ b/src/stores/workspace/bottomPanelStore.ts @@ -2,6 +2,7 @@ import type { BottomPanelExtension } from '@/types/extensionTypes' import { defineStore } from 'pinia' import { computed, ref } from 'vue' import { useCommandStore } from '@/stores/commandStore' +import { useIntegratedTerminalTab } from '@/hooks/bottomPanelTabs/integratedTerminalTab' export const useBottomPanelStore = defineStore('bottomPanel', () => { const bottomPanelVisible = ref(false) @@ -26,7 +27,7 @@ export const useBottomPanelStore = defineStore('bottomPanel', () => { activeBottomPanelTabId.value = tabId } const toggleBottomPanelTab = (tabId: string) => { - if (activeBottomPanelTabId.value === tabId) { + if (activeBottomPanelTabId.value === tabId && bottomPanelVisible.value) { bottomPanelVisible.value = false } else { activeBottomPanelTabId.value = tabId @@ -46,6 +47,10 @@ export const useBottomPanelStore = defineStore('bottomPanel', () => { }) } + const registerCoreBottomPanelTabs = () => { + registerBottomPanelTab(useIntegratedTerminalTab()) + } + return { bottomPanelVisible, toggleBottomPanel, @@ -54,6 +59,7 @@ export const useBottomPanelStore = defineStore('bottomPanel', () => { activeBottomPanelTabId, setActiveTab, toggleBottomPanelTab, - registerBottomPanelTab + registerBottomPanelTab, + registerCoreBottomPanelTabs } }) diff --git a/src/views/GraphView.vue b/src/views/GraphView.vue index 850c82054..2d592dd1a 100644 --- a/src/views/GraphView.vue +++ b/src/views/GraphView.vue @@ -36,6 +36,7 @@ import { useKeybindingStore } from '@/stores/keybindingStore' import { useSidebarTabStore } from '@/stores/workspace/sidebarTabStore' import { useNodeBookmarkStore } from '@/stores/nodeBookmarkStore' import { useNodeDefStore, useNodeFrequencyStore } from '@/stores/nodeDefStore' +import { useBottomPanelStore } from '@/stores/workspace/bottomPanelStore' setupAutoQueueHandler() @@ -97,6 +98,7 @@ const init = () => { settingStore.addSettings(app.ui.settings) useKeybindingStore().loadCoreKeybindings() useSidebarTabStore().registerCoreSidebarTabs() + useBottomPanelStore().registerCoreBottomPanelTabs() app.extensionManager = useWorkspaceStore() } diff --git a/tests-ui/globalSetup.ts b/tests-ui/globalSetup.ts index b2296df33..a2bf9d888 100644 --- a/tests-ui/globalSetup.ts +++ b/tests-ui/globalSetup.ts @@ -54,6 +54,12 @@ module.exports = async function () { } }) + jest.mock('@/stores/workspace/bottomPanelStore', () => { + return { + toggleBottomPanel: jest.fn() + } + }) + jest.mock('vue-i18n', () => { return { useI18n: jest.fn()