Hamed744 commited on
Commit
d83e3c4
·
verified ·
1 Parent(s): 7801221

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +226 -125
index.html CHANGED
@@ -3,133 +3,207 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
6
- <title>هوشان - آیکون تعویض دوربین و رفع نوتیفیکیشن</title>
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <style>
9
- /* ... (All CSS variables and base styles from the previous correct version remain the same) ... */
10
  @custom-variant dark (&:is(.dark *));
11
- @theme inline { /* ... */ }
12
- :root { /* ... */ }
13
- .dark { /* ... */ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  @layer base {
15
  * { @apply border-border outline-ring/50; }
16
  body { @apply bg-background text-foreground; overflow-x: hidden; }
17
  }
18
 
19
- /* Notification Popover Wrapper & Content (Mostly same, adjusted animation start) */
20
- .notification-popover-wrapper { /* ... */
21
- position: fixed; top: 1rem; left: 50%; transform: translateX(-50%);
22
- z-index: 100; width: calc(100% - 2rem); max-width: 28rem;
23
- display: flex; justify-content: center; pointer-events: none;
 
 
 
 
 
 
 
24
  }
25
- .popover-content { /* ... */
26
- width: 100%; border-radius: var(--radius-md, 0.5rem); border-width: 1px;
27
- border-color: var(--border); background-color: var(--popover);
 
 
 
 
28
  color: var(--popover-foreground);
29
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
30
- outline: none; transition: opacity 0.3s ease-out, transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
31
- opacity: 0; transform: translateY(-100%) scale(0.9);
32
- pointer-events: none; /* Initially hidden and non-interactive */
33
- }
34
- .popover-content.hidden-initial { /* New class for initial hidden state without animation */
35
- display: none;
36
  opacity: 0;
37
- transform: translateY(-100%) scale(0.9);
 
 
38
  }
 
39
  .popover-content.open {
40
- display: block; /* Ensure it's visible when open */
41
- opacity: 1; transform: translateY(0) scale(1); pointer-events: auto;
 
 
 
 
 
 
 
 
 
 
42
  }
43
- .notification-popover-text-content { /* ... */
44
- background-color: #eff6ff; font-size: 0.875rem; line-height: 1.5rem;
45
- direction: rtl; padding: 1rem; border-radius: inherit;
46
  }
47
 
48
- /* Header controls (same) */
49
- .header-controls { /* ... */ }
50
- .header-button { /* ... */
51
- display: flex; align-items: center; justify-content: center;
52
- padding: 0.5rem; border-radius: var(--radius-lg, 0.625rem);
53
- background-color: #e5e7eb; cursor: pointer;
 
 
 
 
 
54
  }
55
- .header-button svg { opacity: 0.5; }
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
  @keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } }
59
  .animate-ping { animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite; }
60
 
61
- #large-logo-container.flex { /* ... */ }
62
- #small-logo-container.flex { /* ... */ }
63
 
64
- /* Footer Controls and Camera Switch Icon */
65
- .footer-controls { /* ... */
66
  width: 100%; display: flex; gap: 1rem; position: absolute;
67
- bottom: 0; padding: 2rem 3rem; align-items: center;
68
  }
69
  .footer-controls.layout-default { justify-content: space-between; }
70
  .footer-controls.layout-with-small-logo { justify-content: space-around; }
71
 
72
- .control-button-wrapper { /* Wrapper for camera button and its switch icon */
73
- position: relative;
74
- display: flex; /* Aligns button within wrapper */
75
- align-items: center;
76
- justify-content: center;
77
- }
78
- .camera-switch-icon {
79
- position: absolute;
80
- top: -35px; /* Adjust as needed to position above the camera button */
81
- left: 50%;
82
- transform: translateX(-50%);
83
- background-color: rgba(255, 255, 255, 0.8); /* Semi-transparent white background */
84
- border-radius: 50%;
85
- padding: 8px;
86
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
87
- cursor: pointer;
88
- z-index: 5;
89
- transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
90
- opacity: 0;
91
- transform: translateX(-50%) scale(0.8);
92
- pointer-events: none;
93
- }
94
- .camera-switch-icon.visible {
95
- opacity: 1;
96
- transform: translateX(-50%) scale(1);
97
- pointer-events: auto;
98
- }
99
- .control-button { /* ... */
100
  height: 80px; width: 80px; border-radius: 9999px;
101
  padding: 0; display: flex; align-items: center; justify-content: center;
102
- border-width: 1px;
103
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
104
  cursor: pointer;
 
 
 
 
105
  }
