Spaces:
Running
Running
File size: 2,785 Bytes
275fd75 f8d0efc 275fd75 f8d0efc 275fd75 f574db2 275fd75 ebcc2a0 275fd75 25fefb8 9dfab18 25fefb8 ebcc2a0 275fd75 49589a4 275fd75 25fefb8 21cbc11 25fefb8 21cbc11 25fefb8 f574db2 21cbc11 ebcc2a0 49589a4 25fefb8 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 53 54 55 56 57 58 59 60 61 62 63 64 65 |
// 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", // حذف dark mode برای سادگی
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>
);
} |