Skip to content

Commit

Permalink
[Issue-235][Mythical Telegram App] improve name variable
Browse files Browse the repository at this point in the history
  • Loading branch information
dungnguyen-art committed Dec 18, 2024
1 parent ca260ba commit 4c634a1
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const Component = ({ accountInfo,
const { alertModal } = useContext(WalletModalContext);
const { isLinkedMyth, linkMythAccount, mythicalWallet } = useContext(AuthenticationMythContext);
const { currentAccount } = useSelector((state: RootState) => state.accountState);
const [isBalanceError, setIsBalanceError] = useState(false);
const [hasInsufficientBalance, setHasInsufficientBalance] = useState(false);
const doLinkAccount = useCallback(() => {
currentAccount?.address && linkMythAccount('/home/mission').catch(console.error);
}, [currentAccount?.address, linkMythAccount]);
Expand Down Expand Up @@ -166,7 +166,7 @@ const Component = ({ accountInfo,
okButton: {
text: t('GOT IT'),
onClick: () => {
setIsBalanceError(true);
setHasInsufficientBalance(true);
alertModal.close();
}
}
Expand Down Expand Up @@ -364,15 +364,15 @@ const Component = ({ accountInfo,
const firstProcessItem = achievement.progress[0];

if (firstProcessItem) {
const completed = isBalanceError
const completed = hasInsufficientBalance
? toDisplayNumber(mythicalWallet?.balanceInMyth || 0)
: Math.min(firstProcessItem?.completed || 0, firstProcessItem?.required || 0);

return `${toDisplayNumber(completed)}/${toDisplayNumber(firstProcessItem.required)} ${getMetricCounterpart(firstProcessItem.metricId, achievement)}`.trim();
}

return '';
}, [isBalanceError, mythicalWallet?.balanceInMyth]);
}, [hasInsufficientBalance, mythicalWallet?.balanceInMyth]);

const getAchievementActionContent = useCallback((achievement: Achievement) => {
if (achievement.status === AchievementLogStatus.CLAIMABLE) {
Expand Down

0 comments on commit 4c634a1

Please sign in to comment.