Skip to content

Commit

Permalink
[Issue-235][Mythical Telegram App] rollback code
Browse files Browse the repository at this point in the history
  • Loading branch information
dungnguyen-art committed Dec 19, 2024
1 parent 4c634a1 commit fdfe59e
Showing 1 changed file with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { ThemeProps } from '@subwallet/extension-koni-ui/types';
import { toDisplayNumber } from '@subwallet/extension-koni-ui/utils';
import { actionTaskOnChain } from '@subwallet/extension-koni-ui/utils/game/task';
import { Check, X } from 'phosphor-react';
import React, { useCallback, useContext, useMemo, useState } from 'react';
import React, { useCallback, useContext, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';
import { useNavigate } from 'react-router-dom';
Expand Down Expand Up @@ -112,7 +112,6 @@ const Component = ({ accountInfo,
const { alertModal } = useContext(WalletModalContext);
const { isLinkedMyth, linkMythAccount, mythicalWallet } = useContext(AuthenticationMythContext);
const { currentAccount } = useSelector((state: RootState) => state.accountState);
const [hasInsufficientBalance, setHasInsufficientBalance] = useState(false);
const doLinkAccount = useCallback(() => {
currentAccount?.address && linkMythAccount('/home/mission').catch(console.error);
}, [currentAccount?.address, linkMythAccount]);
Expand Down Expand Up @@ -165,10 +164,7 @@ const Component = ({ accountInfo,
),
okButton: {
text: t('GOT IT'),
onClick: () => {
setHasInsufficientBalance(true);
alertModal.close();
}
onClick: alertModal.close
}
});
}, [alertModal, t]);
Expand Down Expand Up @@ -364,15 +360,13 @@ const Component = ({ accountInfo,
const firstProcessItem = achievement.progress[0];

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

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

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

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

0 comments on commit fdfe59e

Please sign in to comment.