Update index.html
Browse files- 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>هوشان -
|
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;
|
20 |
-
--
|
21 |
-
--
|
22 |
-
|
23 |
}
|
24 |
.dark {
|
25 |
-
--background: oklch(0.145 0 0);
|
26 |
-
--foreground: oklch(0.985 0 0);
|
27 |
-
--popover: oklch(0.205 0 0);
|
28 |
-
--popover-foreground: oklch(0.985 0 0);
|
29 |
-
--border: oklch(1 0 0 / 10%);
|
|
|
|
|
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
|
37 |
.notification-popover-wrapper {
|
38 |
-
position: fixed;
|
39 |
-
|
40 |
-
|
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-
|
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 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
}
|
65 |
-
|
66 |
.popover-content.open {
|
67 |
-
|
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 |
-
|
89 |
-
|
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:
|
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:
|
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;
|
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 |
-
|
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 |
-
.
|
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% +
|
149 |
left: 50%;
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
border-radius:
|
154 |
-
padding:
|
155 |
-
box-shadow: 0 2px 5px
|
156 |
cursor: pointer;
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
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 |
-
.
|
168 |
-
|
169 |
-
|
|
|
170 |
}
|
171 |
-
.
|
172 |
-
|
|
|
|
|
|
|
|
|
173 |
}
|
|
|
|
|
174 |
|
175 |
</style>
|
176 |
<script>
|
@@ -178,32 +130,34 @@
|
|
178 |
darkMode: 'class',
|
179 |
theme: {
|
180 |
extend: {
|
181 |
-
colors: { /*
|
182 |
-
borderRadius: { /*
|
183 |
-
inset: { /*
|
184 |
keyframes: {
|
185 |
'popover-drop-in': {
|
186 |
-
'0%': { opacity: '0', transform: 'translateY(-
|
|
|
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(-
|
192 |
}
|
193 |
},
|
194 |
animation: {
|
195 |
-
'popover-open-top-center': 'popover-drop-in 0.
|
196 |
-
'popover-close-top-center': 'popover-lift-out 0.
|
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-
|
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 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
|
|
|
|
239 |
</div>
|
|
|
240 |
</div>
|
241 |
|
242 |
<div id="small-logo-container" class="hidden"></div>
|
243 |
|
244 |
-
|
245 |
-
|
246 |
-
</div>
|
247 |
</div>
|
248 |
</div>
|
249 |
</div>
|
250 |
</div>
|
251 |
|
|
|
252 |
<div style="display: none;">
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
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
|
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 |
-
|
316 |
-
|
317 |
-
|
318 |
-
largeLogoContainer.classList.add('flex');
|
319 |
-
} else {
|
320 |
-
largeLogoContainer.innerHTML = '';
|
321 |
-
largeLogoContainer.classList.add('hidden');
|
322 |
-
largeLogoContainer.classList.remove('flex');
|
323 |
-
}
|
324 |
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
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 |
-
|
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(
|
359 |
-
notificationPopover.classList.add(
|
360 |
-
notificationPopover.classList.add(openAnimation);
|
361 |
} else {
|
362 |
-
if (notificationPopover.classList.contains(
|
363 |
-
notificationPopover.classList.remove(
|
364 |
-
notificationPopover.classList.add(
|
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 |
-
|
383 |
-
notificationPopover.classList.remove(
|
384 |
-
//
|
385 |
-
|
386 |
-
},
|
387 |
} else {
|
388 |
-
//
|
389 |
-
|
|
|
|
|
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 |
-
|
412 |
-
alert('دکمه تعویض دوربین کلیک شد!');
|
413 |
});
|
414 |
|
415 |
-
//
|
416 |
-
|
417 |
-
|
418 |
-
|
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>
|