Ezmary commited on
Commit
59b7349
·
verified ·
1 Parent(s): 65b68d0

Update src/App.tsx

Browse files
Files changed (1) hide show
  1. src/App.tsx +44 -35
src/App.tsx CHANGED
@@ -19,7 +19,6 @@ import { IOSModal } from "./components/ios-modal/IOSModal";
19
  import { isIOS } from "./lib/platform";
20
  import cn from "classnames";
21
  import { LiveConfig } from "./multimodal-live-types";
22
- // Altair و SidePanel حذف شدند چون در ظاهر جدید جایی ندارند
23
 
24
  const myCustomInstruction = `
25
  ت1. هویت دستیار:
@@ -105,8 +104,6 @@ const initialAppConfig: LiveConfig = {
105
  },
106
  };
107
 
108
- // آیکون انسان از HTML شما (برای لوگوی بزرگ و کوچک)
109
- // stroke="currentColor" باعث می‌شود رنگ خطوط از CSS (var(--foreground)) ارث‌بری کند
110
  const SvgHumanIcon = () => (
111
  <svg 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="currentColor" strokeWidth="6.42146" strokeLinecap="round" strokeLinejoin="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="currentColor" strokeWidth="6.42146" strokeLinecap="round" strokeLinejoin="round"/></svg>
112
  );
@@ -143,14 +140,10 @@ const AppInternalLogic: React.FC<{
143
  }, [isMicActive, isCamActive, connected, disconnect]);
144
 
145
  return (
146
- // کلاس‌های اصلی از body و div والد در HTML مرجع
147
- // min-h-[90dvh] md:min-h-screen
148
- <div className="w-full flex flex-col items-center justify-center min-h-screen text-foreground antialiased"> {/* استفاده از min-h-screen برای پر کردن کامل ارتفاع */}
149
- {/* Wrapper داخلی از HTML: "max-w-3xl w-full flex flex-col items-center justify-center h-full relative" */}
150
  <div className="max-w-3xl w-full flex flex-col items-center justify-center h-full relative">
151
- {/* Header Controls - ترتیب دکمه‌ها مطابق HTML (نوتیفیکیشن چپ، بازگشت راست) */}
152
  <div className="header-controls">
153
- <div id="notification-trigger-container"> {/* Wrapper از HTML */}
154
  <button
155
  ref={notificationButtonRef}
156
  id="notification-button"
@@ -164,14 +157,13 @@ const AppInternalLogic: React.FC<{
164
  <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>
165
  </button>
166
  </div>
167
- <div className="back-button-container"> {/* Wrapper از HTML */}
168
  <div className="header-button" onClick={() => alert('Back clicked (implement navigation)')}>
169
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" 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>
170
  </div>
171
  </div>
172
  </div>
173
 
174
- {/* Notification Popover */}
175
  <div ref={notificationPopoverRef} id="notification-popover-wrapper" className="notification-popover-wrapper">
176
  <div
177
  id="notification-popover"
@@ -186,27 +178,24 @@ const AppInternalLogic: React.FC<{
186
  </div>
187
  </div>
188
 
189
- {/* MediaToggle Area - از HTML: "w-full flex flex-col items-center justify-center h-[90dvh] bg-background top-0 left-0 relative" */}
190
- {/* h-[90dvh] با flex-grow جایگزین می‌شود و bg-background از body می‌آید */}
191
- <div className="w-full flex flex-col items-center justify-center flex-grow relative"> {/* flex-grow برای پر کردن ارتفاع */}
192
  <video
193
- id="video-feed" // id از HTML
194
  ref={videoRef}
195
  autoPlay
196
  playsInline
197
  className={cn(
198
- "absolute top-0 left-0 w-full h-full object-cover scale-x-[-1]", // کلاس‌های HTML
199
- { "hidden": !isCamActive } // کلاس hidden از HTML
200
  )}
201
  />
202
- {/* large-logo-container - کلاس hidden و flex از HTML */}
203
  <div
204
- id="large-logo-container" // id از HTML
205
  className={cn(
206
- "absolute top-0 left-0 w-full h-full", // برای پوشاندن کل فضا
207
  {
208
- "flex items-center justify-center": isMicActive && !isCamActive, // نمایش لوگو با flex
209
- "hidden": !isMicActive || isCamActive, // مخفی کردن در غیر این صورت
210
  }
211
  )}
212
  >
@@ -229,6 +218,28 @@ const AppInternalLogic: React.FC<{
229
  );
230
  }
231
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
232
  function App() {
233
  const videoRef = useRef<HTMLVideoElement>(null);
234
  const [showIOSModal, setShowIOSModal] = useState(false);
@@ -275,27 +286,25 @@ function App() {
275
 
276
  const createLogoFunction = (isMini: boolean, isActive: boolean, type: 'human' | 'ai' = 'human') => {
277
  if (!isActive) return null;
278
- const size = isMini ? 80 : 200; // مقادیر از JS در HTML
279
- const iconSize = isMini ? 35 : 70;
280
  const insetBase = isMini
281
  ? { ping: 10, outer: 0, mid: 5, inner: 12, icon: 22 }
282
  : { ping: 40, outer: 0, mid: 20, inner: 50, icon: 65 };
283
- const bgColorBase = type === 'human' ? 'blue' : (type === 'ai' ? 'green' : 'gray'); // اضافه کردن gray برای حالت پیش‌فرض
284
-
285
- // کلاس‌های رنگی باید توسط Tailwind شناسایی شوند
286
- // مثال: "bg-blue-200", "dark:bg-blue-700"
287
- // این کلاس‌ها باید در فایل App.scss شما یا در پیکربندی Tailwind تعریف شده باشند اگر از رنگ‌های سفارشی استفاده می‌کنید.
288
- // در اینجا فرض می‌کنیم Tailwind می‌تواند bg-blue-200 و غیره را به درستی پردازش کند.
289
 
290
  return (
291
  <div className="relative" style={{ width: `${size}px`, height: `${size}px` }}>
292
- <div className={`absolute rounded-full opacity-50 animate-ping bg-${bgColorBase}-200 dark:bg-${bgColorBase}-700`} style={{ inset: `${insetBase.ping}px` }}></div>
293
- <div className={`absolute inset-0 rounded-full opacity-50 bg-${bgColorBase}-200 dark:bg-${bgColorBase}-700`} style={{ inset: `${insetBase.outer}px` }}></div>
294
- <div className={`absolute rounded-full opacity-50 bg-${bgColorBase}-300 dark:bg-${bgColorBase}-600`} style={{ inset: `${insetBase.mid}px` }}></div>
295
- <div className={`absolute rounded-full opacity-50 bg-${bgColorBase}-400 dark:bg-${bgColorBase}-500`} style={{ inset: `${insetBase.inner}px` }}></div>
296
  <div className="z-10 absolute" style={{ inset: `${insetBase.icon}px`, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
297
  {type === 'human' && <SvgHumanIcon />}
298
- {/* اگر آیکون AI دارید، اینجا اضافه کنید */}
299
  </div>
300
  </div>
301
  );
 
19
  import { isIOS } from "./lib/platform";
20
  import cn from "classnames";
21
  import { LiveConfig } from "./multimodal-live-types";
 
22
 
23
  const myCustomInstruction = `
