29
29
</svg >
30
30
</button >
31
31
32
- <div v-if =" !showChat " class =" highlight-container" >
32
+ <div v-if =" shouldShowTooltip " class =" highlight-container" >
33
33
<div class =" tooltip-text" >
34
+ <div class =" tooltip-close" @click =" dismissTooltip" >×</div >
34
35
<div class =" tooltip-title" ><b >Need help?</b ></div >
35
36
<div class =" tooltip-subtitle" >I'm an AI chatbot, trained to answer all your questions.</div >
36
37
</div >
@@ -85,30 +86,63 @@ export default {
85
86
isLoading: true ,
86
87
iframeUrl: " https://chatbot.cloudlinux.com/docs/imunify360" ,
87
88
windowWidth: 0 , // Changed from window.innerWidth to avoid SSR error
89
+ showTooltip: true ,
90
+ tooltipDismissDuration: 2 * 60 * 60 * 1000 , // 2 hours in milliseconds
88
91
};
89
92
},
90
93
computed: {
91
94
isMobile () {
92
95
return this .windowWidth < 768 ;
93
96
},
97
+ shouldShowTooltip () {
98
+ return ! this .showChat && this .showTooltip ;
99
+ },
94
100
},
95
101
mounted () {
96
102
window .addEventListener (" resize" , this .handleResize );
97
103
this .handleResize (); // Set initial windowWidth on client-side
104
+ this .updateTooltipVisibility (); // Check tooltip dismissal state on mount
98
105
},
99
106
beforeUnmount () {
100
107
window .removeEventListener (" resize" , this .handleResize );
101
108
},
102
109
methods: {
103
110
toggleChat () {
104
111
this .showChat = ! this .showChat ;
112
+ // If chat is opened, dismiss the tooltip for the set duration
113
+ if (this .showChat ) {
114
+ this .dismissTooltip ();
115
+ }
105
116
},
106
117
handleResize () {
107
118
this .windowWidth = window .innerWidth ;
108
119
},
109
120
onIframeLoad () {
110
121
this .isLoading = false ;
111
122
},
123
+ updateTooltipVisibility () {
124
+ const dismissedTime = localStorage .getItem (' imdocs_chatbot_tooltip_dismissed_time' );
125
+ let shouldBeDismissed = false ;
126
+
127
+ if (dismissedTime) {
128
+ const currentTime = new Date ().getTime ();
129
+ // Check if the dismissal duration has passed
130
+ if (currentTime - parseInt (dismissedTime) < this .tooltipDismissDuration ) {
131
+ shouldBeDismissed = true ;
132
+ } else {
133
+ // If duration passed, clear the dismissal time so it can show again
134
+ localStorage .removeItem (' imdocs_chatbot_tooltip_dismissed_time' );
135
+ }
136
+ }
137
+
138
+ // Update tooltip visibility based on dismissal state
139
+ this .showTooltip = ! shouldBeDismissed;
140
+ },
141
+ dismissTooltip () {
142
+ const currentTime = new Date ().getTime ();
143
+ localStorage .setItem (' imdocs_chatbot_tooltip_dismissed_time' , currentTime .toString ());
144
+ this .updateTooltipVisibility ();
145
+ },
112
146
},
113
147
};
114
148
</script >
@@ -188,7 +222,7 @@ mobile-breakpoint = 768px
188
222
display : flex ;
189
223
flex-direction : column ;
190
224
align-items : flex-end ;
191
- pointer-events : none ;
225
+ pointer-events : auto ;
192
226
z-index : 10001 ;
193
227
max-width : 90vw ;
194
228
}
@@ -206,14 +240,51 @@ mobile-breakpoint = 768px
206
240
box-shadow : 0 0 15px $primary-color ;
207
241
overflow : visible ;
208
242
text-overflow : clip ;
243
+
244
+ /* Stop tooltip animation on hover */
245
+ & :hover {
246
+ animation-play-state : paused ;
247
+ }
248
+ }
249
+
250
+ .tooltip-close {
251
+ position : absolute ;
252
+ top : - 8px ;
253
+ right : - 8px ;
254
+ width : 20px ;
255
+ height : 20px ;
256
+ background : white ;
257
+ border : 1px solid #d d d ;
258
+ border-radius : 50% ;
259
+ display : flex ;
260
+ align-items : center ;
261
+ justify-content : center ;
262
+ cursor : pointer ;
263
+ font-size : 14px ;
264
+ line-height : 1 ;
265
+ color : #6 6 6 ;
266
+ transition : all 0.2s ease ;
267
+ box-shadow : 0 2px 4px rgba (0 ,0 ,0 ,0.1 );
268
+ z-index : 10 ;
269
+ pointer-events : auto ;
270
+
271
+ & :hover {
272
+ background : #f5 f5 f5 ;
273
+ transform : scale (1.1 );
274
+ color : #3 3 3 ;
275
+ }
209
276
}
210
277
211
278
.tooltip-title {
212
279
margin-bottom : 4px ;
280
+ position : relative ;
281
+ z-index : 2 ;
213
282
}
214
283
215
284
.tooltip-subtitle {
216
285
white-space : nowrap ;
286
+ position : relative ;
287
+ z-index : 2 ;
217
288
}
218
289
219
290
.chat-container {
0 commit comments