106
  .cam-button-color { background-color: #E0ECFF; }
107
  .mic-button-color { background-color: #fecdd3; }
108
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  </style>
110
  <script>
111
  tailwind.config = {
112
  darkMode: 'class',
113
  theme: {
114
  extend: {
115
- colors: { /* ... */ }, borderRadius: { /* ... */ }, inset: { /* ... */ },
 
 
116
  keyframes: {
117
- 'popover-drop-in': { /* ... */ }, 'popover-lift-out': { /* ... */ }
 
 
 
 
 
 
 
118
  },
119
  animation: {
120
- 'popover-open-top-center': 'popover-drop-in 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards',
121
- 'popover-close-top-center': 'popover-lift-out 0.3s ease-in forwards',
122
  }
123
  }
124
  }
125
  }
126
  </script>
127
  </head>
128
- <body class="antialiased bg-slate-50">
129
 
130
  <div class="w-full flex flex-col items-center justify-center min-h-[90dvh] md:min-h-screen">
131
  <div class="max-w-3xl w-full flex flex-col items-center justify-center h-full relative">
132
- <!-- Header (Button order is: Notification Left, Back Right) -->
133
  <div class="header-controls">
134
  <div id="notification-trigger-container">
135
  <button id="notification-button" aria-label="Notifications" class="header-button">
@@ -144,53 +218,58 @@
144
  </div>
145
 
146
  <div id="notification-popover-wrapper" class="notification-popover-wrapper">
147
- <div id="notification-popover" class="popover-content hidden-initial">
148
  <div class="notification-popover-text-content">
149
  مدل‌های هوش مصنوعی می‌توانند اشتباه کنند، صحت اطلاعات مهم را بررسی کنید و از وارد کردن اطلاعات حساس بپرهیزید.
150
  </div>
151
  </div>
152
  </div>
153
 
154
- <div class="w-full flex flex-col items-center justify-center h-[90dvh] bg-slate-50 top-0 left-0 relative">
155
  <video id="video-feed" autoplay playsinline class="absolute top-0 left-0 w-full h-full object-cover scale-x-[-1] hidden"></video>
156
  <div id="large-logo-container" class="hidden"></div>
157
 
158
  <div id="footer-controls" class="footer-controls layout-default">
159
- <!-- Camera Button Wrapper (Now on the Left) -->
160
- <div class="control-button-wrapper">
161
- <div id="cam-switch-icon" class="camera-switch-icon">
162
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-refresh-ccw"><path d="M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16"/><path d="M21 21v-5h-5"/></svg>
 
 
163
  </div>
164
- <div id="cam-button" class="control-button cam-button-color"></div>
165
  </div>
166
 
167
  <div id="small-logo-container" class="hidden"></div>
168
 
169
- <!-- Mic Button (Now on the Right) -->
170
- <div id="mic-button" class="control-button mic-button-color"></div>
 
171
  </div>
172
  </div>
173
  </div>
174
  </div>
175
 
176
- <!-- SVG Icon Definitions (same as previous) -->
177
  <div style="display: none;">
178
  <svg id="svg-pauseIcon" width="37" height="37" viewBox="0 0 37 37" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M15.9872 29.6198V8.28342C15.9872 6.25781 15.132 5.44757 12.9713 5.44757H7.52469C5.36404 5.44757 4.50879 6.25781 4.50879 8.28342V29.6198C4.50879 31.6454 5.36404 32.4556 7.52469 32.4556H12.9713C15.132 32.4556 15.9872 31.6454 15.9872 29.6198Z" fill="#BE123C"/><path opacity="0.4" d="M31.5175 29.6198V8.28342C31.5175 6.25781 30.6622 5.44757 28.5016 5.44757H23.055C20.9093 5.44757 20.0391 6.25781 20.0391 8.28342V29.6198C20.0391 31.6454 20.8943 32.4556 23.055 32.4556H28.5016C30.6622 32.4556 31.5175 31.6454 31.5175 29.6198Z" fill="#BE123C"/></svg>
179
  <svg id="svg-microphoneIcon" width="69" height="68" viewBox="0 0 69 68" fill="none" xmlns="http://www.w3.org/2000/svg"><path opacity="0.4" d="M49.9479 27.1824C49.0803 27.1824 48.3907 27.872 48.3907 28.7396V32.2544C48.3907 40.1293 41.984 46.5361 34.109 46.5361C26.234 46.5361 19.8273 40.1293 19.8273 32.2544V28.7173C19.8273 27.8497 19.1377 27.1601 18.2701 27.1601C17.4025 27.1601 16.7129 27.8497 16.7129 28.7173V32.2321C16.7129 41.2861 23.6758 48.7384 32.5518 49.5393V54.2776C32.5518 55.1452 33.2414 55.8348 34.109 55.8348C34.9766 55.8348 35.6662 55.1452 35.6662 54.2776V49.5393C44.52 48.7607 51.5051 41.2861 51.5051 32.2321V28.7173C51.4829 27.872 50.7933 27.1824 49.9479 27.1824Z" fill="#BE123C"/><path d="M34.1099 11.3434C28.682 11.3434 24.2773 15.7481 24.2773 21.176V32.5658C24.2773 37.9938 28.682 42.3984 34.1099 42.3984C39.5379 42.3984 43.9425 37.9938 43.9425 32.5658V21.176C43.9425 15.7481 39.5379 11.3434 34.1099 11.3434ZM37.0241 26.8042C36.8684 27.3826 36.3567 27.7608 35.7784 27.7608C35.6671 27.7608 35.5559 27.7385 35.4447 27.7163C34.5771 27.4716 33.665 27.4716 32.7974 27.7163C32.0856 27.9165 31.396 27.4938 31.218 26.8042C31.0178 26.1146 31.4404 25.4027 32.1301 25.2247C33.4426 24.8688 34.8218 24.8688 36.1343 25.2247C36.8017 25.4027 37.2021 26.1146 37.0241 26.8042ZM38.2031 22.4885C38.0029 23.0224 37.5135 23.3339 36.9796 23.3339C36.8239 23.3339 36.6904 23.3116 36.5347 23.2671C34.9775 22.6887 33.2423 22.6887 31.6852 23.2671C31.0178 23.5118 30.2614 23.1559 30.0167 22.4885C29.772 21.8212 30.128 21.0648 30.7953 20.8423C32.9309 20.0637 35.289 20.0637 37.4245 20.8423C38.0919 21.087 38.4478 21.8212 38.2031 22.4885Z" fill="#BE123C"/></svg>
180
  <svg id="svg-cameraIcon" width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path opacity="0.4" d="M21.8118 5.52235H11.9265C6.29183 5.52235 4.10059 7.7136 4.10059 13.3482V26.5286C4.10059 30.318 6.16002 34.3545 11.9265 34.3545H21.8118C27.4464 34.3545 29.6376 32.1633 29.6376 26.5286V13.3482C29.6376 7.7136 27.4464 5.52235 21.8118 5.52235Z" fill="#2252A0"/><path d="M19.3406 18.9169C21.0512 18.9169 22.438 17.5302 22.438 15.8195C22.438 14.1089 21.0512 12.7222 19.3406 12.7222C17.6299 12.7222 16.2432 14.1089 16.2432 15.8195C16.2432 17.5302 17.6299 18.9169 19.3406 18.9169Z" fill="#2252A0"/><path d="M36.0629 10.3332C35.3874 9.98721 33.9705 9.5918 32.0429 10.9428L29.6045 12.6562C29.621 12.8869 29.6374 13.1011 29.6374 13.3482V26.5286C29.6374 26.7758 29.6045 26.9899 29.6045 27.2206L32.0429 28.934C33.0643 29.659 33.954 29.8896 34.6625 29.8896C35.2721 29.8896 35.7499 29.7249 36.0629 29.5601C36.7384 29.2141 37.8752 28.275 37.8752 25.919V13.9743C37.8752 11.6183 36.7384 10.6792 36.0629 10.3332Z" fill="#2252A0"/></svg>
181
  <svg id="svg-stopCamIcon" width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path opacity="0.4" d="M29.0785 10.8076L6.91966 32.9665C4.61316 31.5002 3.70703 28.8807 3.70703 26.36V13.18C3.70703 7.54555 5.89821 5.35437 11.5327 5.35437H21.4177C26.1789 5.35437 28.4854 6.9195 29.0785 10.8076Z" fill="#2252A0"/><path opacity="0.4" d="M29.2427 15.2394V26.36C29.2427 26.4918 29.2262 26.5907 29.2262 26.706C29.2262 26.8213 29.2097 26.9366 29.2097 27.052H29.2262C29.045 32.1757 26.8208 34.1856 21.417 34.1856H11.532C11.1202 34.1856 10.7412 34.1692 10.3623 34.1197L29.2427 15.2394Z" fill="#2252A0"/><path opacity="0.4" d="M29.21 27.052C29.21 26.9366 29.2264 26.8213 29.2264 26.706C29.2429 26.8213 29.2429 26.9366 29.2264 27.052H29.21Z" fill="#2252A0"/><path opacity="0.4" d="M29.2264 12.4716C29.2429 12.5869 29.2429 12.7187 29.2264 12.834C29.2264 12.7187 29.21 12.6034 29.21 12.488L29.2264 12.4716Z" fill="#2252A0"/><path d="M37.4804 13.8061V25.734C37.4804 28.0899 36.3436 29.029 35.6682 29.3749C35.3551 29.5397 34.8774 29.7209 34.2678 29.7209C33.5594 29.7209 32.6697 29.4903 31.6483 28.7654L29.2264 27.052H29.21C29.21 26.9366 29.2264 26.8213 29.2264 26.706C29.2264 26.5907 29.2429 26.4918 29.2429 26.36V15.2394L34.6302 9.85205C35.0751 9.885 35.421 10.0168 35.6682 10.1651C36.3436 10.5111 37.4804 11.4501 37.4804 13.8061Z" fill="#2252A0"/><path d="M35.8666 3.67393C35.3723 3.17968 34.565 3.17968 34.0708 3.67393L3.6744 34.0868C3.18015 34.581 3.18015 35.3883 3.6744 35.8826C3.92152 36.1132 4.23455 36.245 4.56405 36.245C4.89355 36.245 5.20657 36.1132 5.4537 35.8661L35.8666 5.45323C36.3773 4.95898 36.3773 4.16818 35.8666 3.67393Z" fill="#2252A0"/></svg>
182
  <svg id="svg-humanIcon" width="70" height="70" viewBox="0 0 88 89" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M75.1481 81.6361H12.9259C9.66667 81.6361 7 78.9721 7 75.7161V58.5112C7 57.5862 7 57.1052 7.44444 56.2172C8.85185 52.9612 13 50.2232 19.4815 47.8922C24.1111 56.6982 33.3704 62.6921 44 62.6921C54.6296 62.6921 63.9259 56.6982 68.5185 47.8922C75 50.1862 79.1852 52.9982 80.5556 56.2172C81 56.6612 81 57.6232 81 58.5112V75.7161C81 78.9721 78.3333 81.6361 75.0741 81.6361H75.1481Z" stroke="#FCFCFC" stroke-width="6.42146" stroke-linecap="round" stroke-linejoin="round"/><path d="M44.0371 50.1862C33.8519 50.1862 25.5186 41.8612 25.5186 31.6863V26.1363C25.5186 15.9613 33.8519 7.63635 44.0371 7.63635C54.2223 7.63635 62.5556 15.9613 62.5556 26.1363V31.6863C62.5556 41.8612 54.2223 50.1862 44.0371 50.1862Z" stroke="#FCFCFC" stroke-width="6.42146" stroke-linecap="round" stroke-linejoin="round"/></svg>
 
 
 
 
 
 
183
  </div>
184
 
185
  <script>
186
- // ... (JS variables and createLogoHTML function from previous)
187
- const camSwitchIcon = document.getElementById('cam-switch-icon');
188
- // (Other variables are the same)
189
  const videoFeed = document.getElementById('video-feed');
190
  const largeLogoContainer = document.getElementById('large-logo-container');
191
  const smallLogoContainer = document.getElementById('small-logo-container');
192
  const micButton = document.getElementById('mic-button');
193
  const camButton = document.getElementById('cam-button');
 
194
  const footerControls = document.getElementById('footer-controls');
195
  const notificationButton = document.getElementById('notification-button');
196
  const notificationPopover = document.getElementById('notification-popover');
@@ -199,39 +278,38 @@
199
  const microphoneIconSVG = document.getElementById('svg-microphoneIcon').cloneNode(true);
200
  const cameraIconSVG = document.getElementById('svg-cameraIcon').cloneNode(true);
201
  const stopCamIconSVG = document.getElementById('svg-stopCamIcon').cloneNode(true);
 
202
 
203
  let isMicActive = false;
204
  let isCamActive = false;
205
  let isNotificationOpen = false;
206
 
207
-
208
  function createLogoHTML(isMini, isHumanActive, isAiActive) {
209
- if (!isHumanActive && !isAiActive) return '';
210
  const size = isMini ? 80 : 200;
211
  const iconSize = isMini ? 35 : 70;
212
  const insetBase = isMini ? { ping: 10, outer: 0, mid: 5, inner: 12, icon: 22 }
213
  : { ping: 40, outer: 0, mid: 20, inner: 50, icon: 65 };
214
  const bgColorBase = isHumanActive ? 'blue' : (isAiActive ? 'green' : 'gray');
215
- const iconNode = isHumanActive ? document.getElementById('svg-humanIcon') : (isAiActive ? document.getElementById('svg-humanIcon') /* Placeholder */ : null);
216
  if (!iconNode) return '';
217
  const iconSVG = iconNode.cloneNode(true);
218
  iconSVG.setAttribute('width', iconSize);
219
  iconSVG.setAttribute('height', iconSize);
220
 
221
  return `
222
- <div class="hidden bg-green-200 bg-green-300 bg-green-400 bg-blue-200 bg-blue-300 bg-blue-400"></div>
223
  <div class="relative" style="width: ${size}px; height: ${size}px;">
224
- <div class="absolute rounded-full opacity-50 animate-ping bg-${bgColorBase}-200" style="inset: ${insetBase.ping}px;"></div>
225
- <div class="absolute inset-0 rounded-full opacity-50 bg-${bgColorBase}-200"></div>
226
- <div class="absolute rounded-full opacity-50 bg-${bgColorBase}-300" style="inset: ${insetBase.mid}px;"></div>
227
- <div class="absolute inset-[50px] rounded-full opacity-50 bg-${bgColorBase}-400" style="inset: ${insetBase.inner}px;"></div>
228
  <div class="z-10 absolute" style="inset: ${insetBase.icon}px;">
229
  ${iconSVG.outerHTML}
230
  </div>
231
  </div>`;
232
  }
233
 
234
-
235
  function updateUI() {
236
  videoFeed.classList.toggle('hidden', !isCamActive);
237
  if (!isCamActive && isMicActive) {
@@ -250,40 +328,65 @@
250
  smallLogoContainer.classList.add('flex');
251
  footerControls.classList.remove('layout-default');
252
  footerControls.classList.add('layout-with-small-logo');
253
- camSwitchIcon.classList.add('visible'); // Show camera switch icon
 
 
 
254
  } else {
255
  smallLogoContainer.innerHTML = '';
256
  smallLogoContainer.classList.add('hidden');
257
  smallLogoContainer.classList.remove('flex');
258
  footerControls.classList.remove('layout-with-small-logo');
259
  footerControls.classList.add('layout-default');
260
- camSwitchIcon.classList.remove('visible'); // Hide camera switch icon
 
 
261
  }
262
 
263
  camButton.innerHTML = '';
264
  camButton.appendChild(isCamActive ? stopCamIconSVG.cloneNode(true) : cameraIconSVG.cloneNode(true));
 
265
  micButton.innerHTML = '';
266
  micButton.appendChild(isMicActive ? pauseIconSVG.cloneNode(true) : microphoneIconSVG.cloneNode(true));
267
 
268
- // Notification Popover
 
 
 
 
269
  if (isNotificationOpen) {
270
- notificationPopover.classList.remove('hidden-initial', 'animate-popover-close-top-center');
271
- notificationPopover.classList.add('open', 'animate-popover-open-top-center');
 
272
  } else {
273
- // Only apply close animation if it was previously open
274
- if (notificationPopover.classList.contains('open')) {
275
- notificationPopover.classList.remove('animate-popover-open-top-center');
276
- notificationPopover.classList.add('animate-popover-close-top-center');
277
- setTimeout(() => {
278
- if (!isNotificationOpen) { // Double check state before hiding
279
- notificationPopover.classList.remove('open');
280
- notificationPopover.classList.add('hidden-initial'); // Re-hide properly
 
 
 
 
 
 
281
  }
282
- }, 300); // Match close animation duration
 
 
 
 
 
 
 
 
 
283
  } else {
284
- // Ensure it's hidden if it was never opened or closed before initial load
285
- notificationPopover.classList.add('hidden-initial');
286
- notificationPopover.classList.remove('open');
287
  }
288
  }
289
  }
@@ -291,9 +394,6 @@
291
  notificationButton.addEventListener('click', (event) => {
292
  event.stopPropagation();
293
  isNotificationOpen = !isNotificationOpen;
294
- if (isNotificationOpen) { // If we are opening it, remove hidden-initial first
295
- notificationPopover.classList.remove('hidden-initial');
296
- }
297
  updateUI();
298
  });
299
 
@@ -307,18 +407,19 @@
307
 
308
  camButton.addEventListener('click', () => { isCamActive = !isCamActive; updateUI(); });
309
  micButton.addEventListener('click', () => { isMicActive = !isMicActive; updateUI(); });
310
- if (camSwitchIcon) {
311
- camSwitchIcon.addEventListener('click', (e) => {
312
- e.stopPropagation(); // Prevent camera button click if switch is separate
313
- alert('Camera switch clicked!');
314
- // Add logic to switch camera here
315
- });
316
- }
317
 
318
- // Initial UI state - ensure popover is truly hidden without animation on load
319
- notificationPopover.classList.add('hidden-initial');
320
- notificationPopover.classList.remove('open', 'animate-popover-open-top-center', 'animate-popover-close-top-center');
321
- updateUI();
 
 
 
 
322
  </script>
323
  </body>
324
  </html>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
6
+ <title>هوشان - چیدمان آینه‌ای و نوتیفیکیشن جدید</title>
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <style>
 
9
  @custom-variant dark (&:is(.dark *));
10
+ @theme inline {
11
+ --color-background: var(--background);
12
+ --color-foreground: var(--foreground);
13
+ --radius-lg: var(--radius);
14
+ --popover: oklch(1 0 0);
15
+ --popover-foreground: oklch(0.145 0 0);
16
+ --border: oklch(0.922 0 0);
17
+ }
18
+ :root {
19
+ --radius: 0.625rem; /* 10px */
20
+ --radius-md: 0.5rem; /* 8px for popover consistency */
21
+ --background: oklch(1 0 0); /* white */
22
+ --foreground: oklch(0.145 0 0); /* near black */
23
+ }
24
+ .dark {
25
+ --background: oklch(0.145 0 0); /* near black */
26
+ --foreground: oklch(0.985 0 0); /* near white */
27
+ --popover: oklch(0.205 0 0); /* dark gray */
28
+ --popover-foreground: oklch(0.985 0 0); /* near white */
29
+ --border: oklch(1 0 0 / 10%); /* white with 10% alpha */
30
+ }
31
  @layer base {
32
  * { @apply border-border outline-ring/50; }
33
  body { @apply bg-background text-foreground; overflow-x: hidden; }
34
  }
35
 
36
+ /* Notification Popover Wrapper & Content */
37
+ .notification-popover-wrapper {
38
+ position: fixed;
39
+ top: 1rem;
40
+ left: 50%;
41
+ transform: translateX(-50%);
42
+ z-index: 100;
43
+ width: calc(100% - 2rem);
44
+ max-width: 28rem; /* max-w-md */
45
+ display: flex;
46
+ justify-content: center;
47
+ pointer-events: none;
48
  }
49
+
50
+ .popover-content {
51
+ width: 100%;
52
+ border-radius: var(--radius-md);
53
+ border-width: 1px;
54
+ border-color: var(--border);
55
+ background-color: var(--popover);
56
  color: var(--popover-foreground);
57
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
58
+ outline: none;
59
+ /* Initial state matches animation start/end */
 
 
 
 
60
  opacity: 0;
61
+ transform: translateY(-20px) scale(0.95);
62
+ pointer-events: none;
63
+ /* transition property is effectively overridden by animation classes when applied */
64
  }
65
+
66
  .popover-content.open {
67
+ /* These are set by the animation 'forwards' state */
68
+ /* opacity: 1; */
69
+ /* transform: translateY(0) scale(1); */
70
+ pointer-events: auto;
71
+ }
72
+
73
+ .notification-popover-text-content {
74
+ background-color: #eff6ff; /* bg-blue-50 */
75
+ color: oklch(0.145 0 0); /* Ensure text is readable on light blue bg */
76
+ font-size: 0.875rem; line-height: 1.5rem; direction: rtl;
77
+ padding: 1rem;
78
+ border-radius: var(--radius-md);
79
  }
80
+ .dark .notification-popover-text-content {
81
+ background-color: #1e40af; /* Slightly darker blue for dark mode: blue-700 */
82
+ color: oklch(0.985 0 0); /* Ensure text is light */
83
  }
84
 
85
+ /* Header controls */
86
+ .header-controls {
87
+ display: flex;
88
+ padding: 1rem;
89
+ justify-content: space-between;
90
+ align-items: center;
91
+ width: 100%;
92
+ position: absolute;
93
+ top: 0;
94
+ left: 0;
95
+ z-index: 10;
96
  }
 
97
 
98
+ .header-button {
99
+ display: flex; align-items: center; justify-content: center;
100
+ padding: 0.5rem; border-radius: var(--radius-lg);
101
+ background-color: oklch(0.92 0 0 / 80%); /* bg-gray-100 with opacity */
102
+ color: oklch(0.4 0 0);
103
+ cursor: pointer;
104
+ transition: background-color 0.2s;
105
+ }
106
+ .dark .header-button {
107
+ background-color: oklch(0.25 0 0 / 80%); /* bg-gray-700 with opacity */
108
+ color: oklch(0.85 0 0);
109
+ }
110
+ .header-button:hover {
111
+ background-color: oklch(0.9 0 0); /* bg-gray-200 */
112
+ }
113
+ .dark .header-button:hover {
114
+ background-color: oklch(0.3 0 0); /* bg-gray-600 */
115
+ }
116
+ .header-button svg { opacity: 0.7; }
117
 
118
  @keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } }
