Line data Source code
1 : <template>
2 1966 : <TreeExplorerTreeNode :node="node">
3 : <template #actions>
4 : <Button
5 : variant="muted-textonly"
6 : size="icon-sm"
7 : :aria-label="$t('icon.bookmark')"
8 : @click.stop="handleBookmarkClick"
9 : >
10 : <i
11 : :class="
12 : cn(
13 : isBookmarked ? 'pi pi-bookmark-fill' : 'pi pi-bookmark',
14 : 'size-3.5'
15 : )
16 : "
17 : />
18 : </Button>
19 : </template>
20 : </TreeExplorerTreeNode>
21 : </template>
22 :
23 : <script setup lang="ts">
24 : import { cn } from '@comfyorg/tailwind-utils'
25 : import { computed } from 'vue'
26 :
27 : import TreeExplorerTreeNode from '@/components/common/TreeExplorerTreeNode.vue'
28 : import Button from '@comfyorg/design-system/button/Button'
29 : import type { ComfyWorkflow } from '@/platform/workflow/management/stores/workflowStore'
30 : import { useWorkflowBookmarkStore } from '@/platform/workflow/management/stores/workflowStore'
31 : import type { RenderedTreeExplorerNode } from '@/types/treeExplorerTypes'
32 :
33 : const { node } = defineProps<{
34 : node: RenderedTreeExplorerNode<ComfyWorkflow>
35 : }>()
36 :
37 165 : const workflowBookmarkStore = useWorkflowBookmarkStore()
38 165 : const isBookmarked = computed(
39 : () => node.data && workflowBookmarkStore.isBookmarked(node.data.path)
40 : )
41 :
42 165 : const handleBookmarkClick = async () => {
43 0 : if (node.data) {
44 0 : await workflowBookmarkStore.toggleBookmarked(node.data.path)
45 : }
46 : }
47 : </script>
|