Spaces:
Running
Running
Update src/App.tsx
Browse files- src/App.tsx +14 -9
src/App.tsx
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
// src/App.tsx (نسخه نهایی با
|
2 |
import React, { useEffect, useRef, useState, FC } from "react";
|
3 |
import './App.scss';
|
4 |
import { AppProvider, useAppContext, PersonalityType, PersonalityInstructions } from "./contexts/AppContext";
|
@@ -9,7 +9,7 @@ import cn from "classnames";
|
|
9 |
import Logo from "./components/logo/Logo";
|
10 |
import { LiveConfig } from "./multimodal-live-types";
|
11 |
|
12 |
-
// کامپوننت مودال
|
13 |
interface CustomModalProps {
|
14 |
isOpen: boolean;
|
15 |
onClose: () => void;
|
@@ -101,22 +101,27 @@ const AppInternal: React.FC = () => {
|
|
101 |
<PersonalityMenu isOpen={isPersonalityMenuOpen} onClose={() => setIsPersonalityMenuOpen(false)} onSelect={handleSelectPersonality} />
|
102 |
|
103 |
<div className="media-area">
|
104 |
-
{/* ✅ تغییر اصلی اینجاست: افزودن کلاسهای موقعیتیابی و اندازه */}
|
105 |
<video
|
106 |
id="video-feed"
|
107 |
ref={videoRef}
|
108 |
autoPlay
|
109 |
playsInline
|
110 |
-
className={cn(
|
111 |
-
'absolute top-0 left-0 w-full h-full object-cover', // <-- این کلاسها ویدیو را تمامصفحه میکنند
|
112 |
-
{ hidden: !isCamActive },
|
113 |
-
{ "scale-x-[-1]": currentFacingMode === 'user' }
|
114 |
-
)}
|
115 |
/>
|
116 |
{isMicActive && !isCamActive && <div id="large-logo-container"><Logo isMini={false} isActive={true} isAi={false} speakingVolume={volume} isUserSpeaking={isUserSpeaking} /></div>}
|
117 |
</div>
|
118 |
|
119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
</div>
|
121 |
<CustomModal isOpen={isCustomModalOpen} onClose={() => setIsCustomModalOpen(false)} onSave={(name, instructions) => changePersonality('custom', { name, instructions })} initialName={customUserName} initialInstructions={customInstructions} />
|
122 |
</>
|
|
|
1 |
+
// src/App.tsx (نسخه نهایی با رفع خطای isAppCamActive)
|
2 |
import React, { useEffect, useRef, useState, FC } from "react";
|
3 |
import './App.scss';
|
4 |
import { AppProvider, useAppContext, PersonalityType, PersonalityInstructions } from "./contexts/AppContext";
|
|
|
9 |
import Logo from "./components/logo/Logo";
|
10 |
import { LiveConfig } from "./multimodal-live-types";
|
11 |
|
12 |
+
// کامپوننت مودال
|
13 |
interface CustomModalProps {
|
14 |
isOpen: boolean;
|
15 |
onClose: () => void;
|
|
|
101 |
<PersonalityMenu isOpen={isPersonalityMenuOpen} onClose={() => setIsPersonalityMenuOpen(false)} onSelect={handleSelectPersonality} />
|
102 |
|
103 |
<div className="media-area">
|
|
|
104 |
<video
|
105 |
id="video-feed"
|
106 |
ref={videoRef}
|
107 |
autoPlay
|
108 |
playsInline
|
109 |
+
className={cn('absolute top-0 left-0 w-full h-full object-cover', { hidden: !isCamActive }, { "scale-x-[-1]": currentFacingMode === 'user' })}
|
|
|
|
|
|
|
|
|
110 |
/>
|
111 |
{isMicActive && !isCamActive && <div id="large-logo-container"><Logo isMini={false} isActive={true} isAi={false} speakingVolume={volume} isUserSpeaking={isUserSpeaking} /></div>}
|
112 |
</div>
|
113 |
|
114 |
+
{/* ✅✅✅ رفع خطا اینجاست ✅✅✅ */}
|
115 |
+
<ControlTray
|
116 |
+
videoRef={videoRef}
|
117 |
+
onUserSpeakingChange={setIsUserSpeaking}
|
118 |
+
isAppMicActive={isMicActive}
|
119 |
+
onAppMicToggle={setIsMicActive}
|
120 |
+
isAppCamActive={isCamActive} /* <-- متغیر صحیح پاس داده شد */
|
121 |
+
onAppCamToggle={setIsCamActive}
|
122 |
+
currentFacingMode={currentFacingMode}
|
123 |
+
onFacingModeChange={setCurrentFacingMode}
|
124 |
+
/>
|
125 |
</div>
|
126 |
<CustomModal isOpen={isCustomModalOpen} onClose={() => setIsCustomModalOpen(false)} onSave={(name, instructions) => changePersonality('custom', { name, instructions })} initialName={customUserName} initialInstructions={customInstructions} />
|
127 |
</>
|