diff --git a/web/cashtab/src/components/Wallet/Tx.js b/web/cashtab/src/components/Wallet/Tx.js --- a/web/cashtab/src/components/Wallet/Tx.js +++ b/web/cashtab/src/components/Wallet/Tx.js @@ -57,6 +57,9 @@ font-size: 0.8rem; } `; +const TxFiatPrice = styled.span` + font-size: 0.8rem; +`; const TokenInfo = styled.div` display: grid; grid-template-rows: 50%; @@ -130,7 +133,7 @@ } `; -const Tx = ({ data }) => { +const Tx = ({ data, fiatPrice }) => { const txDate = typeof data.blocktime === 'undefined' ? new Date().toLocaleDateString() @@ -212,13 +215,39 @@ ) : ( <> - {data.outgoingTx - ? `- ${data.amountSent.toFixed(8)} ${ - currency.ticker - }` - : `+ ${data.amountReceived.toFixed(8)} ${ - currency.ticker - }`} + {data.outgoingTx ? ( + <> + - {data.amountSent.toFixed(8)} + {currency.ticker} +
+ {fiatPrice !== null && + !isNaN(data.amountSent) && ( + + - $ + {( + data.amountSent * fiatPrice + ).toFixed(2)}{' '} + USD + + )} + + ) : ( + <> + + {data.amountReceived.toFixed(8)} + {currency.ticker} +
+ {fiatPrice !== null && + !isNaN(data.amountReceived) && ( + + + $ + {( + data.amountReceived * fiatPrice + ).toFixed(2)}{' '} + USD + + )} + + )}
)} diff --git a/web/cashtab/src/components/Wallet/TxHistory.js b/web/cashtab/src/components/Wallet/TxHistory.js --- a/web/cashtab/src/components/Wallet/TxHistory.js +++ b/web/cashtab/src/components/Wallet/TxHistory.js @@ -4,7 +4,7 @@ export const TxLink = styled.a``; -const TxHistory = ({ txs }) => { +const TxHistory = ({ txs, fiatPrice }) => { return (
{txs.map(tx => ( @@ -14,7 +14,7 @@ target="_blank" rel="noreferrer" > - + ))}
diff --git a/web/cashtab/src/components/Wallet/Wallet.js b/web/cashtab/src/components/Wallet/Wallet.js --- a/web/cashtab/src/components/Wallet/Wallet.js +++ b/web/cashtab/src/components/Wallet/Wallet.js @@ -323,7 +323,10 @@ - + 0.06047469 BCHA ,
$ NaN @@ -82,16 +82,16 @@
,
BCHA
SLPA @@ -103,14 +103,14 @@ exports[`Wallet with BCH balances and tokens 1`] = ` Array [
0.06047469 BCHA
,
$ NaN @@ -182,16 +182,16 @@
,
BCHA
SLPA @@ -203,7 +203,7 @@ exports[`Wallet without BCH balance 1`] = ` Array [
,
0 BCHA @@ -299,16 +299,16 @@
,
BCHA
SLPA