You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
2.0 KiB
65 lines
2.0 KiB
7 years ago
|
import React from 'react'
|
||
|
import PropTypes from 'prop-types'
|
||
7 years ago
|
import Moment from 'react-moment'
|
||
7 years ago
|
import Isvg from 'react-inlinesvg'
|
||
|
import link from 'icons/link.svg'
|
||
7 years ago
|
|
||
7 years ago
|
import { btc } from 'lib/utils'
|
||
7 years ago
|
import Value from 'components/Value'
|
||
7 years ago
|
import styles from '../Activity.scss'
|
||
7 years ago
|
|
||
7 years ago
|
const Transaction = ({ transaction, ticker, currentTicker, showActivityModal, currencyName }) => (
|
||
7 years ago
|
<div
|
||
|
className={styles.container}
|
||
7 years ago
|
onClick={() => showActivityModal('TRANSACTION', transaction.tx_hash)}
|
||
7 years ago
|
>
|
||
7 years ago
|
<div className={styles.activityTypeIcon}>
|
||
|
<section className="hint--bottom" data-hint="On-chain transaction">
|
||
|
<Isvg src={link} />
|
||
|
</section>
|
||
|
</div>
|
||
|
|
||
7 years ago
|
<div className={styles.data}>
|
||
|
<div className={styles.title}>
|
||
7 years ago
|
<h3>{transaction.received ? 'Received' : 'Sent'}</h3>
|
||
7 years ago
|
</div>
|
||
|
<div className={styles.subtitle}>
|
||
7 years ago
|
<Moment format="h:mm a">{transaction.time_stamp * 1000}</Moment>
|
||
7 years ago
|
</div>
|
||
|
</div>
|
||
7 years ago
|
<div
|
||
|
className={`hint--top-left ${styles.amount} ${
|
||
|
transaction.received ? styles.positive : styles.negative
|
||
|
}`}
|
||
|
data-hint="Transaction amount"
|
||
|
>
|
||
|
<span>
|
||
7 years ago
|
<i className={transaction.received ? styles.plus : styles.minus}>
|
||
|
{transaction.received ? '+' : '-'}
|
||
7 years ago
|
</i>
|
||
|
<Value
|
||
|
value={transaction.amount}
|
||
|
currency={ticker.currency}
|
||
|
currentTicker={currentTicker}
|
||
7 years ago
|
fiatTicker={ticker.fiatTicker}
|
||
7 years ago
|
/>
|
||
7 years ago
|
<i> {currencyName}</i>
|
||
7 years ago
|
</span>
|
||
7 years ago
|
<span className="hint--bottom" data-hint="Transaction fee">
|
||
|
{currentTicker[ticker.fiatTicker].symbol}
|
||
7 years ago
|
{btc.convert('sats', 'fiat', transaction.amount, currentTicker[ticker.fiatTicker].last)}
|
||
7 years ago
|
</span>
|
||
7 years ago
|
</div>
|
||
7 years ago
|
</div>
|
||
|
)
|
||
|
|
||
|
Transaction.propTypes = {
|
||
7 years ago
|
transaction: PropTypes.object.isRequired,
|
||
|
ticker: PropTypes.object.isRequired,
|
||
|
currentTicker: PropTypes.object.isRequired,
|
||
7 years ago
|
showActivityModal: PropTypes.func.isRequired,
|
||
|
currencyName: PropTypes.string.isRequired
|
||
7 years ago
|
}
|
||
|
|
||
|
export default Transaction
|