119
  .animate-ping { animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite; }
120
 
121
+ #large-logo-container.flex { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; position: absolute; top: 0; left: 0; }
122
+ #small-logo-container.flex { display: flex; align-items: center; justify-content: center; }
123
 
124
+ .footer-controls {
 
125
  width: 100%; display: flex; gap: 1rem; position: absolute;
126
+ bottom: 0; padding: 2rem 3rem; align-items: center; /* Aligns base of buttons */
127
  }
128
  .footer-controls.layout-default { justify-content: space-between; }
129
  .footer-controls.layout-with-small-logo { justify-content: space-around; }
130
 
131
+ .control-button {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  height: 80px; width: 80px; border-radius: 9999px;
133
  padding: 0; display: flex; align-items: center; justify-content: center;
134
+ border-width: 1px; border-color: var(--border);
135
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
136
  cursor: pointer;
137
+ transition: transform 0.15s ease-out;
138
+ }
139
+ .control-button:hover {
140
+ transform: scale(1.03);
141
  }
142
  .cam-button-color { background-color: #E0ECFF; }
143
  .mic-button-color { background-color: #fecdd3; }
144
 
145
+ /* Switch Camera Button Specific Styles */
146
+ #switch-camera-button {
147
+ position: absolute;
148
+ bottom: calc(100% + 0.5rem); /* 0.5rem above the cam-button's top edge */
149
+ left: 50%;
150
+ /* transform: translateX(-50%); Will be applied by Tailwind class */
151
+ z-index: 5;
152
+ background-color: rgb(255 255 255 / 0.9); /* white with opacity */
153
+ border-radius: 9999px; /* rounded-full */
154
+ padding: 0.5rem; /* p-2 */
155
+ box-shadow: 0 2px 5px rgb(0 0 0 / 0.15);
156
+ cursor: pointer;
157
+ transition: background-color 0.15s ease-in-out, transform 0.15s ease-in-out;
158
+ display: flex;
159
+ align-items: center;
160
+ justify-content: center;
161
+ color: var(--foreground); /* Inherit text color for SVG stroke */
162
+ }
163
+ #switch-camera-button:hover {
164
+ background-color: rgb(255 255 255); /* solid white */
165
+ /* transform: translateX(-50%) scale(1.05); Will be applied by Tailwind class */
166
+ }
167
+ .dark #switch-camera-button {
168
+ background-color: rgb(51 65 85 / 0.9); /* slate-700 with opacity */
169
+ color: var(--foreground); /* Inherit text color for SVG stroke */
170
+ }
171
+ .dark #switch-camera-button:hover {
172
+ background-color: rgb(71 85 105); /* slate-600 */
173
+ }
174
+
175
  </style>
