Ezmary commited on
Commit
9dfab18
·
verified ·
1 Parent(s): a6e897f

Update src/components/logo/Logo.tsx

Browse files
Files changed (1) hide show
  1. src/components/logo/Logo.tsx +22 -5
src/components/logo/Logo.tsx CHANGED
@@ -3,17 +3,24 @@
3
  import React from 'react';
4
  import cn from "classnames";
5
  import { humanAiIcon } from '../icons';
 
6
 
7
  type LogoProps = {
8
  isMini: boolean;
9
  isAi: boolean;
10
  isActive: boolean;
 
 
11
  }
12
 
13
- export default function Logo({isAi, isActive, isMini}: LogoProps) {
14
 
15
  if (!isActive) return null;
16
 
 
 
 
 
17
  return (
18
  <div className={cn("w-fit flex items-center justify-center")}>
19
  {/* loads colors for tailwind */}
@@ -23,13 +30,19 @@ export default function Logo({isAi, isActive, isMini}: LogoProps) {
23
 
24
  <div className={cn("relative", isMini ? "w-[80px] h-[80px]" : "w-[200px] h-[200px]")}>
25
  <>
 
26
  <div
27
  className={cn(
28
- "absolute rounded-full opacity-50 animate-ping",
 
29
  isAi ? "bg-green-200 dark:bg-green-700" : "bg-blue-200 dark:bg-blue-700",
30
  isMini ? "inset-[10px]" : "inset-[40px]",
31
  )}
 
 
32
  />
 
 
33
  <div
34
  className={cn(
35
  "absolute inset-0 rounded-full opacity-50",
@@ -51,12 +64,16 @@ export default function Logo({isAi, isActive, isMini}: LogoProps) {
51
  )}
52
  />
53
 
54
- {/* این بخش رنگ آیکون را کنترل می‌کند */}
55
  <div className={cn(
56
- "z-10 absolute flex items-center justify-center text-white", // <<-- این کلاس رنگ را سفید می‌کند
57
  "inset-0"
58
  )}>
59
- {humanAiIcon({ size: isMini ? 24 : 45 })}
 
 
 
 
60
  </div>
61
  </>
62
  </div>
 
3
  import React from 'react';
4
  import cn from "classnames";
5
  import { humanAiIcon } from '../icons';
6
+ import './Logo.scss'; // <-- فایل استایل جدید را ایمپورت کنید
7
 
8
  type LogoProps = {
9
  isMini: boolean;
10
  isAi: boolean;
11
  isActive: boolean;
12
+ speakingVolume?: number; // ولوم صدای AI برای انیمیشن موج
13
+ isUserSpeaking?: boolean; // برای فعال کردن انیمیشن صحبت کاربر
14
  }
15
 
16
+ export default function Logo({isAi, isActive, isMini, speakingVolume = 0, isUserSpeaking = false}: LogoProps) {
17
 
18
  if (!isActive) return null;
19
 
20
+ // محاسبه مقیاس موج بر اساس حجم صدای AI
21
+ // ضریب 1.5 برای محسوس‌تر شدن انیمیشن است
22
+ const aiVoiceScale = 1 + (speakingVolume * 1.5);
23
+
24
  return (
25
  <div className={cn("w-fit flex items-center justify-center")}>
26
  {/* loads colors for tailwind */}
 
30
 
31
  <div className={cn("relative", isMini ? "w-[80px] h-[80px]" : "w-[200px] h-[200px]")}>
32
  <>
33
+ {/* این div موج اصلی انیمیشن صحبت کردن AI است */}
34
  <div
35
  className={cn(
36
+ "absolute rounded-full opacity-50",
37
+ "ai-speaking-ripple", // کلاس برای کنترل انیمیشن
38
  isAi ? "bg-green-200 dark:bg-green-700" : "bg-blue-200 dark:bg-blue-700",
39
  isMini ? "inset-[10px]" : "inset-[40px]",
40
  )}
41
+ // متغیر CSS را برای کنترل مقیاس موج تنظیم می‌کنیم
42
+ style={{ '--ai-voice-scale': aiVoiceScale } as React.CSSProperties}
43
  />
44
+
45
+ {/* دایره‌های ثابت پس‌زمینه */}
46
  <div
47
  className={cn(
48
  "absolute inset-0 rounded-full opacity-50",
 
64
  )}
65
  />
66
 
67
+ {/* آیکون اصلی */}
68
  <div className={cn(
69
+ "z-10 absolute flex items-center justify-center text-white",
70
  "inset-0"
71
  )}>
72
+ {humanAiIcon({
73
+ size: isMini ? 24 : 45,
74
+ // اگر کاربر در حال صحبت است، کلاس مربوطه را اضافه کن
75
+ className: cn({ 'user-speaking': isUserSpeaking })
76
+ })}
77
  </div>
78
  </>
79
  </div>