Show sidebar toggle keybinding shortcut on sidebar icon tooltip (#1160)

This commit is contained in:
Chenlei Hu
2024-10-07 21:44:38 -04:00
committed by GitHub
parent 58dd15a662
commit 5ba1d1a3f7
2 changed files with 11 additions and 2 deletions

View File

@@ -6,7 +6,7 @@
:key="tab.id"
:icon="tab.icon"
:iconBadge="tab.iconBadge"
:tooltip="tab.tooltip"
:tooltip="tab.tooltip + getTabTooltipSuffix(tab)"
:selected="tab.id === selectedTab?.id"
:class="tab.id + '-tab-button'"
@click="onTabClick(tab)"
@@ -45,6 +45,7 @@ import {
CustomSidebarTabExtension,
SidebarTabExtension
} from '@/types/extensionTypes'
import { useKeybindingStore } from '@/stores/keybindingStore'
const workspaceStore = useWorkspaceStore()
const settingStore = useSettingStore()
@@ -74,6 +75,14 @@ onBeforeUnmount(() => {
}
})
})
const keybindingStore = useKeybindingStore()
const getTabTooltipSuffix = (tab: SidebarTabExtension) => {
const keybinding = keybindingStore.getKeybindingByCommandId(
`Workspace.ToggleSidebarTab.${tab.id}`
)
return keybinding ? ` (${keybinding.combo.toString()})` : ''
}
</script>
<style>

View File

@@ -5,7 +5,7 @@ import { useWorkflowsSidebarTab } from '@/hooks/sidebarTabs/workflowsSidebarTab'
import { SidebarTabExtension } from '@/types/extensionTypes'
import { defineStore } from 'pinia'
import { computed, ref } from 'vue'
import { useCommandStore } from '../commandStore'
import { useCommandStore } from '@/stores/commandStore'
export const useSidebarTabStore = defineStore('sidebarTab', () => {
const sidebarTabs = ref<SidebarTabExtension[]>([])