Fazbeeer commited on
Commit
e2e78b8
·
verified ·
1 Parent(s): 0b2ed74

What you want (clearly stated)

Browse files

Chat/helper is closed when the page loads

Only opens when the user clicks a button in the bottom-left corner

You can copy-paste the fix or tell DeepSite exactly what to change.

Files changed (2) hide show
  1. components/faq-chat.js +59 -20
  2. script.js +14 -3
components/faq-chat.js CHANGED
@@ -57,27 +57,61 @@ class FAQChat extends HTMLElement {
57
 
58
  this.render();
59
  }
60
-
61
- render() {
62
  this.shadowRoot.innerHTML = `
63
  <style>
64
- :host {
65
- display: block;
66
  position: fixed;
67
  bottom: 20px;
68
  right: 20px;
69
- width: 350px;
70
- height: 500px;
71
- background: linear-gradient(135deg, #1a1a1a 0%, #000000 100%);
72
- border-radius: 15px;
73
- border: 1px solid #e3b341;
74
- box-shadow: 0 5px 20px rgba(0,0,0,0.3);
75
- overflow: hidden;
76
- z-index: 1000;
77
- font-family: 'Montserrat', sans-serif;
78
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
 
80
- .chat-container {
 
 
 
 
 
81
  display: flex;
82
  flex-direction: column;
83
  height: 100%;
@@ -186,9 +220,11 @@ class FAQChat extends HTMLElement {
186
  30% { transform: translateY(-5px); }
187
  }
188
  </style>
189
-
 
 
190
  <div class="chat-container">
191
- <div class="chat-header">
192
  <i data-feather="message-square"></i>
193
  Amplify FAQ Helper
194
  <button class="close-btn" id="close-chat">×</button>
@@ -257,12 +293,15 @@ class FAQChat extends HTMLElement {
257
  }, 1000);
258
  }
259
  }
260
-
261
- setupEventListeners() {
 
 
 
262
  this.shadowRoot.getElementById('close-chat').addEventListener('click', () => {
263
- this.style.display = 'none';
264
  });
265
- }
266
  }
267
 
268
  customElements.define('faq-chat', FAQChat);
 
57
 
58
  this.render();
59
  }
60
+ render() {
 
61
  this.shadowRoot.innerHTML = `
62
  <style>
63
+ .chat-toggle-container {
 
64
  position: fixed;
65
  bottom: 20px;
66
  right: 20px;
67
+ z-index: 1001;
 
 
 
 
 
 
 
 
68
  }
69
+ :host {
70
+ display: block;
71
+ position: fixed;
72
+ bottom: 20px;
73
+ right: -400px;
74
+ width: 350px;
75
+ height: 500px;
76
+ background: linear-gradient(135deg, #1a1a1a 0%, #000000 100%);
77
+ border-radius: 15px;
78
+ border: 1px solid #e3b341;
79
+ box-shadow: 0 5px 20px rgba(0,0,0,0.3);
80
+ overflow: hidden;
81
+ z-index: 1000;
82
+ font-family: 'Montserrat', sans-serif;
83
+ transition: right 0.3s ease;
84
+ }
85
+
86
+ :host(.open) {
87
+ right: 20px;
88
+ }
89
+
90
+ .chat-toggle-btn {
91
+ position: fixed;
92
+ bottom: 20px;
93
+ right: 20px;
94
+ width: 60px;
95
+ height: 60px;
96
+ background: linear-gradient(135deg, #1a1a1a 0%, #000000 100%);
97
+ border-radius: 50%;
98
+ border: 1px solid #e3b341;
99
+ color: #e3b341;
100
+ display: flex;
101
+ align-items: center;
102
+ justify-content: center;
103
+ cursor: pointer;
104
+ z-index: 999;
105
+ box-shadow: 0 2px 10px rgba(0,0,0,0.2);
106
+ transition: all 0.3s ease;
107
+ }
108
 
109
+ .chat-toggle-btn:hover {
110
+ transform: scale(1.1);
111
+ background: #e3b341;
112
+ color: #000;
113
+ }
114
+ .chat-container {
115
  display: flex;
116
  flex-direction: column;
117
  height: 100%;
 
220
  30% { transform: translateY(-5px); }
221
  }
222
  </style>
223
+ <div class="chat-toggle-btn" id="chat-toggle">
224
+ <i data-feather="message-square"></i>
225
+ </div>
226
  <div class="chat-container">
227
+ <div class="chat-header">
228
  <i data-feather="message-square"></i>
229
  Amplify FAQ Helper
230
  <button class="close-btn" id="close-chat">×</button>
 
293
  }, 1000);
294
  }
295
  }
296
+ setupEventListeners() {
297
+ this.shadowRoot.getElementById('chat-toggle').addEventListener('click', () => {
298
+ this.classList.toggle('open');
299
+ });
300
+
301
  this.shadowRoot.getElementById('close-chat').addEventListener('click', () => {
302
+ this.classList.remove('open');
303
  });
304
+ }
305
  }
306
 
307
  customElements.define('faq-chat', FAQChat);
script.js CHANGED
@@ -137,9 +137,20 @@ const loadTranslateStyles = () => {
137
  clearInterval(translateInterval);
138
  }
139
  }, 100);
140
- // Create Christmas elements
141
- function createChristmasElements() {
142
- // Create snowflakes container
 
 
 
 
 
 
 
 
 
 
 
143
  const snowContainer = document.createElement('div');
144
  snowContainer.style.position = 'fixed';
145
  snowContainer.style.top = '0';
 
137
  clearInterval(translateInterval);
138
  }
139
  }, 100);
140
+ // Initialize FAQ chat
141
+ function initFaqChat() {
142
+ if (!document.querySelector('faq-chat')) {
143
+ const faqChat = document.createElement('faq-chat');
144
+ document.body.appendChild(faqChat);
145
+ }
146
+ }
147
+
148
+ document.addEventListener('DOMContentLoaded', () => {
149
+ initFaqChat();
150
+
151
+ // Create Christmas elements
152
+ function createChristmasElements() {
153
+ // Create snowflakes container
154
  const snowContainer = document.createElement('div');
155
  snowContainer.style.position = 'fixed';
156
  snowContainer.style.top = '0';