24
  ت1. هویت دستیار:
 
104
  },
105
  };
106
 
 
 
107
  const SvgHumanIcon = () => (
108
  <svg 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="currentColor" strokeWidth="6.42146" strokeLinecap="round" strokeLinejoin="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="currentColor" strokeWidth="6.42146" strokeLinecap="round" strokeLinejoin="round"/></svg>
109
  );
 
140
  }, [isMicActive, isCamActive, connected, disconnect]);
141
 
142
  return (
143
+ <div className="w-full flex flex-col items-center justify-center min-h-screen text-foreground antialiased">
 
 
 
144
  <div className="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"
 
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
  <div className="header-button" onClick={() => alert('Back clicked (implement navigation)')}>
162
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" 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>
163
  </div>
164
  </div>
165
  </div>
166
 
 
167
  <div ref={notificationPopoverRef} id="notification-popover-wrapper" className="notification-popover-wrapper">
168
  <div
169
  id="notification-popover"
 
178
  </div>
179
  </div>
180
 
181
+ <div className="w-full flex flex-col items-center justify-center flex-grow relative">
 
 
182
  <video
183
+ id="video-feed"
184
  ref={videoRef}
185
  autoPlay
186
  playsInline
187
  className={cn(
188
+ "absolute top-0 left-0 w-full h-full object-cover scale-x-[-1]",
189
+ { "hidden": !isCamActive }
190
  )}
191
  />
 
192
  <div
193
+ id="large-logo-container"
194
  className={cn(
195
+ "absolute top-0 left-0 w-full h-full",
196
  {
197
+ "flex items-center justify-center": isMicActive && !isCamActive,
198
+ "hidden": !isMicActive || isCamActive,
199
  }
200
  )}
201
  >
 
218
  );
