Line data Source code
1 : <template>
2 2103 : <div v-coachmark="FIRST_RUN_COACH_IDS.templatesButton" class="flex">
3 : <SidebarIcon
4 : icon="icon-[comfy--template]"
5 : :tooltip="$t('sideToolbar.templates')"
6 : :label="$t('sideToolbar.labels.templates')"
7 : :is-small="isSmall"
8 : class="templates-tab-button"
9 : @click="openTemplates"
10 : />
11 : </div>
12 : </template>
13 :
14 : <script setup lang="ts">
15 : import { computed } from 'vue'
16 :
17 : import { useWorkflowTemplateSelectorDialog } from '@/platform/workflow/templates/composables/useWorkflowTemplateSelectorDialog'
18 : import { FIRST_RUN_COACH_IDS } from '@/platform/onboarding/onboardingTours'
19 : import { vCoachmark } from '@/platform/onboarding/vCoachmark'
20 : import { useSettingStore } from '@/platform/settings/settingStore'
21 : import { useTelemetry } from '@comfyorg/telemetry'
22 :
23 : import SidebarIcon from './SidebarIcon.vue'
24 :
25 2093 : const settingStore = useSettingStore()
26 :
27 2093 : const isSmall = computed(
28 : () => settingStore.get('Comfy.Sidebar.Size') === 'small'
29 : )
30 :
31 : /**
32 : * Open templates dialog from sidebar and track UI button click.
33 : */
34 2093 : const openTemplates = () => {
35 0 : useTelemetry()?.trackUiButtonClicked({
36 : button_id: 'sidebar_templates_dialog_opened',
37 : element_group: 'sidebar'
38 : })
39 0 : useWorkflowTemplateSelectorDialog().show('sidebar')
40 : }
41 : </script>
|