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

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +130 -230
index.html CHANGED
@@ -3,7 +3,7 @@
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 *));
@@ -14,106 +14,68 @@
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; }
@@ -123,54 +85,44 @@
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>
@@ -178,32 +130,34 @@
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,49 +172,46 @@
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>
@@ -269,7 +220,7 @@
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,115 +229,65 @@
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) {
316
- largeLogoContainer.innerHTML = createLogoHTML(false, true, false);
317
- largeLogoContainer.classList.remove('hidden');
318
- largeLogoContainer.classList.add('flex');
319
- } else {
320
- largeLogoContainer.innerHTML = '';
321
- largeLogoContainer.classList.add('hidden');
322
- largeLogoContainer.classList.remove('flex');
323
- }
324
 
325
- if (isCamActive) {
326
- smallLogoContainer.innerHTML = createLogoHTML(true, true, false);
327
- smallLogoContainer.classList.remove('hidden');
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,12 +295,16 @@
394
  notificationButton.addEventListener('click', (event) => {
395
  event.stopPropagation();
396
  isNotificationOpen = !isNotificationOpen;
 
 
 
 
397
  updateUI();
398
  });
399
 
400
  document.addEventListener('click', (event) => {
401
  const popoverWrapper = document.getElementById('notification-popover-wrapper');
402
- if (isNotificationOpen && !popoverWrapper.contains(event.target) && !notificationButton.contains(event.target)) {
403
  isNotificationOpen = false;
404
  updateUI();
405
  }
@@ -407,19 +312,14 @@
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>
 
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 *));
 
14
  --popover: oklch(1 0 0);
15
  --popover-foreground: oklch(0.145 0 0);
16
  --border: oklch(0.922 0 0);
17
+ --card: oklch(1 0 0); /* For camera switch icon background */
18
  }
19
  :root {
20
+ --radius: 0.625rem;
21
+ --background: oklch(1 0 0);
22
+ --foreground: oklch(0.145 0 0);
23
+ /* ... other root variables ... */
24
  }
25
  .dark {
26
+ --background: oklch(0.145 0 0);
27
+ --foreground: oklch(0.985 0 0);
28
+ --popover: oklch(0.205 0 0);
29
+ --popover-foreground: oklch(0.985 0 0);
30
+ --border: oklch(1 0 0 / 10%);
31
+ --card: oklch(0.205 0 0); /* Dark card background */
32
+ /* ... other dark variables ... */
33
  }
34
  @layer base {
35
  * { @apply border-border outline-ring/50; }
36
  body { @apply bg-background text-foreground; overflow-x: hidden; }
37
  }
38
 
39
+ /* Notification Popover */
40
  .notification-popover-wrapper {
41
+ position: fixed; top: 1rem; left: 50%; transform: translateX(-50%);
42
+ z-index: 100; width: calc(100% - 2rem); max-width: 28rem;
43
+ display: flex; justify-content: center; pointer-events: none;
 
 
 
 
 
 
 
44
  }
 
45
  .popover-content {
46
+ width: 100%; border-radius: var(--radius-md, 0.5rem); border-width: 1px;
47
+ border-color: var(--border); background-color: var(--popover);
 
 
 
48
  color: var(--popover-foreground);
49
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
50
+ outline: none; transition: opacity 0.3s ease-out, transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
51
+ opacity: 0; transform: translateY(-100%) scale(0.9);
52
+ pointer-events: none; /* Will be enabled when 'open' */
53
+ }
54
+ .popover-content.initially-hidden { /* Class to ensure it's fully hidden on load */
55
+ display: none; opacity: 0;
56
  }
 
57
  .popover-content.open {
58
+ display: block; opacity: 1; transform: translateY(0) scale(1); pointer-events: auto;
 
 
 
59
  }
 
60
  .notification-popover-text-content {
61
  background-color: #eff6ff; /* bg-blue-50 */
 
62
  font-size: 0.875rem; line-height: 1.5rem; direction: rtl;
63
+ padding: 1rem; border-radius: inherit; /* No extra border for text */
 
 
 
 
 
64
  }
65
 
66
  /* Header controls */
67
  .header-controls {
68
+ display: flex; padding: 1rem; justify-content: space-between;
69
+ align-items: center; width: 100%; position: absolute;
70
+ top: 0; left: 0; z-index: 10;
 
 
 
 
 
 
71
  }
 