176
  <script>
177
  tailwind.config = {
178
  darkMode: 'class',
179
  theme: {
180
  extend: {
181
+ colors: { /* Using CSS variables, so not strictly needed here unless for other Tailwind utilities */ },
182
+ borderRadius: { /* Using CSS variables */ },
183
+ inset: { /* Using CSS variables */ },
184
  keyframes: {
185
+ 'popover-drop-in': {
186
+ '0%': { opacity: '0', transform: 'translateY(-20px) scale(0.95)' },
187
+ '100%': { opacity: '1', transform: 'translateY(0) scale(1)' },
188
+ },
189
+ 'popover-lift-out': {
190
+ '0%': { opacity: '1', transform: 'translateY(0) scale(1)' },
191
+ '100%': { opacity: '0', transform: 'translateY(-20px) scale(0.95)' },
192
+ }
193
  },
194
  animation: {
195
+ 'popover-open-top-center': 'popover-drop-in 0.3s cubic-bezier(0.25, 0.1, 0.25, 1) forwards',
196
+ 'popover-close-top-center': 'popover-lift-out 0.2s ease-in forwards',
197
  }
198
  }
199
  }
200
  }
201
  </script>
202
  </head>
203
+ <body class="antialiased">
204
 
205
  <div class="w-full flex flex-col items-center justify-center min-h-[90dvh] md:min-h-screen">
