Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/components/Wallet/Tx.js
import React from 'react'; | import React from 'react'; | ||||
import styled from 'styled-components'; | import styled from 'styled-components'; | ||||
import { | import { | ||||
ArrowUpOutlined, | ArrowUpOutlined, | ||||
ArrowDownOutlined, | ArrowDownOutlined, | ||||
ExperimentOutlined, | ExperimentOutlined, | ||||
} from '@ant-design/icons'; | } from '@ant-design/icons'; | ||||
import { currency } from '@components/Common/Ticker'; | import { currency } from '@components/Common/Ticker'; | ||||
import makeBlockie from 'ethereum-blockies-base64'; | import makeBlockie from 'ethereum-blockies-base64'; | ||||
import { Img } from 'react-image'; | import { Img } from 'react-image'; | ||||
import { formatBalance, fromLegacyDecimals } from '@utils/cashMethods'; | |||||
const SentTx = styled(ArrowUpOutlined)` | const SentTx = styled(ArrowUpOutlined)` | ||||
color: ${props => props.theme.secondary} !important; | color: ${props => props.theme.secondary} !important; | ||||
`; | `; | ||||
const ReceivedTx = styled(ArrowDownOutlined)` | const ReceivedTx = styled(ArrowDownOutlined)` | ||||
color: ${props => props.theme.primary} !important; | color: ${props => props.theme.primary} !important; | ||||
`; | `; | ||||
const GenesisTx = styled(ExperimentOutlined)` | const GenesisTx = styled(ExperimentOutlined)` | ||||
▲ Show 20 Lines • Show All 239 Lines • ▼ Show 20 Lines | return ( | ||||
<span>Token Tx</span> | <span>Token Tx</span> | ||||
)} | )} | ||||
</TokenInfo> | </TokenInfo> | ||||
) : ( | ) : ( | ||||
<> | <> | ||||
<TxInfo outgoing={data.outgoingTx}> | <TxInfo outgoing={data.outgoingTx}> | ||||
{data.outgoingTx ? ( | {data.outgoingTx ? ( | ||||
<> | <> | ||||
- {data.amountSent.toFixed(8)} | -{' '} | ||||
{formatBalance( | |||||
fromLegacyDecimals(data.amountSent), | |||||
)} | |||||
{currency.ticker} | {currency.ticker} | ||||
<br /> | <br /> | ||||
{fiatPrice !== null && | {fiatPrice !== null && | ||||
!isNaN(data.amountSent) && ( | !isNaN(data.amountSent) && ( | ||||
<TxFiatPrice> | <TxFiatPrice> | ||||
- $ | - $ | ||||
{( | {( | ||||
data.amountSent * fiatPrice | fromLegacyDecimals( | ||||
data.amountSent, | |||||
) * fiatPrice | |||||
).toFixed(2)}{' '} | ).toFixed(2)}{' '} | ||||
USD | USD | ||||
</TxFiatPrice> | </TxFiatPrice> | ||||
)} | )} | ||||
</> | </> | ||||
) : ( | ) : ( | ||||
<> | <> | ||||
+ {data.amountReceived.toFixed(8)} | +{' '} | ||||
{formatBalance( | |||||
fromLegacyDecimals(data.amountReceived), | |||||
)} | |||||
{currency.ticker} | {currency.ticker} | ||||
<br /> | <br /> | ||||
{fiatPrice !== null && | {fiatPrice !== null && | ||||
!isNaN(data.amountReceived) && ( | !isNaN(data.amountReceived) && ( | ||||
<TxFiatPrice> | <TxFiatPrice> | ||||
+ $ | + $ | ||||
{( | {( | ||||
data.amountReceived * fiatPrice | fromLegacyDecimals( | ||||
data.amountReceived, | |||||
) * fiatPrice | |||||
).toFixed(2)}{' '} | ).toFixed(2)}{' '} | ||||
USD | USD | ||||
</TxFiatPrice> | </TxFiatPrice> | ||||
)} | )} | ||||
</> | </> | ||||
)} | )} | ||||
</TxInfo> | </TxInfo> | ||||
</> | </> | ||||
)} | )} | ||||
</TxWrapper> | </TxWrapper> | ||||
); | ); | ||||
}; | }; | ||||
export default Tx; | export default Tx; |