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.
71 lines
2.1 KiB
71 lines
2.1 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 zap from 'icons/zap.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 Payment = ({ payment, ticker, currentTicker, showActivityModal, nodes, currencyName }) => {
|
||
|
const displayNodeName = pubkey => {
|
||
7 years ago
|
const node = nodes.find(n => pubkey === n.pub_key)
|
||
7 years ago
|
|
||
7 years ago
|
if (node && node.alias.length) {
|
||
|
return node.alias
|
||
|
}
|
||
7 years ago
|
|
||
|
return pubkey.substring(0, 10)
|
||
|
}
|
||
|
|
||
|
return (
|
||
7 years ago
|
<div
|
||
|
className={styles.container}
|
||
|
onClick={() => showActivityModal('PAYMENT', payment.payment_hash)}
|
||
|
>
|
||
7 years ago
|
<div className={styles.activityTypeIcon}>
|
||
|
<section className="hint--bottom" data-hint="Lightning payment">
|
||
|
<Isvg src={zap} />
|
||
|
</section>
|
||
|
</div>
|
||
|
|
||
7 years ago
|
<div className={styles.data}>
|
||
|
<div className={styles.title}>
|
||
7 years ago
|
<h3>{displayNodeName(payment.path[payment.path.length - 1])}</h3>
|
||
7 years ago
|
</div>
|
||
|
<div className={styles.subtitle}>
|
||
7 years ago
|
<Moment format="h:mm a">{payment.creation_date * 1000}</Moment>
|
||
7 years ago
|
</div>
|
||
7 years ago
|
</div>
|
||
7 years ago
|
<div className={`hint--top-left ${styles.amount}`} data-hint="Payment amount">
|
||
|
<span>
|
||
7 years ago
|
<i className={styles.minus}>-</i>
|
||
7 years ago
|
<Value
|
||
|
value={payment.value}
|
||
|
currency={ticker.currency}
|
||
|
currentTicker={currentTicker}
|
||
|
fiatTicker={ticker.fiatTicker}
|
||
|
/>
|
||
7 years ago
|
<i> {currencyName}</i>
|
||
|
</span>
|
||
7 years ago
|
<span className="hint--bottom" data-hint="Payment fee">
|
||
|
{currentTicker[ticker.fiatTicker].symbol}
|
||
7 years ago
|
{btc.convert('sats', 'fiat', payment.value, currentTicker[ticker.fiatTicker].last)}
|
||
7 years ago
|
</span>
|
||
7 years ago
|
</div>
|
||
|
</div>
|
||
7 years ago
|
)
|
||
|
}
|
||
7 years ago
|
|
||
|
Payment.propTypes = {
|
||
7 years ago
|
currencyName: PropTypes.string.isRequired,
|
||
7 years ago
|
payment: PropTypes.object.isRequired,
|
||
|
ticker: PropTypes.object.isRequired,
|
||
|
currentTicker: PropTypes.object.isRequired,
|
||
7 years ago
|
nodes: PropTypes.array.isRequired,
|
||
7 years ago
|
showActivityModal: PropTypes.func.isRequired
|
||
7 years ago
|
}
|
||
|
|
||
|
export default Payment
|