Ezmary commited on
Commit
10eb6cb
·
verified ·
1 Parent(s): d1e3e16

Update src/App.tsx

Browse files
Files changed (1) hide show
  1. src/App.tsx +136 -43
src/App.tsx CHANGED
@@ -1,8 +1,4 @@
1
- /**
2
- Copyright 2024 Google LLC
3
- ... (لایسنس و توضیحات دیگر مثل قبل) ...
4
- */
5
-
6
  import React, { useEffect, useRef, useState } from "react";
7
  import './App.scss';
8
  import { LiveAPIProvider, useLiveAPIContext } from "./contexts/LiveAPIContext";
@@ -12,7 +8,6 @@ import { isIOS } from "./lib/platform";
12
  import cn from "classnames";
13
  import { LiveConfig } from "./multimodal-live-types";
14
 
15
- // ... (myCustomInstruction, initialAppConfig, SvgHumanIcon, SvgOriginalMicrophoneIcon بدون تغییر) ...
16
  const myCustomInstruction = `
17
  ت1. هویت دستیار:
18
 
@@ -97,6 +92,7 @@ const initialAppConfig: LiveConfig = {
97
  },
98
  };
99
 
 
100
  const SvgHumanIcon = () => (
101
  <svg width="100%" height="100%" viewBox="0 0 88 89" fill="none" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet">
102
  <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="currentColor" strokeWidth="6.42146" strokeLinecap="round" strokeLinejoin="round"/>
@@ -104,11 +100,15 @@ const SvgHumanIcon = () => (
104
  </svg>
105
  );
106
 
107
- const SvgOriginalMicrophoneIcon = () => <svg width="38" height="38" viewBox="0 0 69 68" fill="none" xmlns="http://www.w3.org/2000/svg" transform="scale(0.55)" className="reference-mic-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>;
108
-
 
 
 
 
109
 
110
- // *** MODIFIED: تعریف دقیق تایپ پراپ‌ها برای AppInternalLogic ***
111
- interface AppInternalLogicProps {
112
  isMicActive: boolean;
113
  isCamActive: boolean;
114
  setIsMicActive: React.Dispatch<React.SetStateAction<boolean>>;
@@ -119,9 +119,7 @@ interface AppInternalLogicProps {
119
  notificationButtonRef: React.RefObject<HTMLButtonElement>;
120
  isNotificationOpen: boolean;
121
  setIsNotificationOpen: React.Dispatch<React.SetStateAction<boolean>>;
122
- }
123
-
124
- const AppInternalLogic: React.FC<AppInternalLogicProps> = ({
125
  isMicActive,
126
  isCamActive,
127
  setIsMicActive,
@@ -133,7 +131,6 @@ const AppInternalLogic: React.FC<AppInternalLogicProps> = ({
133
  isNotificationOpen,
134
  setIsNotificationOpen
135
  }) => {
136
- // ... (منطق داخلی کامپوننت AppInternalLogic بدون تغییر) ...
137
  const { connected, disconnect } = useLiveAPIContext();
138
 
139
  useEffect(() => {
@@ -147,28 +144,61 @@ const AppInternalLogic: React.FC<AppInternalLogicProps> = ({
147
  <div className="main-wrapper max-w-3xl w-full flex flex-col items-center justify-center h-full relative">
148
  <div className="header-controls">
149
  <div id="notification-trigger-container">
150
- <button ref={notificationButtonRef} id="notification-button" aria-label="Notifications" className="header-button"
151
- onClick={(e) => { e.stopPropagation(); setIsNotificationOpen(!isNotificationOpen); }}>
 
 
 
 
 
 
 
 
152
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>
153
  </button>
154
  </div>
155
  <div className="back-button-container">
156
- <button id="back-button" aria-label="Go back" className="header-button" onClick={() => alert('Back clicked')}>
 
 
 
 
 
157
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="m15 18-6-6 6-6"></path></svg>
158
  </button>
159
  </div>
160
  </div>
161
 
162
  <div ref={notificationPopoverRef} id="notification-popover-wrapper" className="notification-popover-wrapper">
163
- <div id="notification-popover" className={cn("popover-content", { "open animate-popover-open-top-center": isNotificationOpen, "animate-popover-close-top-center": !isNotificationOpen && document.getElementById('notification-popover')?.classList.contains('open'), })}>
164
- <div className="notification-popover-text-content">مدل‌های هوش مصنوعی می‌توانند اشتباه کنند، صحت اطلاعات مهم را بررسی کنید و از وارد کردن اطلاعات حساس بپرهیزید.</div>
 
 
 
 
 
 
 
 
165
  </div>
166
  </div>
167
 
168
  <div className="media-area w-full flex flex-col items-center justify-center flex-grow relative">
169
- <video id="video-feed" ref={videoRef} autoPlay playsInline className={cn("absolute top-0 left-0 w-full h-full object-cover scale-x-[-1]", { "hidden": !isCamActive })} />
 
 
 
 
 
 
 
 
 
170
  {isMicActive && !isCamActive && (
171
- <div className="large-logo-container-class">
 
 
 
172
  {createLogoFunction(false, true, 'human', false)}
173
  </div>
174
  )}
@@ -183,51 +213,110 @@ const AppInternalLogic: React.FC<AppInternalLogicProps> = ({
183
  isAppCamActive={isCamActive}
184
  onAppCamToggle={setIsCamActive}
185
  createLogoFunction={createLogoFunction}
186
- ReferenceMicrophoneIcon={SvgOriginalMicrophoneIcon}
187
  />
188
  </div>
189
  </div>
190
  );
191
- };
 
192
 
193
- // ... (logoColorConfig و تابع App و createLogoFunction بدون تغییر نسبت به پاسخ قبلی) ...
194
  const logoColorConfig = {
195
- blue: { ping: "bg-blue-200 dark:bg-blue-700", outer: "bg-blue-200 dark:bg-blue-700", mid: "bg-blue-300 dark:bg-blue-600", inner: "bg-blue-400 dark:bg-blue-500", },
196
- green: { ping: "bg-green-200 dark:bg-green-700", outer: "bg-green-200 dark:bg-green-700", mid: "bg-green-300 dark:bg-green-600", inner: "bg-green-400 dark:bg-green-500", },
197
- gray: { ping: "bg-gray-200 dark:bg-gray-700", outer: "bg-gray-200 dark:bg-gray-700", mid: "bg-gray-300 dark:bg-gray-600", inner: "bg-gray-400 dark:bg-gray-500", }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  };
199
 
200
  function App() {
201
  const videoRef = useRef<HTMLVideoElement>(null);
202
  const [showIOSModal, setShowIOSModal] = useState(false);
203
  const [isAllowedOrigin, setIsAllowedOrigin] = useState<boolean | null>(null);
 
204
  const [isMicActive, setIsMicActive] = useState(false);
205
  const [isCamActive, setIsCamActive] = useState(false);
206
  const [isNotificationOpen, setIsNotificationOpen] = useState(false);
 
207
  const notificationPopoverRef = useRef<HTMLDivElement>(null);
208
  const notificationButtonRef = useRef<HTMLButtonElement>(null);
209
 
210
- useEffect(() => { if (isIOS()) { setShowIOSModal(true); } const timer = setTimeout(() => { setIsAllowedOrigin(true); }, 100); return () => clearTimeout(timer); }, []);
211
- useEffect(() => { const handleClickOutside = (event: MouseEvent) => { if (isNotificationOpen && notificationPopoverRef.current && !notificationPopoverRef.current.contains(event.target as Node) && notificationButtonRef.current && !notificationButtonRef.current.contains(event.target as Node)) { setIsNotificationOpen(false); } }; document.addEventListener("mousedown", handleClickOutside); return () => { document.removeEventListener("mousedown", handleClickOutside); }; }, [isNotificationOpen]);
212
- if (isAllowedOrigin === null) { return <div style={{ padding: '20px', textAlign: 'center' }}>در حال بررسی دسترسی...</div>; }
 
 
 
 
 
 
213
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
214
  const createLogoFunction = (isMini: boolean, isActive: boolean, type: 'human' | 'ai' = 'human', forFooter: boolean = false) => {
215
  if (!isActive) return null;
216
- const colorKey = type === 'human' ? 'blue' : 'gray';
217
- const currentColors = logoColorConfig[colorKey as keyof typeof logoColorConfig];
 
 
218
  const size = isMini ? 80 : 200;
219
  const iconDisplaySize = isMini ? 35 : 70;
220
  const iconInset = (size - iconDisplaySize) / 2;
221
- const baseInsets = isMini
222
- ? { ping: 10, outer: 0, mid: 5, inner: 12 }
223
- : { ping: 40, outer: 0, mid: 20, inner: 50 };
 
 
 
 
 
224
  const IconComponent = type === 'human' ? SvgHumanIcon : null;
 
225
  return (
226
  <div className={cn("logo-animation-wrapper", {"for-footer": forFooter})} style={{ width: `${size}px`, height: `${size}px` }}>
227
- <div className={`absolute rounded-full opacity-50 animate-ping ${currentColors.ping}`} style={{ inset: `${baseInsets.ping}px` }}></div>
228
- <div className={`absolute rounded-full opacity-50 ${currentColors.outer}`} style={{ inset: `${baseInsets.outer}px` }}></div>
229
- <div className={`absolute rounded-full opacity-50 ${currentColors.mid}`} style={{ inset: `${baseInsets.mid}px` }}></div>
230
- <div className={`absolute rounded-full opacity-50 ${currentColors.inner}`} style={{ inset: `${baseInsets.inner}px` }}></div>
 
 
 
 
 
231
  <div className="z-10 absolute flex items-center justify-center" style={{ inset: `${iconInset}px`, width: `${iconDisplaySize}px`, height: `${iconDisplaySize}px` }}>
232
  {IconComponent && <IconComponent />}
233
  </div>
@@ -238,12 +327,16 @@ function App() {
238
  return (
239
  <LiveAPIProvider initialConfig={initialAppConfig}>
240
  <AppInternalLogic
241
- isMicActive={isMicActive} setIsMicActive={setIsMicActive}
242
- isCamActive={isCamActive} setIsCamActive={setIsCamActive}
 
 
243
  createLogoFunction={createLogoFunction}
244
  videoRef={videoRef}
245
- notificationPopoverRef={notificationPopoverRef} notificationButtonRef={notificationButtonRef}
246
- isNotificationOpen={isNotificationOpen} setIsNotificationOpen={setIsNotificationOpen}
 
 
247
  />
248
  <IOSModal isOpen={showIOSModal} onClose={() => setShowIOSModal(false)} />
249
  </LiveAPIProvider>
 
1
+ // ... (ایمپورت‌ها، myCustomInstruction, initialAppConfig, SvgHumanIcon, SvgReferenceMicrophoneIcon بدون تغییر) ...
 
 
 
 
2
  import React, { useEffect, useRef, useState } from "react";
3
  import './App.scss';
4
  import { LiveAPIProvider, useLiveAPIContext } from "./contexts/LiveAPIContext";
 
8
  import cn from "classnames";
9
  import { LiveConfig } from "./multimodal-live-types";
10
 
 
11
  const myCustomInstruction = `
