Line data Source code
1 16 : <template>
2 18 : <div
3 : data-testid="publish-finish-step"
4 : class="flex min-h-0 flex-1 flex-col gap-8 px-6 py-4"
5 : >
6 : <section class="flex flex-col gap-4">
7 : <span class="text-sm text-foreground">
8 : {{ $t('comfyHubPublish.shareAs') }}
9 : </span>
10 :
11 : <div class="flex items-center gap-4 rounded-2xl bg-secondary px-6 py-4">
12 : <div
13 : class="flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-full bg-linear-to-b from-green-600/50 to-green-900"
14 : >
15 : <img
16 : v-if="profile.profilePictureUrl"
17 : :src="profile.profilePictureUrl"
18 : :alt="profile.username"
19 : class="size-full rounded-full object-cover"
20 : />
21 : <span v-else class="text-base text-white">
22 : {{ (profile.name ?? profile.username).charAt(0).toUpperCase() }}
23 : </span>
24 : </div>
25 : <div class="flex flex-1 flex-col gap-2 text-sm">
26 : <span class="text-foreground">
27 : {{ profile.name ?? profile.username }}
28 : </span>
29 : <span class="text-muted-foreground"> @{{ profile.username }} </span>
30 : </div>
31 : </div>
32 : </section>
33 :
34 : <section
35 : v-if="isLoadingAssets || hasPrivateAssets"
36 : class="flex flex-col gap-4"
37 : >
38 : <span class="text-sm text-foreground">
39 : {{ $t('comfyHubPublish.additionalInfo') }}
40 : </span>
41 :
42 : <p
43 : v-if="isLoadingAssets"
44 : class="m-0 text-sm text-muted-foreground italic"
45 : >
46 : {{ $t('shareWorkflow.checkingAssets') }}
47 : </p>
48 : <ShareAssetWarningBox
49 : v-else
50 : v-model:acknowledged="acknowledged"
51 : :items="privateAssets"
52 : />
53 : </section>
54 : </div>
55 : </template>
56 :
57 : <script setup lang="ts">
58 : import { useAsyncState } from '@vueuse/core'
59 : import { computed, watch } from 'vue'
60 :
61 : import type { ComfyHubProfile } from '@/platform/workflow/sharing/schemas/shareSchemas'
62 : import ShareAssetWarningBox from '@/platform/workflow/sharing/components/ShareAssetWarningBox.vue'
63 : import { useWorkflowShareService } from '@/platform/workflow/sharing/services/workflowShareService'
64 :
65 : const { profile } = defineProps<{
66 : profile: ComfyHubProfile
67 : }>()
68 :
69 8 : const acknowledged = defineModel<boolean>('acknowledged', { default: false })
70 8 : const ready = defineModel<boolean>('ready', { default: false })
71 :
72 8 : const shareService = useWorkflowShareService()
73 :
74 8 : const {
75 : state: privateAssets,
76 : isLoading: isLoadingAssets,
77 : error: privateAssetsError
78 : } = useAsyncState(() => shareService.getShareableAssets(), [])
79 :
80 8 : const hasPrivateAssets = computed(() => privateAssets.value.length > 0)
81 8 : const isReady = computed(
82 : () =>
83 : !isLoadingAssets.value &&
84 : !privateAssetsError.value &&
85 : (!hasPrivateAssets.value || acknowledged.value)
86 : )
87 :
88 8 : watch(
89 : isReady,
90 : (val) => {
91 16 : ready.value = val
92 : },
93 : { immediate: true }
94 : )
95 : </script>
|