206
  <div class="max-w-3xl w-full flex flex-col items-center justify-center h-full relative">
 
207
  <div class="header-controls">
208
  <div id="notification-trigger-container">
209
  <button id="notification-button" aria-label="Notifications" class="header-button">
 
218
  </div>
219
 
220
  <div id="notification-popover-wrapper" class="notification-popover-wrapper">
221
+ <div id="notification-popover" class="popover-content">
222
  <div class="notification-popover-text-content">
223
  مدل‌های هوش مصنوعی می‌توانند اشتباه کنند، صحت اطلاعات مهم را بررسی کنید و از وارد کردن اطلاعات حساس بپرهیزید.
224
  </div>
225
  </div>
226
  </div>
227
 
228
+ <div class="w-full flex flex-col items-center justify-center h-[90dvh] bg-background top-0 left-0 relative">
229
  <video id="video-feed" autoplay playsinline class="absolute top-0 left-0 w-full h-full object-cover scale-x-[-1] hidden"></video>
230
  <div id="large-logo-container" class="hidden"></div>
231
 
232
  <div id="footer-controls" class="footer-controls layout-default">
233
+ <div class="relative flex flex-col items-center">
234
+ <button id="switch-camera-button" class="hidden -translate-x-1/2 hover:scale-105">
235
+ <!-- SVG injected by JS -->
236
+ </button>
237
+ <div id="cam-button" class="control-button cam-button-color">
238
+ <!-- SVG injected by JS -->
239
  </div>
 