12
  ت1. هویت دستیار:
13
 
 
92
  },
93
  };
94
 
95
+
96
  const SvgHumanIcon = () => (
97
  <svg width="100%" height="100%" viewBox="0 0 88 89" fill="none" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet">
98
  <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="currentColor" strokeWidth="6.42146" strokeLinecap="round" strokeLinejoin="round"/>
 
100
  </svg>
101
  );
102
 
103
+ const SvgReferenceMicrophoneIcon = () => (
104
+ <svg className="reference-mic-svg" viewBox="0 0 69 68" fill="none" xmlns="http://www.w3.org/2000/svg">
105
+ <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"/>
106
+ <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"/>
107
+ </svg>
108
+ );
109
 
110
+ // ... (AppInternalLogic بدون تغییر) ...
111
+ const AppInternalLogic: React.FC<{
112
  isMicActive: boolean;
113
  isCamActive: boolean;
114
  setIsMicActive: React.Dispatch<React.SetStateAction<boolean>>;
 
119
  notificationButtonRef: React.RefObject<HTMLButtonElement>;
120
  isNotificationOpen: boolean;
121
  setIsNotificationOpen: React.Dispatch<React.SetStateAction<boolean>>;
122
+ }> = ({
 
 
123
  isMicActive,
124
  isCamActive,
125
  setIsMicActive,
 
131
  isNotificationOpen,
132
  setIsNotificationOpen
133
  }) => {
 
134
  const { connected, disconnect } = useLiveAPIContext();
135
 
136
  useEffect(() => {
 
144
  <div className="main-wrapper max-w-3xl w-full flex flex-col items-center justify-center h-full relative">
145
  <div className="header-controls">
146
  <div id="notification-trigger-container">
147
+ <button
148
+ ref={notificationButtonRef}
149
+ id="notification-button"
150
+ aria-label="Notifications"
151
+ className="header-button"
152
+ onClick={(e) => {
153
+ e.stopPropagation();
154
+ setIsNotificationOpen(!isNotificationOpen);
155
+ }}
156
+ >
157
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>
158
  </button>
159
  </div>
160
  <div className="back-button-container">
161
+ <button
162
+ id="back-button"
163
+ aria-label="Go back"
164
+ className="header-button"
165
+ onClick={() => alert('Back clicked (implement navigation)')}
166
+ >
167
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="m15 18-6-6 6-6"></path></svg>
168
  </button>
169
  </div>
170
  </div>
171
 
172
  <div ref={notificationPopoverRef} id="notification-popover-wrapper" className="notification-popover-wrapper">
173
+ <div
174
+ id="notification-popover"
175
+ className={cn("popover-content", {
176
+ "open animate-popover-open-top-center": isNotificationOpen,
177
+ "animate-popover-close-top-center": !isNotificationOpen && document.getElementById('notification-popover')?.classList.contains('open'),
178
+ })}
179
+ >
180
+ <div className="notification-popover-text-content">
181
+ مدل‌های هوش مصنوعی می‌توانند اشتباه کنند، صحت اطلاعات مهم را بررسی کنید و از وارد کردن اطلاعات حساس بپرهیزید.
182
+ </div>
183
  </div>
184
  </div>
185
 
186
  <div className="media-area w-full flex flex-col items-center justify-center flex-grow relative">
187
+ <video
188
+ id="video-feed"
189
+ ref={videoRef}
190
+ autoPlay
191
+ playsInline
192
+ className={cn(
193
+ "absolute top-0 left-0 w-full h-full object-cover scale-x-[-1]",
194
+ { "hidden": !isCamActive }
195
+ )}
196
+ />
197
  {isMicActive && !isCamActive && (
198
+ <div
199
+ id="large-logo-container"
200
+ className="absolute top-0 left-0 w-full h-full flex items-center justify-center pointer-events-none"
201
+ >
202
  {createLogoFunction(false, true, 'human', false)}
203
  </div>
204
  )}
 
213
  isAppCamActive={isCamActive}
214
  onAppCamToggle={setIsCamActive}
215
  createLogoFunction={createLogoFunction}
216
+ ReferenceMicrophoneIcon={SvgReferenceMicrophoneIcon}
217
  />
218
  </div>
219
  </div>
220
  );
221
+ }
222
+
223
 
 
224
  const logoColorConfig = {
225
+ blue: {
226
+ ping: "bg-blue-200 dark:bg-blue-700",
227
+ outer: "bg-blue-200 dark:bg-blue-700",
228
+ mid: "bg-blue-300 dark:bg-blue-600",
229
+ inner: "bg-blue-400 dark:bg-blue-500",
230
+ },
231
+ green: {
232
+ ping: "bg-green-200 dark:bg-green-700",
233
+ outer: "bg-green-200 dark:bg-green-700",
234
+ mid: "bg-green-300 dark:bg-green-600",
235
+ inner: "bg-green-400 dark:bg-green-500",
236
+ },
237
+ gray: {
238
+ ping: "bg-gray-200 dark:bg-gray-700",
239
+ outer: "bg-gray-200 dark:bg-gray-700",
240
+ mid: "bg-gray-300 dark:bg-gray-600",
241
+ inner: "bg-gray-400 dark:bg-gray-500",
242
+ }
243
  };
244
 
245
  function App() {
246
  const videoRef = useRef<HTMLVideoElement>(null);
247
  const [showIOSModal, setShowIOSModal] = useState(false);
248
  const [isAllowedOrigin, setIsAllowedOrigin] = useState<boolean | null>(null);
249
+
250
  const [isMicActive, setIsMicActive] = useState(false);
251
  const [isCamActive, setIsCamActive] = useState(false);
252
  const [isNotificationOpen, setIsNotificationOpen] = useState(false);
253
+
254
  const notificationPopoverRef = useRef<HTMLDivElement>(null);
255
  const notificationButtonRef = useRef<HTMLButtonElement>(null);
256
 
257
+ useEffect(() => {
258
+ if (isIOS()) {
259
+ setShowIOSModal(true);
260
+ }
261
+ const timer = setTimeout(() => {
262
+ setIsAllowedOrigin(true);
263
+ }, 100);
264
+ return () => clearTimeout(timer);
265
+ }, []);
266
 
267
+ useEffect(() => {
268
+ const handleClickOutside = (event: MouseEvent) => {
269
+ if (
270
+ isNotificationOpen &&
271
+ notificationPopoverRef.current &&
272
+ !notificationPopoverRef.current.contains(event.target as Node) &&
273
+ notificationButtonRef.current &&
274
+ !notificationButtonRef.current.contains(event.target as Node)
275
+ ) {
276
+ setIsNotificationOpen(false);
277
+ }
278
+ };
279
+ document.addEventListener("mousedown", handleClickOutside);
280
+ return () => {
281
+ document.removeEventListener("mousedown", handleClickOutside);
282
+ };
283
+ }, [isNotificationOpen]);
284
+
285
+ if (isAllowedOrigin === null) {
286
+ return <div style={{ padding: '20px', textAlign: 'center' }}>در حال بررسی دسترسی...</div>;
287
+ }
288
+
289
+ // *** MODIFIED: createLogoFunction با دقت بیشتر در inset ها و رنگ ها ***
290
  const createLogoFunction = (isMini: boolean, isActive: boolean, type: 'human' | 'ai' = 'human', forFooter: boolean = false) => {
291
  if (!isActive) return null;
292
+
293
+ const colorKey = type === 'human' ? 'blue' : (type === 'ai' ? 'green' : 'gray');
294
+ const currentColors = logoColorConfig[colorKey as keyof typeof logoColorConfig] || logoColorConfig.gray;
295
+
296
  const size = isMini ? 80 : 200;
297
  const iconDisplaySize = isMini ? 35 : 70;
298
  const iconInset = (size - iconDisplaySize) / 2;
299
+
300
+ // مقادیر inset برای حلقه‌ها از HTML مرجع شما (با توجه به isMini)
301
+ // این مقادیر باید دقیق باشند تا حلقه‌ها درست نمایش داده شوند.
302
+ const pingInset = isMini ? 10 : 40;
303
+ const outerInset = 0; // در HTML مرجع شما، outer ring معمولاً inset صفر دارد
304
+ const midInset = isMini ? 5 : 20;
305
+ const innerInset = isMini ? 12 : 50;
306
+
307
  const IconComponent = type === 'human' ? SvgHumanIcon : null;
308
+
309
  return (
310
  <div className={cn("logo-animation-wrapper", {"for-footer": forFooter})} style={{ width: `${size}px`, height: `${size}px` }}>
311
+ {/* حلقه Ping (متحرک) */}
312
+ <div className={`absolute rounded-full opacity-50 animate-ping ${currentColors.ping}`} style={{ inset: `${pingInset}px` }}></div>
313
+ {/* حلقه بیرونی */}
314
+ <div className={`absolute rounded-full opacity-50 ${currentColors.outer}`} style={{ inset: `${outerInset}px` }}></div>
315
+ {/* حلقه میانی */}
316
+ <div className={`absolute rounded-full opacity-50 ${currentColors.mid}`} style={{ inset: `${midInset}px` }}></div>
317
+ {/* حلقه داخلی */}
318
+ <div className={`absolute rounded-full opacity-50 ${currentColors.inner}`} style={{ inset: `${innerInset}px` }}></div>
319
+ {/* کانتینر آیکون */}
320
  <div className="z-10 absolute flex items-center justify-center" style={{ inset: `${iconInset}px`, width: `${iconDisplaySize}px`, height: `${iconDisplaySize}px` }}>
321
  {IconComponent && <IconComponent />}
322
  </div>
 
327
  return (
328
  <LiveAPIProvider initialConfig={initialAppConfig}>
329
  <AppInternalLogic
330
+ isMicActive={isMicActive}
331
+ setIsMicActive={setIsMicActive}
332
+ isCamActive={isCamActive}
333
+ setIsCamActive={setIsCamActive}
334
  createLogoFunction={createLogoFunction}
335
  videoRef={videoRef}
336
+ notificationPopoverRef={notificationPopoverRef}
337
+ notificationButtonRef={notificationButtonRef}
338
+ isNotificationOpen={isNotificationOpen}
339
+ setIsNotificationOpen={setIsNotificationOpen}
340
  />
341
  <IOSModal isOpen={showIOSModal} onClose={() => setShowIOSModal(false)} />
342
  </LiveAPIProvider>