Skip to content

Commit e93d5e4

Browse files
committed
feat: first cut of vue nodes try it now banner
1 parent 06ba106 commit e93d5e4

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

src/components/graph/GraphCanvas.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
synced with the stateStorage (localStorage). -->
55
<LiteGraphCanvasSplitterOverlay v-if="comfyAppReady">
66
<template v-if="showUI && workflowTabsPosition === 'Topbar'" #workflow-tabs>
7+
<TryVueNodeBanner />
78
<div
89
class="workflow-tabs-container pointer-events-auto relative h-9.5 w-full"
910
>
@@ -152,6 +153,8 @@ import { useSearchBoxStore } from '@/stores/workspace/searchBoxStore'
152153
import { useWorkspaceStore } from '@/stores/workspaceStore'
153154
import { isNativeWindow } from '@/utils/envUtil'
154155
156+
import TryVueNodeBanner from '../topbar/TryVueNodeBanner.vue'
157+
155158
const emit = defineEmits<{
156159
ready: []
157160
}>()
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<template>
2+
<div
3+
v-if="showVueNodesBannerRef"
4+
class="pointer-events-auto w-full h-10 bg-gradient-to-r from-blue-600 to-blue-700 flex items-center justify-between px-4"
5+
>
6+
<div class="w-5 h-5"></div>
7+
<div class="flex items-center">
8+
<i class="icon-[lucide--sparkles]"></i>
9+
<h5 class="pl-2">{{ $t('vueNodesBanner.message') }}</h5>
10+
<Button
11+
class="cursor-pointer bg-transparent rounded h-7 px-3 border border-white text-white ml-4 text-xs"
12+
@click="handleTryItOut"
13+
>
14+
{{ $t('vueNodesBanner.tryItOut') }}
15+
</Button>
16+
</div>
17+
<Button
18+
class="cursor-pointer bg-transparent border-0 outline-0 grid place-items-center"
19+
unstyled
20+
@click="handleDismiss"
21+
>
22+
<i class="w-5 h-5 icon-[lucide--x]"></i>
23+
</Button>
24+
</div>
25+
</template>
26+
27+
<script setup lang="ts">
28+
import Button from 'primevue/button'
29+
import { onMounted, ref } from 'vue'
30+
31+
import { useSettingStore } from '@/platform/settings/settingStore'
32+
33+
const STORAGE_KEY = 'vueNodesBannerDismissed'
34+
35+
const settingStore = useSettingStore()
36+
const showVueNodesBannerRef = ref(false)
37+
38+
const checkLocalStorage = (): boolean => {
39+
try {
40+
const value = localStorage.getItem(STORAGE_KEY)
41+
// Return true if the banner was NOT dismissed (value is null or 'false')
42+
return value !== 'true'
43+
} catch (error) {
44+
// If localStorage is not available (e.g., private browsing), show the banner
45+
console.warn('localStorage not available:', error)
46+
return true
47+
}
48+
}
49+
50+
const handleDismiss = (): void => {
51+
showVueNodesBannerRef.value = false
52+
try {
53+
localStorage.setItem(STORAGE_KEY, 'true')
54+
} catch (error) {
55+
// Silently fail if localStorage is not available
56+
console.warn('Failed to save banner dismissal:', error)
57+
}
58+
}
59+
60+
const handleTryItOut = async (): Promise<void> => {
61+
try {
62+
await settingStore.set('Comfy.VueNodes.Enabled', true)
63+
} catch (error) {
64+
console.error('Failed to enable Vue nodes:', error)
65+
} finally {
66+
handleDismiss()
67+
}
68+
}
69+
70+
onMounted(() => {
71+
showVueNodesBannerRef.value = checkLocalStorage()
72+
})
73+
</script>

0 commit comments

Comments
 (0)