Line data Source code
1 : <template>
2 2031 : <Tabs v-model="bottomPanelStore.activeBottomPanelTabId" class="h-full gap-0">
3 : <TabsList variant="panel" class="w-full shrink-0">
4 : <div class="flex w-full justify-between">
5 : <div class="tabs-container">
6 127 : <TabsTrigger
7 : v-for="tab in bottomPanelStore.bottomPanelTabs"
8 : :key="tab.id"
9 : :value="tab.id"
10 : variant="panel"
11 : :class="
12 : cn(
13 : bottomPanelStore.bottomPanelTabs.length === 1 &&
14 : 'pointer-events-none data-[state=active]:bg-transparent data-[state=active]:text-muted-foreground'
15 : )
16 : "
17 : >
18 : <span class="font-normal">
19 : {{ getTabDisplayTitle(tab) }}
20 : </span>
21 : </TabsTrigger>
22 : </div>
23 : <div class="flex items-center gap-2">
24 : <Button
25 : v-if="isShortcutsTabActive"
26 : variant="muted-textonly"
27 : size="sm"
28 : @click="openKeybindingSettings"
29 : >
30 : <i class="icon-[lucide--settings]" />
31 : {{ $t('shortcuts.manageShortcuts') }}
32 : </Button>
33 : <Button
34 : class="justify-self-end"
35 : variant="muted-textonly"
36 : size="sm"
37 : :aria-label="t('g.close')"
38 : @click="closeBottomPanel"
39 : >
40 : <i class="icon-[lucide--x]" />
41 : </Button>
42 : </div>
43 : </div>
44 : </TabsList>
45 : <template v-if="bottomPanelStore.bottomPanelVisible">
46 68 : <TabsContent
47 : v-for="tab in bottomPanelStore.bottomPanelTabs"
48 : :key="tab.id"
49 : :value="tab.id"
50 : class="h-0 grow"
51 : >
52 : <ExtensionSlot :extension="tab" />
53 : </TabsContent>
54 : </template>
55 : </Tabs>
56 : </template>
57 :
58 : <script setup lang="ts">
59 : import { computed } from 'vue'
60 : import { useI18n } from 'vue-i18n'
61 :
62 : import ExtensionSlot from '@/components/common/ExtensionSlot.vue'
63 : import Button from '@comfyorg/design-system/button/Button'
64 : import Tabs from '@comfyorg/design-system/tabs/Tabs'
65 : import TabsContent from '@comfyorg/design-system/tabs/TabsContent'
66 : import TabsList from '@comfyorg/design-system/tabs/TabsList'
67 : import TabsTrigger from '@comfyorg/design-system/tabs/TabsTrigger'
68 : import { useSettingsDialog } from '@/platform/settings/composables/useSettingsDialog'
69 : import { useBottomPanelStore } from '@/stores/workspace/bottomPanelStore'
70 : import type { BottomPanelExtension } from '@/types/extensionTypes'
71 : import { cn } from '@comfyorg/tailwind-utils'
72 :
73 1977 : const bottomPanelStore = useBottomPanelStore()
74 1977 : const settingsDialog = useSettingsDialog()
75 1977 : const { t } = useI18n()
76 :
77 1977 : const isShortcutsTabActive = computed(() => {
78 2031 : const activeTabId = bottomPanelStore.activeBottomPanelTabId
79 2031 : return (
80 : activeTabId === 'shortcuts-essentials' ||
81 : activeTabId === 'shortcuts-view-controls'
82 : )
83 : })
84 :
85 1977 : const shouldCapitalizeTab = (tabId: string): boolean => {
86 129 : return tabId !== 'shortcuts-essentials' && tabId !== 'shortcuts-view-controls'
87 : }
88 :
89 1977 : const getTabDisplayTitle = (tab: BottomPanelExtension): string => {
90 129 : const title = tab.titleKey ? t(tab.titleKey) : tab.title || ''
91 129 : return shouldCapitalizeTab(tab.id) ? title.toUpperCase() : title
92 : }
93 :
94 1977 : const openKeybindingSettings = async () => {
95 2 : settingsDialog.show('keybinding')
96 : }
97 :
98 1977 : const closeBottomPanel = () => {
99 2 : bottomPanelStore.activePanel = null
100 : }
101 : </script>
|