fix: donation svg animation (#57867)

This commit is contained in:
Ahmad Abdolsaheb 2025-01-02 23:49:41 +03:00 committed by GitHub
parent 234aa80466
commit 01273fb5bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react';
import React, { useEffect, useState, useRef } from 'react';
import { useTranslation } from 'react-i18next';
import { useFeature } from '@growthbook/growthbook-react';
import { Col, Row, Modal, Spacer } from '@freecodecamp/ui';
@ -129,7 +129,9 @@ const AnimationContainer = ({
}: {
secondsRemaining: number;
}) => {
const animationKey = useRef(Date.now()).current;
const newBearAnimation = useFeature('new-bear-animation').on;
const animationSrc = `${newBearAnimation ? donationAnimationB : donationAnimation}?t=${animationKey}`;
const { t } = useTranslation();
return (
<>
@ -174,9 +176,9 @@ const AnimationContainer = ({
)}
</div>
<img
key={Date.now()}
key={animationKey}
alt=''
src={newBearAnimation ? donationAnimationB : donationAnimation}
src={animationSrc}
id={'donation-animation'}
data-playwright-test-label='donation-animation'
/>