Ezmary commited on
Commit
70eb652
·
verified ·
1 Parent(s): ad56229

Update src/components/control-tray/ControlTray.tsx

Browse files
src/components/control-tray/ControlTray.tsx CHANGED
@@ -4,12 +4,9 @@ import cn from "classnames";
4
  import React, { memo, RefObject, useEffect, useState, useCallback } from "react";
5
  import { useLiveAPIContext } from "../../contexts/LiveAPIContext";
6
  import { AudioRecorder } from "../../lib/audio-recorder";
7
- import Logo from '../logo/Logo'; // <-- کامپوننت جدید Logo ایمپورت شد
8
-
9
- // آیکون‌ها از فایل مرکزی ایمپورت می‌شوند
10
  import { pauseIcon, microphoneIcon, cameraIcon, stopCamIcon } from '../icons';
11
 
12
- // آیکون Switch Camera اینجا تعریف می‌شود چون فقط در این فایل استفاده شده
13
  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>;
14
 
15
  export type ControlTrayProps = {
@@ -20,7 +17,6 @@ export type ControlTrayProps = {
20
  onAppMicToggle: (active: boolean) => void;
21
  isAppCamActive: boolean;
22
  onAppCamToggle: (active: boolean) => void;
23
- // ReferenceMicrophoneIcon حذف شد
24
  currentFacingMode: 'user' | 'environment';
25
  onFacingModeChange: (mode: 'user' | 'environment') => void;
26
  };
@@ -36,7 +32,7 @@ const ControlTray: React.FC<ControlTrayProps> = ({
36
  currentFacingMode,
37
  onFacingModeChange,
38
  }) => {
39
- const { client, connected, connect } = useLiveAPIContext();
40
  const [audioRecorder] = useState(() => new AudioRecorder());
41
  const [activeLocalVideoStream, setActiveLocalVideoStream] = useState<MediaStream | null>(null);
42
  const [isSwitchingCamera, setIsSwitchingCamera] = useState(false);
@@ -232,10 +228,16 @@ const ControlTray: React.FC<ControlTrayProps> = ({
232
  {isAppMicActive ? pauseIcon : microphoneIcon}
233
  </div>
234
 
235
- {isAppCamActive && (
236
  <div id="small-logo-footer-container" className="small-logo-footer-html-like">
237
- {/* کامپوننت Logo جدید جایگزین LogoAnimation شد */}
238
- <Logo isMini={true} isActive={true} isAi={false} />
 
 
 
 
 
 
239
  </div>
240
  )}
241
 
 
4
  import React, { memo, RefObject, useEffect, useState, useCallback } from "react";
5
  import { useLiveAPIContext } from "../../contexts/LiveAPIContext";
6
  import { AudioRecorder } from "../../lib/audio-recorder";
7
+ import Logo from '../logo/Logo';
 
 
8
  import { pauseIcon, 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>;
11
 
12
  export type ControlTrayProps = {
 
17
  onAppMicToggle: (active: boolean) => void;
18
  isAppCamActive: boolean;
19
  onAppCamToggle: (active: boolean) => void;
 
20
  currentFacingMode: 'user' | 'environment';
21
  onFacingModeChange: (mode: 'user' | 'environment') => void;
22
  };
 
32
  currentFacingMode,
33
  onFacingModeChange,
34
  }) => {
35
+ const { client, connected, connect, volume } = useLiveAPIContext(); // <-- دریافت volume
36
  const [audioRecorder] = useState(() => new AudioRecorder());
37
  const [activeLocalVideoStream, setActiveLocalVideoStream] = useState<MediaStream | null>(null);
38
  const [isSwitchingCamera, setIsSwitchingCamera] = useState(false);
 
228
  {isAppMicActive ? pauseIcon : microphoneIcon}
229
  </div>
230
 
231
+ {(isAppMicActive || isAppCamActive) && (
232
  <div id="small-logo-footer-container" className="small-logo-footer-html-like">
233
+ {/* --- 👇 تغییر در اینجا: پاس دادن volume و isAppMicActive 👇 --- */}
234
+ <Logo
235
+ isMini={true}
236
+ isActive={true}
237
+ isAi={true}
238
+ speakingVolume={volume}
239
+ isUserSpeaking={isAppMicActive}
240
+ />
241
  </div>
242
  )}
243