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"
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 >
2524</template >
2625
2726<script setup lang="ts">
27+ import { useLocalStorage } from ' @vueuse/core'
2828import Button from ' primevue/button'
29- import { onMounted , ref } from ' vue'
29+ import { computed } from ' vue'
3030
3131import { useSettingStore } from ' @/platform/settings/settingStore'
3232
3333const STORAGE_KEY = ' vueNodesBannerDismissed'
3434
3535const 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
5862const 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