Gift Modal: Fix closing animation (#6631)

This commit is contained in:
Alexander Zinchuk 2026-01-20 12:01:10 +01:00
parent 9cf989934b
commit 6ddb774c55

View File

@ -64,7 +64,7 @@ type StateProps = {
myUniqueGiftIds?: string[]; myUniqueGiftIds?: string[];
starBalance?: ApiStarsAmount; starBalance?: ApiStarsAmount;
peer?: ApiPeer; peer?: ApiPeer;
isSelf?: boolean; currentUserId?: string;
disallowedGifts?: ApiDisallowedGifts; disallowedGifts?: ApiDisallowedGifts;
resaleGiftsCount?: number; resaleGiftsCount?: number;
areResaleGiftsLoading?: boolean; areResaleGiftsLoading?: boolean;
@ -88,7 +88,7 @@ const GiftModal: FC<OwnProps & StateProps> = ({
myUniqueGiftIds, myUniqueGiftIds,
starBalance, starBalance,
peer, peer,
isSelf, currentUserId,
disallowedGifts, disallowedGifts,
resaleGiftsCount, resaleGiftsCount,
areResaleGiftsLoading, areResaleGiftsLoading,
@ -115,9 +115,11 @@ const GiftModal: FC<OwnProps & StateProps> = ({
const isOpen = Boolean(modal); const isOpen = Boolean(modal);
const renderingModal = useCurrentOrPrev(modal); const renderingModal = useCurrentOrPrev(modal);
const renderingPeer = useCurrentOrPrev(peer);
const user = peer && isApiPeerUser(peer) ? peer : undefined; const user = renderingPeer && isApiPeerUser(renderingPeer) ? renderingPeer : undefined;
const chat = peer && isApiPeerChat(peer) ? peer : undefined; const chat = renderingPeer && isApiPeerChat(renderingPeer) ? renderingPeer : undefined;
const isSelf = Boolean(currentUserId && renderingModal?.forPeerId === currentUserId);
const selectedGift = renderingModal?.selectedGift; const selectedGift = renderingModal?.selectedGift;
const [shouldShowMainScreenHeader, setShouldShowMainScreenHeader] = useState(false); const [shouldShowMainScreenHeader, setShouldShowMainScreenHeader] = useState(false);
@ -459,7 +461,7 @@ const GiftModal: FC<OwnProps & StateProps> = ({
<Avatar <Avatar
className={styles.avatar} className={styles.avatar}
size={AVATAR_SIZE} size={AVATAR_SIZE}
peer={peer} peer={renderingPeer}
onMouseMove={handleAvatarMouseMove} onMouseMove={handleAvatarMouseMove}
/> />
<InteractiveSparkles <InteractiveSparkles
@ -612,7 +614,6 @@ export default memo(withGlobal<OwnProps>((global, { modal }): Complete<StateProp
} = global; } = global;
const peer = modal?.forPeerId ? selectPeer(global, modal.forPeerId) : undefined; const peer = modal?.forPeerId ? selectPeer(global, modal.forPeerId) : undefined;
const isSelf = Boolean(currentUserId && modal?.forPeerId === currentUserId);
const userFullInfo = peer ? selectUserFullInfo(global, peer?.id) : undefined; const userFullInfo = peer ? selectUserFullInfo(global, peer?.id) : undefined;
const { resaleGifts } = selectTabState(global); const { resaleGifts } = selectTabState(global);
@ -628,7 +629,7 @@ export default memo(withGlobal<OwnProps>((global, { modal }): Complete<StateProp
myUniqueGiftIds: global.myUniqueGifts?.ids, myUniqueGiftIds: global.myUniqueGifts?.ids,
starBalance: stars?.balance, starBalance: stars?.balance,
peer, peer,
isSelf, currentUserId,
disallowedGifts: userFullInfo?.disallowedGifts, disallowedGifts: userFullInfo?.disallowedGifts,
resaleGiftsCount, resaleGiftsCount,
areResaleGiftsLoading, areResaleGiftsLoading,