Fixed transaction nan value

This commit is contained in:
Mustafa Buyukcelebi 2019-08-25 18:28:46 +03:00
parent 9403e9ef44
commit 0021006588
2 changed files with 22 additions and 10 deletions

View File

@ -56,7 +56,7 @@ class TransactionView extends PureComponent {
const transactionData = groomingTransactionData(item, steemPerMVests, formatNumber); const transactionData = groomingTransactionData(item, steemPerMVests, formatNumber);
if (transactionData.length === 0) return null; if (transactionData.length === 0) return null;
const value = transactionData.value.split(' '); const value = transactionData.value.trim().split(' ');
return ( return (
<CollapsibleCard <CollapsibleCard
@ -85,7 +85,7 @@ class TransactionView extends PureComponent {
{(get(transactionData, 'details') || get(transactionData, 'memo')) && ( {(get(transactionData, 'details') || get(transactionData, 'memo')) && (
<WalletLineItem <WalletLineItem
key={index.toString()} key={index.toString()}
text={get(transactionData, 'details', 'pipi')} text={get(transactionData, 'details')}
isBlackText isBlackText
isThin isThin
description={get(transactionData, 'memo')} description={get(transactionData, 'memo')}

View File

@ -25,7 +25,7 @@ export const groomingTransactionData = (transaction, steemPerMVests, formatNumbe
result.value = `${formatNumber(vestsToSp(parseToken(reward), steemPerMVests), { result.value = `${formatNumber(vestsToSp(parseToken(reward), steemPerMVests), {
minimumFractionDigits: 3, minimumFractionDigits: 3,
})} SP`; }).replace(',', '.')} SP`;
result.details = commentAuthor ? `@${commentAuthor}/${commentPermlink}` : null; result.details = commentAuthor ? `@${commentAuthor}/${commentPermlink}` : null;
break; break;
case 'author_reward': case 'author_reward':
@ -38,11 +38,17 @@ export const groomingTransactionData = (transaction, steemPerMVests, formatNumbe
const { author, permlink } = opData; const { author, permlink } = opData;
sbdPayout = formatNumber(parseToken(sbdPayout), { minimumFractionDigits: 3 }); sbdPayout = formatNumber(parseToken(sbdPayout), { minimumFractionDigits: 3 }).replace(
steemPayout = formatNumber(parseToken(steemPayout), { minimumFractionDigits: 3 }); ',',
'.',
);
steemPayout = formatNumber(parseToken(steemPayout), { minimumFractionDigits: 3 }).replace(
',',
'.',
);
vestingPayout = formatNumber(vestsToSp(parseToken(vestingPayout), steemPerMVests), { vestingPayout = formatNumber(vestsToSp(parseToken(vestingPayout), steemPerMVests), {
minimumFractionDigits: 3, minimumFractionDigits: 3,
}); }).replace(',', '.');
result.value = `${sbdPayout > 0 ? `${sbdPayout} SBD` : ''} ${ result.value = `${sbdPayout > 0 ? `${sbdPayout} SBD` : ''} ${
steemPayout > 0 ? `${steemPayout} steemPayout` : '' steemPayout > 0 ? `${steemPayout} steemPayout` : ''
@ -56,11 +62,17 @@ export const groomingTransactionData = (transaction, steemPerMVests, formatNumbe
case 'claim_reward_balance': case 'claim_reward_balance':
let { reward_sbd: rewardSdb, reward_steem: rewardSteem, reward_vests: rewardVests } = opData; let { reward_sbd: rewardSdb, reward_steem: rewardSteem, reward_vests: rewardVests } = opData;
rewardSdb = formatNumber(parseToken(rewardSdb), { minimumFractionDigits: 3 }); rewardSdb = formatNumber(parseToken(rewardSdb), { minimumFractionDigits: 3 }).replace(
rewardSteem = formatNumber(parseToken(rewardSteem), { minimumFractionDigits: 3 }); ',',
'.',
);
rewardSteem = formatNumber(parseToken(rewardSteem), { minimumFractionDigits: 3 }).replace(
',',
'.',
);
rewardVests = formatNumber(vestsToSp(parseToken(rewardVests), steemPerMVests), { rewardVests = formatNumber(vestsToSp(parseToken(rewardVests), steemPerMVests), {
minimumFractionDigits: 3, minimumFractionDigits: 3,
}); }).replace(',', '.');
result.value = `${rewardSdb > 0 ? `${rewardSdb} SBD` : ''} ${ result.value = `${rewardSdb > 0 ? `${rewardSdb} SBD` : ''} ${
rewardSteem > 0 ? `${rewardSteem} STEEM` : '' rewardSteem > 0 ? `${rewardSteem} STEEM` : ''
@ -82,7 +94,7 @@ export const groomingTransactionData = (transaction, steemPerMVests, formatNumbe
opVestingShares = parseToken(opVestingShares); opVestingShares = parseToken(opVestingShares);
result.value = `${formatNumber(vestsToSp(opVestingShares, steemPerMVests), { result.value = `${formatNumber(vestsToSp(opVestingShares, steemPerMVests), {
minimumFractionDigits: 3, minimumFractionDigits: 3,
})} SP`; }).replace(',', '.')} SP`;
result.icon = 'attach-money'; result.icon = 'attach-money';
result.details = acc ? `@${acc}` : null; result.details = acc ? `@${acc}` : null;
break; break;