import type { TeactNode } from '@teact'; import { memo, useRef } from '@teact'; import type { ApiSticker } from '../../../api/types'; import buildClassName from '../../../util/buildClassName'; import { REM } from '../../common/helpers/mediaDimensions'; import useLastCallback from '../../../hooks/useLastCallback.ts'; import InteractiveSparkles from '../../common/InteractiveSparkles'; import StickerView from '../../common/StickerView'; import SpeedingDiamond from './SpeedingDiamond.tsx'; import SwayingStar from './SwayingStar.tsx'; import styles from './ParticlesHeader.module.scss'; import Cocoon from '../../../assets/cocoon.webp'; interface OwnProps { model: 'swaying-star' | 'speeding-diamond' | 'ai-egg' | 'sticker'; sticker?: ApiSticker; color: 'purple' | 'gold' | 'blue'; title: TeactNode; description: TeactNode; isDisabled?: boolean; className?: string; modelClassName?: string; } const GIFT_STICKER_SIZE = 8 * REM; const PARTICLE_PARAMS = { centerShift: [0, -36] as const, }; function ParticlesHeader({ model, sticker, color, title, description, isDisabled, className, modelClassName, }: OwnProps) { const stickerRef = useRef(); const triggerSparklesRef = useRef<(() => void) | undefined>(); const handleMouseMove = useLastCallback(() => { triggerSparklesRef.current?.(); }); const handleRequestAnimation = useLastCallback((animate: NoneToVoidFunction) => { triggerSparklesRef.current = animate; }); return (
{model === 'swaying-star' ? ( ) : model === 'ai-egg' ? ( ) : model === 'speeding-diamond' ? ( ) : model === 'sticker' && sticker && (
)}

{title}

{description}
); } export default memo(ParticlesHeader);