240
  </div>
241
 
242
  <div id="small-logo-container" class="hidden"></div>
243
 
244
+ <div id="mic-button" class="control-button mic-button-color">
245
+ <!-- SVG injected by JS -->
246
+ </div>
247
  </div>
248
  </div>
249
  </div>
250
  </div>
251
 
 
252
  <div style="display: none;">
253
  <svg id="svg-pauseIcon" width="37" height="37" viewBox="0 0 37 37" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M15.9872 29.6198V8.28342C15.9872 6.25781 15.132 5.44757 12.9713 5.44757H7.52469C5.36404 5.44757 4.50879 6.25781 4.50879 8.28342V29.6198C4.50879 31.6454 5.36404 32.4556 7.52469 32.4556H12.9713C15.132 32.4556 15.9872 31.6454 15.9872 29.6198Z" fill="#BE123C"/><path opacity="0.4" d="M31.5175 29.6198V8.28342C31.5175 6.25781 30.6622 5.44757 28.5016 5.44757H23.055C20.9093 5.44757 20.0391 6.25781 20.0391 8.28342V29.6198C20.0391 31.6454 20.8943 32.4556 23.055 32.4556H28.5016C30.6622 32.4556 31.5175 31.6454 31.5175 29.6198Z" fill="#BE123C"/></svg>
254
  <svg id="svg-microphoneIcon" width="69" height="68" viewBox="0 0 69 68" fill="none" xmlns="http://www.w3.org/2000/svg"><path opacity="0.4" d="M49.9479 27.1824C49.0803 27.1824 48.3907 27.872 48.3907 28.7396V32.2544C48.3907 40.1293 41.984 46.5361 34.109 46.5361C26.234 46.5361 19.8273 40.1293 19.8273 32.2544V28.7173C19.8273 27.8497 19.1377 27.1601 18.2701 27.1601C17.4025 27.1601 16.7129 27.8497 16.7129 28.7173V32.2321C16.7129 41.2861 23.6758 48.7384 32.5518 49.5393V54.2776C32.5518 55.1452 33.2414 55.8348 34.109 55.8348C34.9766 55.8348 35.6662 55.1452 35.6662 54.2776V49.5393C44.52 48.7607 51.5051 41.2861 51.5051 32.2321V28.7173C51.4829 27.872 50.7933 27.1824 49.9479 27.1824Z" fill="#BE123C"/><path d="M34.1099 11.3434C28.682 11.3434 24.2773 15.7481 24.2773 21.176V32.5658C24.2773 37.9938 28.682 42.3984 34.1099 42.3984C39.5379 42.3984 43.9425 37.9938 43.9425 32.5658V21.176C43.9425 15.7481 39.5379 11.3434 34.1099 11.3434ZM37.0241 26.8042C36.8684 27.3826 36.3567 27.7608 35.7784 27.7608C35.6671 27.7608 35.5559 27.7385 35.4447 27.7163C34.5771 27.4716 33.665 27.4716 32.7974 27.7163C32.0856 27.9165 31.396 27.4938 31.218 26.8042C31.0178 26.1146 31.4404 25.4027 32.1301 25.2247C33.4426 24.8688 34.8218 24.8688 36.1343 25.2247C36.8017 25.4027 37.2021 26.1146 37.0241 26.8042ZM38.2031 22.4885C38.0029 23.0224 37.5135 23.3339 36.9796 23.3339C36.8239 23.3339 36.6904 23.3116 36.5347 23.2671C34.9775 22.6887 33.2423 22.6887 31.6852 23.2671C31.0178 23.5118 30.2614 23.1559 30.0167 22.4885C29.772 21.8212 30.128 21.0648 30.7953 20.8423C32.9309 20.0637 35.289 20.0637 37.4245 20.8423C38.0919 21.087 38.4478 21.8212 38.2031 22.4885Z" fill="#BE123C"/></svg>
255
  <svg id="svg-cameraIcon" width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path opacity="0.4" d="M21.8118 5.52235H11.9265C6.29183 5.52235 4.10059 7.7136 4.10059 13.3482V26.5286C4.10059 30.318 6.16002 34.3545 11.9265 34.3545H21.8118C27.4464 34.3545 29.6376 32.1633 29.6376 26.5286V13.3482C29.6376 7.7136 27.4464 5.52235 21.8118 5.52235Z" fill="#2252A0"/><path d="M19.3406 18.9169C21.0512 18.9169 22.438 17.5302 22.438 15.8195C22.438 14.1089 21.0512 12.7222 19.3406 12.7222C17.6299 12.7222 16.2432 14.1089 16.2432 15.8195C16.2432 17.5302 17.6299 18.9169 19.3406 18.9169Z" fill="#2252A0"/><path d="M36.0629 10.3332C35.3874 9.98721 33.9705 9.5918 32.0429 10.9428L29.6045 12.6562C29.621 12.8869 29.6374 13.1011 29.6374 13.3482V26.5286C29.6374 26.7758 29.6045 26.9899 29.6045 27.2206L32.0429 28.934C33.0643 29.659 33.954 29.8896 34.6625 29.8896C35.2721 29.8896 35.7499 29.7249 36.0629 29.5601C36.7384 29.2141 37.8752 28.275 37.8752 25.919V13.9743C37.8752 11.6183 36.7384 10.6792 36.0629 10.3332Z" fill="#2252A0"/></svg>