72
  .header-button {
73
  display: flex; align-items: center; justify-content: center;
74
+ padding: 0.5rem; border-radius: var(--radius-lg, 0.625rem);
75
+ background-color: #e5e7eb; /* bg-gray-200 */
 
76
  cursor: pointer;
 
 
 
 
 
77
  }
78
+ .header-button svg { opacity: 0.5; }
 
 
 
 
 
 
79
 
80
  @keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } }
81
  .animate-ping { animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite; }
 
85
 
86
  .footer-controls {
87
  width: 100%; display: flex; gap: 1rem; position: absolute;
88
+ bottom: 0; padding: 2rem 3rem; align-items: center;
89
  }
90
  .footer-controls.layout-default { justify-content: space-between; }
91
  .footer-controls.layout-with-small-logo { justify-content: space-around; }
92
 
93
+ .control-button-wrapper {
94
+ position: relative; display: flex; align-items: center; justify-content: center;
 
 
 
 
 
 
 
 
95
  }
96
+ .camera-switch-icon {
 
 
 
 
97
  position: absolute;
98
+ bottom: calc(100% + 8px); /* 8px above the camera button */
99
  left: 50%;
100
+ transform: translateX(-50%) scale(0.8); /* Initial state: small and centered */
101
+ background-color: var(--card);
102
+ border: 1px solid var(--border);
103
+ border-radius: 50%;
104
+ padding: 8px;
105
+ box-shadow: 0 2px 5px rgba(0,0,0,0.15);
106
  cursor: pointer;
107
+ z-index: 5;
108
+ transition: opacity 0.25s ease-in-out, transform 0.25s ease-in-out;
109
+ opacity: 0;
110
+ pointer-events: none;
 
 
 
 
 
111
  }
112
+ .camera-switch-icon.visible {
113
+ opacity: 1;
114
+ transform: translateX(-50%) scale(1); /* Scale to full size */
115
+ pointer-events: auto;
116
  }
117
+ .control-button {
118
+ height: 80px; width: 80px; border-radius: 9999px;
119
+ padding: 0; display: flex; align-items: center; justify-content: center;
120
+ border-width: 1px;
121
+ box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
122
+ cursor: pointer;
123
  }
