Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/components/Wallet/Tx.js
Show First 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | :hover { | ||||
border-color: ${props => props.theme.primary}; | border-color: ${props => props.theme.primary}; | ||||
} | } | ||||
@media screen and (max-width: 500px) { | @media screen and (max-width: 500px) { | ||||
grid-template-columns: 24px 30% 50%; | grid-template-columns: 24px 30% 50%; | ||||
padding: 12px 12px; | padding: 12px 12px; | ||||
} | } | ||||
`; | `; | ||||
const Tx = ({ data, fiatPrice }) => { | const Tx = ({ data, fiatPrice, fiatCurrency }) => { | ||||
const txDate = | const txDate = | ||||
typeof data.blocktime === 'undefined' | typeof data.blocktime === 'undefined' | ||||
? new Date().toLocaleDateString() | ? new Date().toLocaleDateString() | ||||
: new Date(data.blocktime * 1000).toLocaleDateString(); | : new Date(data.blocktime * 1000).toLocaleDateString(); | ||||
return ( | return ( | ||||
<TxWrapper> | <TxWrapper> | ||||
<TxIcon> | <TxIcon> | ||||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | return ( | ||||
{data.outgoingTx ? ( | {data.outgoingTx ? ( | ||||
<> | <> | ||||
-{' '} | -{' '} | ||||
{formatBalance( | {formatBalance( | ||||
fromLegacyDecimals(data.amountSent), | fromLegacyDecimals(data.amountSent), | ||||
)} | )} | ||||
{currency.ticker} | {currency.ticker} | ||||
<br /> | <br /> | ||||
{fiatPrice !== null && | {fiatPrice !== null && !isNaN(data.amountSent) && ( | ||||
!isNaN(data.amountSent) && ( | |||||
<TxFiatPrice> | <TxFiatPrice> | ||||
- $ | -{' '} | ||||
{ | |||||
currency.fiatCurrencies[ | |||||
fiatCurrency | |||||
].symbol | |||||
} | |||||
{( | {( | ||||
fromLegacyDecimals( | fromLegacyDecimals( | ||||
data.amountSent, | data.amountSent, | ||||
) * fiatPrice | ) * fiatPrice | ||||
).toFixed(2)}{' '} | ).toFixed(2)}{' '} | ||||
USD | {currency.fiatCurrencies.fiatCurrency} | ||||
</TxFiatPrice> | </TxFiatPrice> | ||||
)} | )} | ||||
</> | </> | ||||
) : ( | ) : ( | ||||
<> | <> | ||||
+{' '} | +{' '} | ||||
{formatBalance( | {formatBalance( | ||||
fromLegacyDecimals(data.amountReceived), | fromLegacyDecimals(data.amountReceived), | ||||
)} | )} | ||||
{currency.ticker} | {currency.ticker} | ||||
<br /> | <br /> | ||||
{fiatPrice !== null && | {fiatPrice !== null && | ||||
!isNaN(data.amountReceived) && ( | !isNaN(data.amountReceived) && ( | ||||
<TxFiatPrice> | <TxFiatPrice> | ||||
+ $ | +{' '} | ||||
{ | |||||
currency.fiatCurrencies[ | |||||
fiatCurrency | |||||
].symbol | |||||
} | |||||
{( | {( | ||||
fromLegacyDecimals( | fromLegacyDecimals( | ||||
data.amountReceived, | data.amountReceived, | ||||
) * fiatPrice | ) * fiatPrice | ||||
).toFixed(2)}{' '} | ).toFixed(2)}{' '} | ||||
USD | { | ||||
currency.fiatCurrencies | |||||
.fiatCurrency | |||||
} | |||||
</TxFiatPrice> | </TxFiatPrice> | ||||
)} | )} | ||||
</> | </> | ||||
)} | )} | ||||
</TxInfo> | </TxInfo> | ||||
</> | </> | ||||
)} | )} | ||||
</TxWrapper> | </TxWrapper> | ||||
); | ); | ||||
}; | }; | ||||
export default Tx; | export default Tx; |