256
  <svg id="svg-stopCamIcon" width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path opacity="0.4" d="M29.0785 10.8076L6.91966 32.9665C4.61316 31.5002 3.70703 28.8807 3.70703 26.36V13.18C3.70703 7.54555 5.89821 5.35437 11.5327 5.35437H21.4177C26.1789 5.35437 28.4854 6.9195 29.0785 10.8076Z" fill="#2252A0"/><path opacity="0.4" d="M29.2427 15.2394V26.36C29.2427 26.4918 29.2262 26.5907 29.2262 26.706C29.2262 26.8213 29.2097 26.9366 29.2097 27.052H29.2262C29.045 32.1757 26.8208 34.1856 21.417 34.1856H11.532C11.1202 34.1856 10.7412 34.1692 10.3623 34.1197L29.2427 15.2394Z" fill="#2252A0"/><path opacity="0.4" d="M29.21 27.052C29.21 26.9366 29.2264 26.8213 29.2264 26.706C29.2429 26.8213 29.2429 26.9366 29.2264 27.052H29.21Z" fill="#2252A0"/><path opacity="0.4" d="M29.2264 12.4716C29.2429 12.5869 29.2429 12.7187 29.2264 12.834C29.2264 12.7187 29.21 12.6034 29.21 12.488L29.2264 12.4716Z" fill="#2252A0"/><path d="M37.4804 13.8061V25.734C37.4804 28.0899 36.3436 29.029 35.6682 29.3749C35.3551 29.5397 34.8774 29.7209 34.2678 29.7209C33.5594 29.7209 32.6697 29.4903 31.6483 28.7654L29.2264 27.052H29.21C29.21 26.9366 29.2264 26.8213 29.2264 26.706C29.2264 26.5907 29.2429 26.4918 29.2429 26.36V15.2394L34.6302 9.85205C35.0751 9.885 35.421 10.0168 35.6682 10.1651C36.3436 10.5111 37.4804 11.4501 37.4804 13.8061Z" fill="#2252A0"/><path d="M35.8666 3.67393C35.3723 3.17968 34.565 3.17968 34.0708 3.67393L3.6744 34.0868C3.18015 34.581 3.18015 35.3883 3.6744 35.8826C3.92152 36.1132 4.23455 36.245 4.56405 36.245C4.89355 36.245 5.20657 36.1132 5.4537 35.8661L35.8666 5.45323C36.3773 4.95898 36.3773 4.16818 35.8666 3.67393Z" fill="#2252A0"/></svg>
257
  <svg id="svg-humanIcon" width="70" height="70" viewBox="0 0 88 89" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M75.1481 81.6361H12.9259C9.66667 81.6361 7 78.9721 7 75.7161V58.5112C7 57.5862 7 57.1052 7.44444 56.2172C8.85185 52.9612 13 50.2232 19.4815 47.8922C24.1111 56.6982 33.3704 62.6921 44 62.6921C54.6296 62.6921 63.9259 56.6982 68.5185 47.8922C75 50.1862 79.1852 52.9982 80.5556 56.2172C81 56.6612 81 57.6232 81 58.5112V75.7161C81 78.9721 78.3333 81.6361 75.0741 81.6361H75.1481Z" stroke="#FCFCFC" stroke-width="6.42146" stroke-linecap="round" stroke-linejoin="round"/><path d="M44.0371 50.1862C33.8519 50.1862 25.5186 41.8612 25.5186 31.6863V26.1363C25.5186 15.9613 33.8519 7.63635 44.0371 7.63635C54.2223 7.63635 62.5556 15.9613 62.5556 26.1363V31.6863C62.5556 41.8612 54.2223 50.1862 44.0371 50.1862Z" stroke="#FCFCFC" stroke-width="6.42146" stroke-linecap="round" stroke-linejoin="round"/></svg>
258
+ <svg id="svg-switchCameraIcon" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
259
+ <path d="M23 4v6h-6"></path>
260
+ <path d="M1 20v-6h6"></path>
261
+ <path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10"></path>
262
+ <path d="M1 14l4.64 4.36A9 9 0 0 0 20.49 15"></path>
263
+ </svg>
264
  </div>
265
 
266
  <script>
 
 
 
267
  const videoFeed = document.getElementById('video-feed');
268
  const largeLogoContainer = document.getElementById('large-logo-container');
269
  const smallLogoContainer = document.getElementById('small-logo-container');
270
  const micButton = document.getElementById('mic-button');
271
  const camButton = document.getElementById('cam-button');
272
+ const switchCameraButton = document.getElementById('switch-camera-button');
273
  const footerControls = document.getElementById('footer-controls');
274
  const notificationButton = document.getElementById('notification-button');
275
  const notificationPopover = document.getElementById('notification-popover');
 
278
  const microphoneIconSVG = document.getElementById('svg-microphoneIcon').cloneNode(true);
279
  const cameraIconSVG = document.getElementById('svg-cameraIcon').cloneNode(true);
280
  const stopCamIconSVG = document.getElementById('svg-stopCamIcon').cloneNode(true);
281
+ const switchCameraIconSVG = document.getElementById('svg-switchCameraIcon').cloneNode(true);
282
 
283
  let isMicActive = false;
284
  let isCamActive = false;
285
  let isNotificationOpen = false;