219
  }
220
 
221
+ // *** NEW: Configuration for logo colors for Tailwind JIT compatibility ***
222
+ const logoColorConfig = {
223
+ blue: {
224
+ ping: "bg-blue-200 dark:bg-blue-700",
225
+ outer: "bg-blue-200 dark:bg-blue-700",
226
+ mid: "bg-blue-300 dark:bg-blue-600",
227
+ inner: "bg-blue-400 dark:bg-blue-500",
228
+ },
229
+ green: {
230
+ ping: "bg-green-200 dark:bg-green-700",
231
+ outer: "bg-green-200 dark:bg-green-700",
232
+ mid: "bg-green-300 dark:bg-green-600",
233
+ inner: "bg-green-400 dark:bg-green-500",
234
+ },
235
+ gray: {
236
+ ping: "bg-gray-200 dark:bg-gray-700",
237
+ outer: "bg-gray-200 dark:bg-gray-700",
238
+ mid: "bg-gray-300 dark:bg-gray-600",
239
+ inner: "bg-gray-400 dark:bg-gray-500",
240
+ }
241
+ };
242
+
243
  function App() {
244
  const videoRef = useRef<HTMLVideoElement>(null);
245
  const [showIOSModal, setShowIOSModal] = useState(false);
 
286
 
287
  const createLogoFunction = (isMini: boolean, isActive: boolean, type: 'human' | 'ai' = 'human') => {
288
  if (!isActive) return null;
289
+ const size = isMini ? 80 : 200;
290
+ const iconSize = isMini ? 35 : 70; // This variable seems unused for SvgHumanIcon which has fixed size. Kept for consistency.
291
  const insetBase = isMini
292
  ? { ping: 10, outer: 0, mid: 5, inner: 12, icon: 22 }
293
  : { ping: 40, outer: 0, mid: 20, inner: 50, icon: 65 };
294
+
295
+ // *** UPDATED: Use logoColorConfig for Tailwind JIT compatibility ***
296
+ const effectiveType = (type === 'human') ? 'blue' : (type === 'ai' ? 'green' : 'gray');
297
+ const currentColors = logoColorConfig[effectiveType as keyof typeof logoColorConfig] || logoColorConfig.gray;
 
 
298
 
299
  return (
300
  <div className="relative" style={{ width: `${size}px`, height: `${size}px` }}>
301
+ <div className={`absolute rounded-full opacity-50 animate-ping ${currentColors.ping}`} style={{ inset: `${insetBase.ping}px` }}></div>
302
+ <div className={`absolute rounded-full opacity-50 ${currentColors.outer}`} style={{ inset: `${insetBase.outer}px` }}></div>
303
+ <div className={`absolute rounded-full opacity-50 ${currentColors.mid}`} style={{ inset: `${insetBase.mid}px` }}></div>
304
+ <div className={`absolute rounded-full opacity-50 ${currentColors.inner}`} style={{ inset: `${insetBase.inner}px` }}></div>
305
  <div className="z-10 absolute" style={{ inset: `${insetBase.icon}px`, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
306
  {type === 'human' && <SvgHumanIcon />}
307
+ {/* اگر آیکون AI دارید، اینجا اضافه کنید. مثال: type === 'ai' && <SvgAiIcon /> */}
308
  </div>
309
  </div>
310
  );