Ezmary commited on
Commit
471c273
·
verified ·
1 Parent(s): 4d9ef16

Update src/App.tsx

Browse files
Files changed (1) hide show
  1. src/App.tsx +37 -31
src/App.tsx CHANGED
@@ -112,15 +112,37 @@ const SvgHumanIcon = () => (
112
  );
113
 
114
  const SvgReferenceMicrophoneIcon = () => (
115
- // transform="scale(0.55)" را موقتا حذف می کنیم تا با CSS کنترل شود یا اگر لازم بود برمیگردانیم
116
  <svg width="69" height="68" viewBox="0 0 69 68" fill="none" xmlns="http://www.w3.org/2000/svg">
117
  <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"/>
118
  <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"/>
119
  </svg>
120
  );
121
 
122
- const AppInternalLogic: React.FC<{ /* ...props... */ }> = ({ /* ...props... */ }) => {
123
- // ... (بدون تغییر نسبت به نسخه کامل قبلی)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  const { connected, disconnect } = useLiveAPIContext();
125
 
126
  useEffect(() => {
@@ -132,7 +154,6 @@ const AppInternalLogic: React.FC<{ /* ...props... */ }> = ({ /* ...props... */ }
132
  return (
133
  <div className="app-container w-full flex flex-col items-center justify-center text-foreground antialiased">
134
  <div className="main-wrapper max-w-3xl w-full flex flex-col items-center justify-center h-full relative">
135
- {/* Header and Notification Popover (بدون تغییر) */}
136
  <div className="header-controls">
137
  <div id="notification-trigger-container">
138
  <button
@@ -209,35 +230,21 @@ const AppInternalLogic: React.FC<{ /* ...props... */ }> = ({ /* ...props... */ }
209
  </div>
210
  );
211
  };
212
- // ... (Props for AppInternalLogic)
213
- interface AppInternalLogicProps {
214
- isMicActive: boolean;
215
- isCamActive: boolean;
216
- setIsMicActive: React.Dispatch<React.SetStateAction<boolean>>;
217
- setIsCamActive: React.Dispatch<React.SetStateAction<boolean>>;
218
- createLogoFunction: (isMini: boolean, isActive: boolean, type?: 'human' | 'ai', forFooter?: boolean) => React.ReactNode;
219
- videoRef: React.RefObject<HTMLVideoElement>;
220
- notificationPopoverRef: React.RefObject<HTMLDivElement>;
221
- notificationButtonRef: React.RefObject<HTMLButtonElement>;
222
- isNotificationOpen: boolean;
223
- setIsNotificationOpen: React.Dispatch<React.SetStateAction<boolean>>;
224
- }
225
-
226
 
227
- const logoColorConfig = { /* ... (بدون تغییر) ... */
228
- blue: {
229
  ping: "bg-blue-200 dark:bg-blue-700",
230
  outer: "bg-blue-200 dark:bg-blue-700",
231
  mid: "bg-blue-300 dark:bg-blue-600",
232
  inner: "bg-blue-400 dark:bg-blue-500",
233
  },
234
- green: {
235
  ping: "bg-green-200 dark:bg-green-700",
236
  outer: "bg-green-200 dark:bg-green-700",
237
  mid: "bg-green-300 dark:bg-green-600",
238
  inner: "bg-green-400 dark:bg-green-500",
239
  },
240
- gray: {
241
  ping: "bg-gray-200 dark:bg-gray-700",
242
  outer: "bg-gray-200 dark:bg-gray-700",
243
  mid: "bg-gray-300 dark:bg-gray-600",
@@ -245,7 +252,7 @@ const logoColorConfig = { /* ... (بدون تغییر) ... */
245
  }
246
  };
247
 
248
- function App() { // ... (بدون تغییر نسبت به نسخه کامل قبلی)
249
  const videoRef = useRef<HTMLVideoElement>(null);
250
  const [showIOSModal, setShowIOSModal] = useState(false);
251
  const [isAllowedOrigin, setIsAllowedOrigin] = useState<boolean | null>(null);
@@ -295,24 +302,24 @@ function App() { // ... (بدون تغییر نسبت به نسخه کامل ق
295
  const colorKey = type === 'human' ? 'blue' : (type === 'ai' ? 'green' : 'gray');
296
  const currentColors = logoColorConfig[colorKey as keyof typeof logoColorConfig] || logoColorConfig.gray;
297
 
298
- const size = isMini ? 80 : 200;
299
- const iconDisplaySize = isMini ? 35 : 70;
300
  const iconInset = (size - iconDisplaySize) / 2;
301
 
302
  const insetBase = {
303
- ping: isMini ? 10 : 40,
304
- outer: 0,
305
  mid: isMini ? 5 : 20,
306
  inner: isMini ? 12 : 50,
307
- icon: iconInset
308
  };
309
 
310
- const IconComponent = type === 'human' ? SvgHumanIcon : null;
311
 
312
  return (
313
  <div className={cn("logo-animation-wrapper", {"for-footer": forFooter})} style={{ width: `${size}px`, height: `${size}px` }}>
314
  <div className={`absolute rounded-full opacity-50 animate-ping ${currentColors.ping}`} style={{ inset: `${insetBase.ping}px` }}></div>
315
- <div className={`absolute rounded-full opacity-50 ${currentColors.outer}`} style={{ inset: `${insetBase.outer}px` }}></div>
316
  <div className={`absolute rounded-full opacity-50 ${currentColors.mid}`} style={{ inset: `${insetBase.mid}px` }}></div>
317
  <div className={`absolute rounded-full opacity-50 ${currentColors.inner}`} style={{ inset: `${insetBase.inner}px` }}></div>
318
  <div className="z-10 absolute flex items-center justify-center" style={{ inset: `${insetBase.icon}px`, width: `${iconDisplaySize}px`, height: `${iconDisplaySize}px` }}>
@@ -322,7 +329,6 @@ function App() { // ... (بدون تغییر نسبت به نسخه کامل ق
322
  );
323
  };
324
 
325
-
326
  return (
327
  <LiveAPIProvider initialConfig={initialAppConfig}>
328
  <AppInternalLogic
 
112
  );
113
 
114
  const SvgReferenceMicrophoneIcon = () => (
 
115
  <svg width="69" height="68" viewBox="0 0 69 68" fill="none" xmlns="http://www.w3.org/2000/svg">
116
  <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"/>
117
  <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"/>
118
  </svg>
119
  );
120
 
121
+ interface AppInternalLogicProps {
122
+ isMicActive: boolean;
123
+ isCamActive: boolean;
124
+ setIsMicActive: React.Dispatch<React.SetStateAction<boolean>>;
125
+ setIsCamActive: React.Dispatch<React.SetStateAction<boolean>>;
126
+ createLogoFunction: (isMini: boolean, isActive: boolean, type?: 'human' | 'ai', forFooter?: boolean) => React.ReactNode;
127
+ videoRef: React.RefObject<HTMLVideoElement>;
128
+ notificationPopoverRef: React.RefObject<HTMLDivElement>;
129
+ notificationButtonRef: React.RefObject<HTMLButtonElement>;
130
+ isNotificationOpen: boolean;
131
+ setIsNotificationOpen: React.Dispatch<React.SetStateAction<boolean>>;
132
+ }
133
+
134
+ const AppInternalLogic: React.FC<AppInternalLogicProps> = ({
135
+ isMicActive,
136
+ isCamActive,
137
+ setIsMicActive,
138
+ setIsCamActive,
139
+ createLogoFunction,
140
+ videoRef,
141
+ notificationPopoverRef,
142
+ notificationButtonRef,
143
+ isNotificationOpen,
144
+ setIsNotificationOpen
145
+ }) => {
146
  const { connected, disconnect } = useLiveAPIContext();
147
 
148
  useEffect(() => {
 
154
  return (
155
  <div className="app-container w-full flex flex-col items-center justify-center text-foreground antialiased">
156
  <div className="main-wrapper max-w-3xl w-full flex flex-col items-center justify-center h-full relative">
 
157
  <div className="header-controls">
158
  <div id="notification-trigger-container">
159
  <button
 
230
  </div>
231
  );
232
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
 
234
+ const logoColorConfig = {
235
+ blue: {
236
  ping: "bg-blue-200 dark:bg-blue-700",
237
  outer: "bg-blue-200 dark:bg-blue-700",
238
  mid: "bg-blue-300 dark:bg-blue-600",
239
  inner: "bg-blue-400 dark:bg-blue-500",
240
  },
241
+ green: {
242
  ping: "bg-green-200 dark:bg-green-700",
243
  outer: "bg-green-200 dark:bg-green-700",
244
  mid: "bg-green-300 dark:bg-green-600",
245
  inner: "bg-green-400 dark:bg-green-500",
246
  },
247
+ gray: {
248
  ping: "bg-gray-200 dark:bg-gray-700",
249
  outer: "bg-gray-200 dark:bg-gray-700",
250
  mid: "bg-gray-300 dark:bg-gray-600",
 
252
  }
253
  };
254
 
255
+ function App() {
256
  const videoRef = useRef<HTMLVideoElement>(null);
257
  const [showIOSModal, setShowIOSModal] = useState(false);
258
  const [isAllowedOrigin, setIsAllowedOrigin] = useState<boolean | null>(null);
 
302
  const colorKey = type === 'human' ? 'blue' : (type === 'ai' ? 'green' : 'gray');
303
  const currentColors = logoColorConfig[colorKey as keyof typeof logoColorConfig] || logoColorConfig.gray;
304
 
305
+ const size = isMini ? 80 : 200;
306
+ const iconDisplaySize = isMini ? 35 : 70;
307
  const iconInset = (size - iconDisplaySize) / 2;
308
 
309
  const insetBase = {
310
+ ping: isMini ? 10 : 40,
311
+ outer: 0,
312
  mid: isMini ? 5 : 20,
313
  inner: isMini ? 12 : 50,
314
+ icon: iconInset
315
  };
316
 
317
+ const IconComponent = type === 'human' ? SvgHumanIcon : null;
318
 
319
  return (
320
  <div className={cn("logo-animation-wrapper", {"for-footer": forFooter})} style={{ width: `${size}px`, height: `${size}px` }}>
321
  <div className={`absolute rounded-full opacity-50 animate-ping ${currentColors.ping}`} style={{ inset: `${insetBase.ping}px` }}></div>
322
+ <div className={`absolute rounded-full opacity-50 ${currentColors.outer}`} style={{ inset: `${insetBase.outer}px` }}></div>
323
  <div className={`absolute rounded-full opacity-50 ${currentColors.mid}`} style={{ inset: `${insetBase.mid}px` }}></div>
324
  <div className={`absolute rounded-full opacity-50 ${currentColors.inner}`} style={{ inset: `${insetBase.inner}px` }}></div>
325
  <div className="z-10 absolute flex items-center justify-center" style={{ inset: `${insetBase.icon}px`, width: `${iconDisplaySize}px`, height: `${iconDisplaySize}px` }}>
 
329
  );
330
  };
331
 
 
332
  return (
333
  <LiveAPIProvider initialConfig={initialAppConfig}>
334
  <AppInternalLogic