286
 
 
287
  function createLogoHTML(isMini, isHumanActive, isAiActive) {
288
+ if (!isHumanActive && !isAiActive) return '';
289
  const size = isMini ? 80 : 200;
290
  const iconSize = isMini ? 35 : 70;
291
  const insetBase = isMini ? { ping: 10, outer: 0, mid: 5, inner: 12, icon: 22 }
292
  : { ping: 40, outer: 0, mid: 20, inner: 50, icon: 65 };
293
  const bgColorBase = isHumanActive ? 'blue' : (isAiActive ? 'green' : 'gray');
294
+ const iconNode = isHumanActive ? document.getElementById('svg-humanIcon') : (isAiActive ? document.getElementById('svg-humanIcon') : null);
295
  if (!iconNode) return '';
296
  const iconSVG = iconNode.cloneNode(true);
297
  iconSVG.setAttribute('width', iconSize);
298
  iconSVG.setAttribute('height', iconSize);
299
 
300
  return `
301
+ <div class="hidden bg-green-200 bg-green-300 bg-green-400 bg-blue-200 bg-blue-300 bg-blue-400 dark:bg-green-700 dark:bg-green-600 dark:bg-green-500 dark:bg-blue-700 dark:bg-blue-600 dark:bg-blue-500"></div>
302
  <div class="relative" style="width: ${size}px; height: ${size}px;">
303
+ <div class="absolute rounded-full opacity-50 animate-ping bg-${bgColorBase}-200 dark:bg-${bgColorBase}-700" style="inset: ${insetBase.ping}px;"></div>
304
+ <div class="absolute inset-0 rounded-full opacity-50 bg-${bgColorBase}-200 dark:bg-${bgColorBase}-700"></div>
305
+ <div class="absolute rounded-full opacity-50 bg-${bgColorBase}-300 dark:bg-${bgColorBase}-600" style="inset: ${insetBase.mid}px;"></div>
306
+ <div class="absolute rounded-full opacity-50 bg-${bgColorBase}-400 dark:bg-${bgColorBase}-500" style="inset: ${insetBase.inner}px;"></div>
307
  <div class="z-10 absolute" style="inset: ${insetBase.icon}px;">
308
  ${iconSVG.outerHTML}
309
  </div>
310
  </div>`;
311
  }
312
 
 
313
  function updateUI() {
314
  videoFeed.classList.toggle('hidden', !isCamActive);
315
  if (!isCamActive && isMicActive) {
 
328
  smallLogoContainer.classList.add('flex');
329
  footerControls.classList.remove('layout-default');
330
  footerControls.classList.add('layout-with-small-logo');
331
+
332
+ switchCameraButton.classList.remove('hidden');
333
+ switchCameraButton.innerHTML = '';
334
+ switchCameraButton.appendChild(switchCameraIconSVG.cloneNode(true));
335
  } else {
336
  smallLogoContainer.innerHTML = '';
337
  smallLogoContainer.classList.add('hidden');
338
  smallLogoContainer.classList.remove('flex');
339
  footerControls.classList.remove('layout-with-small-logo');
340
  footerControls.classList.add('layout-default');
341
+
342
+ switchCameraButton.classList.add('hidden');
343
+ switchCameraButton.innerHTML = '';
344
  }
345
 
346
  camButton.innerHTML = '';
347
  camButton.appendChild(isCamActive ? stopCamIconSVG.cloneNode(true) : cameraIconSVG.cloneNode(true));
348
+
349
  micButton.innerHTML = '';
350
  micButton.appendChild(isMicActive ? pauseIconSVG.cloneNode(true) : microphoneIconSVG.cloneNode(true));
351
 
352
+ const openAnimation = 'animate-popover-open-top-center';
353
+ const closeAnimation = 'animate-popover-close-top-center';
354
+ const openClass = 'open';
355
+ const popoverAnimationDuration = 200; // Corresponds to 'popover-lift-out'
356
+
357
  if (isNotificationOpen) {
358
+ notificationPopover.classList.remove(closeAnimation);
359
+ notificationPopover.classList.add(openClass);
360
+ notificationPopover.classList.add(openAnimation);
361
  } else {
362
+ if (notificationPopover.classList.contains(openClass) || notificationPopover.classList.contains(openAnimation)) {
363
+ notificationPopover.classList.remove(openAnimation);
364
+ notificationPopover.classList.add(closeAnimation);
365
+
366
+ const handleAnimationEnd = (event) => {
367
+ // Ensure this handler only reacts to animations on the popover itself
368
+ if (event.target === notificationPopover) {
369
+ if (!isNotificationOpen) {
370
+ notificationPopover.classList.remove(openClass);
371
+ }
372
+ // It's good practice to remove the close animation class as well,
373
+ // so it doesn't interfere if reopened quickly.
374
+ // notificationPopover.classList.remove(closeAnimation);
375
+ notificationPopover.removeEventListener('animationend', handleAnimationEnd);
376
  }
377
+ };
378
+ notificationPopover.addEventListener('animationend', handleAnimationEnd);
379
+
380
+ // Fallback timeout, in case animationend doesn't fire or is missed
381
+ setTimeout(() => {
382
+ if (!isNotificationOpen && notificationPopover.classList.contains(closeAnimation)) { // Check if still closing
383
+ notificationPopover.classList.remove(openClass);
384
+ // notificationPopover.classList.remove(closeAnimation);
385
+ }
386
+ }, popoverAnimationDuration + 50); // Slightly longer than animation
387
  } else {
388
+ // Initial state or if closed without animation: ensure all classes are clean
389
+ notificationPopover.classList.remove(openClass, openAnimation, closeAnimation);
 
390
  }
391
  }
392
  }
 
394
  notificationButton.addEventListener('click', (event) => {
395
  event.stopPropagation();
396
  isNotificationOpen = !isNotificationOpen;
 
 
 
397
  updateUI();
398
  });
399
 
 
407
 
408
  camButton.addEventListener('click', () => { isCamActive = !isCamActive; updateUI(); });
409
  micButton.addEventListener('click', () => { isMicActive = !isMicActive; updateUI(); });
410
+
411
+ switchCameraButton.addEventListener('click', () => {
412
+ alert('دکمه تعویض دوربین کلیک شد!');
413
+ });
 
 
 
414
 
415
+ // Optional: Apply dark mode based on system preference or localStorage
416
+ if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
417
+ document.documentElement.classList.add('dark');
418
+ } else {
419
+ document.documentElement.classList.remove('dark');
420
+ }
421
+
422
+ updateUI(); // Initial UI state
423
  </script>
424
  </body>
425
  </html>