124
+ .cam-button-color { background-color: #E0ECFF; } /* Left button in RTL */
125
+ .mic-button-color { background-color: #fecdd3; } /* Right button in RTL */
126
 
127
  </style>
128
  <script>
 
130
  darkMode: 'class',
131
  theme: {
132
  extend: {
133
+ colors: { /* ... (colors from previous version) ... */ },
134
+ borderRadius: { /* ... (radii from previous version) ... */ },
135
+ inset: { /* ... (insets from previous version) ... */ },
136
  keyframes: {
137
  'popover-drop-in': {
138
+ '0%': { opacity: '0', transform: 'translateY(-100%) scale(0.9)' },
139
+ '70%': { opacity: '1', transform: 'translateY(5px) scale(1.02)' },
140
  '100%': { opacity: '1', transform: 'translateY(0) scale(1)' },
141
  },
142
  'popover-lift-out': {
143
  '0%': { opacity: '1', transform: 'translateY(0) scale(1)' },
144
+ '100%': { opacity: '0', transform: 'translateY(-100%) scale(0.9)' },
145
  }
146
  },
147
  animation: {
148
+ 'popover-open-top-center': 'popover-drop-in 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards',
149
+ 'popover-close-top-center': 'popover-lift-out 0.3s ease-in forwards',
150
  }
151
  }
152
  }
153
  }
154
  </script>
155
  </head>
156
+ <body class="antialiased bg-slate-50">
157
 
158
  <div class="w-full flex flex-col items-center justify-center min-h-[90dvh] md:min-h-screen">
159
  <div class="max-w-3xl w-full flex flex-col items-center justify-center h-full relative">
160
+ <!-- Header - Button order: Notification (L), Back (R) -->
161
  <div class="header-controls">
162
  <div id="notification-trigger-container">
163
  <button id="notification-button" aria-label="Notifications" class="header-button">
 
172
  </div>
173
 
174
  <div id="notification-popover-wrapper" class="notification-popover-wrapper">
175
+ <div id="notification-popover" class="popover-content initially-hidden">
176
  <div class="notification-popover-text-content">
177
  مدل‌های هوش مصنوعی می‌توانند اشتباه کنند، صحت اطلاعات مهم را بررسی کنید و از وارد کردن اطلاعات حساس بپرهیزید.
178
  </div>
179
  </div>
180
  </div>
181
 
182
+ <div class="w-full flex flex-col items-center justify-center h-[90dvh] bg-slate-50 top-0 left-0 relative">
183
  <video id="video-feed" autoplay playsinline class="absolute top-0 left-0 w-full h-full object-cover scale-x-[-1] hidden"></video>
184
  <div id="large-logo-container" class="hidden"></div>
185
 
186
  <div id="footer-controls" class="footer-controls layout-default">
187
+ <!-- Camera Button Wrapper (Now on the Left in RTL) -->
188
+ <div class="control-button-wrapper">
189
+ <div id="cam-switch-icon" class="camera-switch-icon">
190
+ <!-- SVG for Camera Switch (e.g., Lucide repeat or a custom one) -->
191
+ <svg 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" class="text-gray-700 dark:text-gray-300">
192
+ <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"/>
193
+ <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"/>
194
+ </svg>
195
  </div>
196
+ <div id="cam-button" class="control-button cam-button-color"></div>
197
  </div>
198
 
199
  <div id="small-logo-container" class="hidden"></div>
200
 
201
+ <!-- Mic Button (Now on the Right in RTL) -->
202
+ <div id="mic-button" class="control-button mic-button-color"></div>
 
203
  </div>
204
  </div>
205
  </div>
206
  </div>
207
 
208
+ <!-- SVG Icon Definitions (same as previous) -->
209
  <div style="display: none;">
210
+ <svg id="svg-pauseIcon">...</svg>
211
+ <svg id="svg-microphoneIcon">...</svg>
212
+ <svg id="svg-cameraIcon">...</svg>
213
+ <svg id="svg-stopCamIcon">...</svg>
214
+ <svg id="svg-humanIcon">...</svg>
 
 
 
 
 
 
215
  </div>
216
 
217
  <script>
 
220
  const smallLogoContainer = document.getElementById('small-logo-container');
221
  const micButton = document.getElementById('mic-button');
222
  const camButton = document.getElementById('cam-button');
223
+ const camSwitchIcon = document.getElementById('cam-switch-icon');
224
  const footerControls = document.getElementById('footer-controls');
225
  const notificationButton = document.getElementById('notification-button');
226
  const notificationPopover = document.getElementById('notification-popover');
 
229
  const microphoneIconSVG = document.getElementById('svg-microphoneIcon').cloneNode(true);
230
  const cameraIconSVG = document.getElementById('svg-cameraIcon').cloneNode(true);
231
  const stopCamIconSVG = document.getElementById('svg-stopCamIcon').cloneNode(true);
 
232
 
233
  let isMicActive = false;
234
  let isCamActive = false;
235
  let isNotificationOpen = false;
236
 
237
+ function createLogoHTML(isMini, isHumanActive, isAiActive) { /* ... same as before ... */
238
  if (!isHumanActive && !isAiActive) return '';
239
  const size = isMini ? 80 : 200;
240
  const iconSize = isMini ? 35 : 70;
241
  const insetBase = isMini ? { ping: 10, outer: 0, mid: 5, inner: 12, icon: 22 }
242
  : { ping: 40, outer: 0, mid: 20, inner: 50, icon: 65 };
243
  const bgColorBase = isHumanActive ? 'blue' : (isAiActive ? 'green' : 'gray');
244
+ const iconNode = isHumanActive ? document.getElementById('svg-humanIcon') : (isAiActive ? document.getElementById('svg-humanIcon') /* Placeholder */ : null);
245
  if (!iconNode) return '';
246
  const iconSVG = iconNode.cloneNode(true);
247
  iconSVG.setAttribute('width', iconSize);
248
  iconSVG.setAttribute('height', iconSize);
249
+ return `<div class="hidden bg-green-200 bg-green-300 bg-green-400 bg-blue-200 bg-blue-300 bg-blue-400"></div><div class="relative" style="width: ${size}px; height: ${size}px;"><div class="absolute rounded-full opacity-50 animate-ping bg-${bgColorBase}-200" style="inset: ${insetBase.ping}px;"></div><div class="absolute inset-0 rounded-full opacity-50 bg-${bgColorBase}-200"></div><div class="absolute rounded-full opacity-50 bg-${bgColorBase}-300" style="inset: ${insetBase.mid}px;"></div><div class="absolute inset-[50px] rounded-full opacity-50 bg-${bgColorBase}-400" style="inset: ${insetBase.inner}px;"></div><div class="z-10 absolute" style="inset: ${insetBase.icon}px;">${iconSVG.outerHTML}</div></div>`;
 
 
 
 
 
 
 
 
 
 
 
250
  }
251
 
252
  function updateUI() {
253
  videoFeed.classList.toggle('hidden', !isCamActive);
254
+ largeLogoContainer.classList.toggle('hidden', !(!isCamActive && isMicActive));
255
+ largeLogoContainer.classList.toggle('flex', !isCamActive && isMicActive);
256
+ if(!isCamActive && isMicActive) largeLogoContainer.innerHTML = createLogoHTML(false, true, false);
 
 
 
 
 
 
257
 
258
+ smallLogoContainer.classList.toggle('hidden', !isCamActive);
259
+ smallLogoContainer.classList.toggle('flex', isCamActive);
260
+ if(isCamActive) smallLogoContainer.innerHTML = createLogoHTML(true, true, false);
261
+
262
+ footerControls.classList.toggle('layout-default', !isCamActive);
263
+ footerControls.classList.toggle('layout-with-small-logo', isCamActive);
264
+
265
+ camSwitchIcon.classList.toggle('visible', isCamActive);
 
 
 
 
 
 
 
 
 
 
 
 
266
 
267
  camButton.innerHTML = '';
268
  camButton.appendChild(isCamActive ? stopCamIconSVG.cloneNode(true) : cameraIconSVG.cloneNode(true));
 
269
  micButton.innerHTML = '';
270
  micButton.appendChild(isMicActive ? pauseIconSVG.cloneNode(true) : microphoneIconSVG.cloneNode(true));
271
 
272
+ // Notification Popover
 
 
 
 
273
  if (isNotificationOpen) {
274
+ notificationPopover.classList.remove('initially-hidden', 'animate-popover-close-top-center');
275
+ notificationPopover.classList.add('open', 'animate-popover-open-top-center');
 
276
  } else {
277
+ if (notificationPopover.classList.contains('open')) { // Only animate close if it was open
278
+ notificationPopover.classList.remove('animate-popover-open-top-center');
279
+ notificationPopover.classList.add('animate-popover-close-top-center');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
280
  setTimeout(() => {
281
+ if (!isNotificationOpen) {
282
+ notificationPopover.classList.remove('open');
283
+ // Do not add initially-hidden here, opacity 0 from close animation handles it
284
+ }
285
+ }, 300);
286
  } else {
287
+ // If it was never opened, or already closed and hidden by animation, ensure it's visually gone.
288
+ notificationPopover.classList.remove('open'); // Ensure open is removed
289
+ notificationPopover.style.opacity = '0'; // Directly set opacity if not relying on class
290
+ notificationPopover.style.pointerEvents = 'none';
291
  }
292
  }
293
  }
 
295
  notificationButton.addEventListener('click', (event) => {
296
  event.stopPropagation();
297
  isNotificationOpen = !isNotificationOpen;
298
+ if(isNotificationOpen) { // If opening, remove initial hidden state
299
+ notificationPopover.classList.remove('initially-hidden');
300
+ notificationPopover.style.display = 'block'; // Make sure it's display block before animation
301
+ }
302
  updateUI();
303
  });
304
 
305
  document.addEventListener('click', (event) => {
306
  const popoverWrapper = document.getElementById('notification-popover-wrapper');
307
+ if (isNotificationOpen && !popoverWrapper.contains(event.target) && !notificationButton.contains(event.target) && !notificationPopover.contains(event.target) ) {
308
  isNotificationOpen = false;
309
  updateUI();
310
  }
 
312
 
313
  camButton.addEventListener('click', () => { isCamActive = !isCamActive; updateUI(); });
314
  micButton.addEventListener('click', () => { isMicActive = !isMicActive; updateUI(); });
315
+ camSwitchIcon.addEventListener('click', (e) => {
316
+ e.stopPropagation(); alert('Camera switch clicked!');
 
317
  });
318
 
319
+ // Ensure popover is fully hidden on initial load without triggering close animation
320
+ notificationPopover.classList.add('initially-hidden');
321
+ notificationPopover.classList.remove('open');
322
+ updateUI();
 
 
 
 
323
  </script>
324
  </body>
325
  </html>