Spaces:
Running
Running
Update src/components/control-tray/ControlTray.tsx
Browse files
src/components/control-tray/ControlTray.tsx
CHANGED
@@ -4,6 +4,7 @@ import cn from "classnames";
|
|
4 |
import React, { memo, RefObject, useEffect, useState, useCallback, useRef } from "react";
|
5 |
import { useLiveAPIContext } from "../../contexts/LiveAPIContext";
|
6 |
import { AudioRecorder } from "../../lib/audio-recorder";
|
|
|
7 |
import { PauseIconWithPulse, microphoneIcon, cameraIcon, stopCamIcon } from '../icons';
|
8 |
|
9 |
const SvgSwitchCameraIcon = () => <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="w-[22px] h-[22px]"><path d="M11 19H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5"/><path d="M13 5h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-5"/><path d="m17 12-3-3 3-3"/><path d="m7 12 3 3-3 3"/></svg>;
|
@@ -22,7 +23,7 @@ export type ControlTrayProps = {
|
|
22 |
};
|
23 |
|
24 |
const ControlTray: React.FC<ControlTrayProps> = ({ videoRef, onVideoStreamChange, supportsVideo, isAppMicActive, onAppMicToggle, isAppCamActive, onAppCamToggle, currentFacingMode, onFacingModeChange, onUserSpeakingChange }) => {
|
25 |
-
const { client, connected, connect } = useLiveAPIContext();
|
26 |
const audioRecorderRef = useRef<AudioRecorder | null>(null);
|
27 |
const [activeLocalVideoStream, setActiveLocalVideoStream] = useState<MediaStream | null>(null);
|
28 |
const [isSwitchingCamera, setIsSwitchingCamera] = useState(false);
|
@@ -196,6 +197,21 @@ const ControlTray: React.FC<ControlTrayProps> = ({ videoRef, onVideoStreamChange
|
|
196 |
<div id="mic-button" className="control-button mic-button-color" onClick={handleMicToggle}>
|
197 |
{isAppMicActive ? <PauseIconWithPulse userVolume={userVolume} /> : microphoneIcon}
|
198 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
<div id="cam-button-wrapper" className="control-button-wrapper cam-wrapper-html-like">
|
200 |
<div id="cam-button" className="control-button cam-button-color" onClick={handleCamToggle}>
|
201 |
{isAppCamActive ? stopCamIcon : cameraIcon}
|
|
|
4 |
import React, { memo, RefObject, useEffect, useState, useCallback, useRef } from "react";
|
5 |
import { useLiveAPIContext } from "../../contexts/LiveAPIContext";
|
6 |
import { AudioRecorder } from "../../lib/audio-recorder";
|
7 |
+
import Logo from '../logo/Logo'; // لوگو اینجا استفاده میشود
|
8 |
import { PauseIconWithPulse, microphoneIcon, cameraIcon, stopCamIcon } from '../icons';
|
9 |
|
10 |
const SvgSwitchCameraIcon = () => <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="w-[22px] h-[22px]"><path d="M11 19H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5"/><path d="M13 5h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-5"/><path d="m17 12-3-3 3-3"/><path d="m7 12 3 3-3 3"/></svg>;
|
|
|
23 |
};
|
24 |
|
25 |
const ControlTray: React.FC<ControlTrayProps> = ({ videoRef, onVideoStreamChange, supportsVideo, isAppMicActive, onAppMicToggle, isAppCamActive, onAppCamToggle, currentFacingMode, onFacingModeChange, onUserSpeakingChange }) => {
|
26 |
+
const { client, connected, connect, volume } = useLiveAPIContext();
|
27 |
const audioRecorderRef = useRef<AudioRecorder | null>(null);
|
28 |
const [activeLocalVideoStream, setActiveLocalVideoStream] = useState<MediaStream | null>(null);
|
29 |
const [isSwitchingCamera, setIsSwitchingCamera] = useState(false);
|
|
|
197 |
<div id="mic-button" className="control-button mic-button-color" onClick={handleMicToggle}>
|
198 |
{isAppMicActive ? <PauseIconWithPulse userVolume={userVolume} /> : microphoneIcon}
|
199 |
</div>
|
200 |
+
|
201 |
+
{/* --- 👇 تغییر اصلی اینجاست 👇 --- */}
|
202 |
+
{/* اگر دوربین فعال است، لوگو را در وسط نمایش بده */}
|
203 |
+
{isAppCamActive && (
|
204 |
+
<div id="small-logo-footer-container" className="small-logo-footer-html-like">
|
205 |
+
<Logo
|
206 |
+
isMini={true}
|
207 |
+
isActive={true}
|
208 |
+
isAi={false}
|
209 |
+
speakingVolume={volume}
|
210 |
+
isUserSpeaking={onUserSpeakingChange.length > 0 && userVolume > 0.01}
|
211 |
+
/>
|
212 |
+
</div>
|
213 |
+
)}
|
214 |
+
|
215 |
<div id="cam-button-wrapper" className="control-button-wrapper cam-wrapper-html-like">
|
216 |
<div id="cam-button" className="control-button cam-button-color" onClick={handleCamToggle}>
|
217 |
{isAppCamActive ? stopCamIcon : cameraIcon}
|