Line data Source code
1 : <template>
2 2046 : <SidebarIcon
3 : icon="icon-[lucide--keyboard]"
4 : :label="$t('shortcuts.shortcuts')"
5 : :tooltip="tooltipText"
6 : :selected="isShortcutsPanelVisible"
7 : @click="toggleShortcutsPanel"
8 : />
9 : </template>
10 :
11 : <script setup lang="ts">
12 : import { computed } from 'vue'
13 : import { useI18n } from 'vue-i18n'
14 :
15 : import { useTelemetry } from '@comfyorg/telemetry'
16 : import { useCommandStore } from '@/platform/keybindings/commandStore'
17 : import { useBottomPanelStore } from '@/stores/workspace/bottomPanelStore'
18 :
19 : import SidebarIcon from './SidebarIcon.vue'
20 :
21 2014 : const { t } = useI18n()
22 2014 : const bottomPanelStore = useBottomPanelStore()
23 2014 : const commandStore = useCommandStore()
24 2014 : const command = commandStore.getCommand('Workspace.ToggleBottomPanel.Shortcuts')
25 2014 : const { formatKeySequence } = commandStore
26 :
27 2014 : const isShortcutsPanelVisible = computed(
28 : () => bottomPanelStore.activePanel === 'shortcuts'
29 : )
30 :
31 2014 : const tooltipText = computed(
32 : () => `${t('shortcuts.keyboardShortcuts')} (${formatKeySequence(command)})`
33 : )
34 :
35 : /**
36 : * Toggle keyboard shortcuts panel and track UI button click.
37 : */
38 2014 : const toggleShortcutsPanel = () => {
39 18 : useTelemetry()?.trackUiButtonClicked({
40 : button_id: 'sidebar_shortcuts_panel_toggled',
41 : element_group: 'sidebar'
42 : })
43 18 : bottomPanelStore.togglePanel('shortcuts')
44 : }
45 : </script>
|