Skip to content

Commit efc7a8e

Browse files
committed
fix: PR feedback
1 parent 269a598 commit efc7a8e

File tree

2 files changed

+26
-25
lines changed

2 files changed

+26
-25
lines changed

src/components/graph/GraphCanvas.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
<!-- If load immediately, the top-level splitter stateKey won't be correctly
44
synced with the stateStorage (localStorage). -->
55
<LiteGraphCanvasSplitterOverlay v-if="comfyAppReady">
6-
<template v-if="showUI && workflowTabsPosition === 'Topbar'" #workflow-tabs>
6+
<template v-if="showUI" #workflow-tabs>
77
<TryVueNodeBanner />
88
<div
9+
v-if="workflowTabsPosition === 'Topbar'"
910
class="workflow-tabs-container pointer-events-auto relative h-9.5 w-full"
1011
>
1112
<!-- Native drag area for Electron -->
Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
<template>
22
<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"
3+
v-if="showVueNodesBanner"
4+
class="pointer-events-auto relative w-full h-10 bg-gradient-to-r from-blue-600 to-blue-700 flex items-center justify-center px-4"
55
>
6-
<div class="w-5 h-5"></div>
76
<div class="flex items-center">
87
<i class="icon-[lucide--sparkles]"></i>
9-
<h5 class="pl-2">{{ $t('vueNodesBanner.message') }}</h5>
8+
<span class="pl-2">{{ $t('vueNodesBanner.message') }}</span>
109
<Button
1110
class="cursor-pointer bg-transparent rounded h-7 px-3 border border-white text-white ml-4 text-xs"
1211
@click="handleTryItOut"
@@ -15,7 +14,7 @@
1514
</Button>
1615
</div>
1716
<Button
18-
class="cursor-pointer bg-transparent border-0 outline-0 grid place-items-center"
17+
class="cursor-pointer bg-transparent border-0 outline-0 grid place-items-center absolute right-4"
1918
unstyled
2019
@click="handleDismiss"
2120
>
@@ -25,34 +24,39 @@
2524
</template>
2625

2726
<script setup lang="ts">
27+
import { useLocalStorage } from '@vueuse/core'
2828
import Button from 'primevue/button'
29-
import { onMounted, ref } from 'vue'
29+
import { computed } from 'vue'
3030
3131
import { useSettingStore } from '@/platform/settings/settingStore'
3232
3333
const STORAGE_KEY = 'vueNodesBannerDismissed'
3434
3535
const settingStore = useSettingStore()
36-
const showVueNodesBannerRef = ref(false)
36+
const bannerDismissed = useLocalStorage(STORAGE_KEY, false)
3737
38-
const checkLocalStorage = (): boolean => {
38+
const vueNodesEnabled = computed(() => {
3939
try {
40-
const value = localStorage.getItem(STORAGE_KEY)
40+
return settingStore.get('Comfy.VueNodes.Enabled') ?? false
41+
} catch {
42+
return false
43+
}
44+
})
4145
42-
return value !== 'true'
43-
} catch (error) {
44-
console.warn('localStorage not available:', error)
45-
return true
46+
const showVueNodesBanner = computed(() => {
47+
if (vueNodesEnabled.value) {
48+
return false
4649
}
47-
}
4850
49-
const handleDismiss = (): void => {
50-
showVueNodesBannerRef.value = false
51-
try {
52-
localStorage.setItem(STORAGE_KEY, 'true')
53-
} catch (error) {
54-
console.warn('Failed to save banner dismissal:', error)
51+
if (bannerDismissed.value) {
52+
return false
5553
}
54+
55+
return true
56+
})
57+
58+
const handleDismiss = (): void => {
59+
bannerDismissed.value = true
5660
}
5761
5862
const handleTryItOut = async (): Promise<void> => {
@@ -64,8 +68,4 @@ const handleTryItOut = async (): Promise<void> => {
6468
handleDismiss()
6569
}
6670
}
67-
68-
onMounted(() => {
69-
showVueNodesBannerRef.value = checkLocalStorage()
70-
})
7171
</script>

0 commit comments

Comments
 (0)