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