Skip to content

Commit

Permalink
Merge branch 'feat/whitelist_munual' of github.com:TrustlessComputer/…
Browse files Browse the repository at this point in the history
…bvm-website into feat/whitelist_munual
  • Loading branch information
wilfred committed Jan 29, 2024
2 parents 329e5d2 + e83c4b1 commit fe59c88
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 25 deletions.
1 change: 1 addition & 0 deletions src/interfaces/leader-board-point.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ export interface ILeaderBoardPoint {
usdt_value?:string;
bvm_percent?:string;
coin_balances?:IContributionCoin[];
deposit_id:string;
}
47 changes: 26 additions & 21 deletions src/modules/PublicSale/leaderBoardVisual/AvatarItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,44 +31,50 @@ const AvatarItem = forwardRef((props: IProps, ref: any) => {
const add = animatedLatestContributors?.find(c => c.twitter_id === data.twitter_id);

if(add) {
return Number(data.usdt_value) + Number(add.usdt_value);
return refMoney.current.value + Number(add.usdt_value);
} else {
return Number(data.usdt_value);
return refMoney.current.value;
}
} else {
return Number(data.usdt_value);
return refMoney.current.value;
}
}, [data, needCheckDeposit, animatedLatestContributors]);
}, [needCheckDeposit, JSON.stringify(animatedLatestContributors)]);

useEffect(() => {

if (!refInertMoney.current) return;
if (newTotalMoney && refMoney.current.value !== newTotalMoney) {
const numberLoop = 5;
const duration = 19/24;
gsap.to(refMoney.current, {
value: newTotalMoney, ease: 'power3.inOut', duration: 1, onUpdate: () => {
value: newTotalMoney, ease: 'power3.inOut', duration: numberLoop * duration, onUpdate: () => {
if (refInertMoney.current) {
refInertMoney.current.innerHTML = `$${formatCurrency(refMoney.current.value, 0, 0, '', true)}`;
}
},
});
if (!lottieRef.current) return;

lottieRef.current.setLoop(numberLoop);
lottieRef.current.play();

setIsLoopDone(false);
if(refTime.current) {
clearTimeout(refTime.current);
}
refTime.current = setTimeout(() => {
setIsLoopDone(true);
onCompleted && onCompleted();
}, duration * numberLoop * 1000);
} else {
refInertMoney.current.innerHTML = `$${formatCurrency(refMoney.current.value, 0, 0, '', true)}`;
}


if (!lottieRef.current) return;
const numberLoop = 3;

lottieRef.current.setLoop(3);
lottieRef.current.play();
setIsLoopDone(false);

const duration = lottieRef.current;
refTime.current = setTimeout(() => {
setIsLoopDone(true);
onCompleted && onCompleted();
}, duration * numberLoop);

return () => {
if(refTime.current) {
clearTimeout(refTime.current);
}
}
}, [newTotalMoney]);

const [error, setError] = useState<boolean>(false);
Expand All @@ -79,7 +85,6 @@ const AvatarItem = forwardRef((props: IProps, ref: any) => {
src={'/images/mk-user.jpg'} alt={'user'} style={{ cursor: 'pointer' }} />;
};


return (
<div
className={`${s.avatarItem} ${isYou && s.isYou} ${data.levelRender !== undefined && 'level-' + data.levelRender} js-avatarItem`}
Expand Down Expand Up @@ -116,7 +121,7 @@ const AvatarItem = forwardRef((props: IProps, ref: any) => {
</div>
</div>
{
<div className={`${s.lt} ${!isLoopDone && s.isRun}`}>
<div className={`${s.lt} ${!isLoopDone ? s.isRun : ''}`}>
<DotLottiePlayer
className={s.lottie}
lottieRef={lottieRef}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
top: 0;
bottom: 0;
opacity: 0;
width: 100%;
height: 100%;
pointer-events: none;

&.isRun {
opacity: 1;
Expand Down
11 changes: 7 additions & 4 deletions src/modules/PublicSale/leaderBoardVisual/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ const LeaderBoardVisual = (props: IProps) => {
fetchLatestData();
const interval = setInterval(() => {
fetchLatestData();
dispatch(setNeedCheckDeposit(true));
}, 10000);

setTimeout(() => {
dispatch(setNeedCheckDeposit(true));
}, 12000);

return () => {
clearInterval(interval);
};
Expand Down Expand Up @@ -107,14 +110,14 @@ const LeaderBoardVisual = (props: IProps) => {
const oldContributors = latestContributors?.current;

const newRes = res.filter( function( el ) {
return oldContributors?.findIndex(a => a.twitter_id === el.twitter_id) < 0;
return oldContributors?.findIndex(a => a.deposit_id === el.deposit_id) < 0;
});

if(newRes?.length > 0) {
latestContributors.current = [...newRes].concat(latestContributors.current);
animatedLatestContributors.current = newRes;
dispatch(setAnimatedLatestContributors(newRes));
}
animatedLatestContributors.current = newRes || [];
dispatch(setAnimatedLatestContributors(newRes || []));
};

useEffect(() => {
Expand Down

0 comments on commit fe59c88

Please sign in to comment.