File size: 2,371 Bytes
275fd75
 
 
 
f8d0efc
275fd75
 
 
f8d0efc
275fd75
f574db2
 
275fd75
 
ebcc2a0
275fd75
 
9dfab18
86cb155
 
ebcc2a0
 
 
 
 
275fd75
 
 
 
 
49589a4
275fd75
86cb155
21cbc11
86cb155
21cbc11
f574db2
 
 
21cbc11
ebcc2a0
dfe9a41
49589a4
 
dfe9a41
 
49589a4
ebcc2a0
275fd75
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// src/components/logo/Logo.tsx

import React from 'react';
import cn from "classnames";
import { humanAiIcon } from '../icons';

type LogoProps = {
  isMini: boolean;
  isAi: boolean;
  isActive: boolean;
  speakingVolume?: number;
  isUserSpeaking?: boolean;
}

export default function Logo({ isAi, isActive, isMini, speakingVolume = 0, isUserSpeaking = false }: LogoProps) {
  if (!isActive) return null;

  const aiVoiceScale = 1 + (speakingVolume * 1.5);
  const isAiSpeaking = speakingVolume > 0.02;

  const animatedCircleStyle: React.CSSProperties = {
    transition: 'transform 0.15s ease-out',
    transform: `scale(${aiVoiceScale})`
  };

  return (
    <div className={cn("w-fit flex items-center justify-center")}>
      <div className={"hidden bg-green-200 bg-green-300 bg-green-400 bg-blue-200 bg-blue-300 bg-blue-400 dark:bg-green-700 dark:bg-green-600 dark:bg-green-500 dark:bg-blue-700 dark:bg-blue-600 dark:bg-blue-500"}>
        color pre-loader
      </div>
      
      <div className={cn("relative", isMini ? "w-[80px] h-[80px]" : "w-[200px] h-[200px]")}>
        <div className={cn("absolute rounded-full opacity-50 animate-ping", isAi ? "bg-green-200" : "bg-blue-200", isMini ? "inset-[10px]" : "inset-[40px]")} />
        
        <div className={cn("absolute rounded-full opacity-50", isAi ? "bg-green-200" : "bg-blue-200", isMini ? "inset-[10px]" : "inset-[40px]")} style={animatedCircleStyle} />
        
        <div className={cn("absolute inset-0 rounded-full opacity-50", isAi ? "bg-green-200" : "bg-blue-200")} />
        <div className={cn("absolute rounded-full opacity-50", isAi ? "bg-green-300" : "bg-blue-300", isMini ? "inset-[5px]" : "inset-[20px]")} />
        <div className={cn("absolute rounded-full opacity-50", isAi ? "bg-green-400" : "bg-blue-400", isMini ? "inset-[12px]" : "inset-[50px]")} />
        
        <div className={cn("z-10 absolute flex items-center justify-center inset-0")}>
          {/* --- 👇 منطق صحیح و نهایی 👇 --- */}
          {humanAiIcon({ 
            size: isMini ? 24 : 45,
            isUserSpeaking: isUserSpeaking,  // <-- کاربر صحبت می‌کند -> آدمک تکان می‌خورد
            isAiSpeaking: isAiSpeaking,     // <-- ربات صحبت می‌کند -> ربات تکان می‌خورد
          })}
        </div>
      </div>
    </div>
  );
}