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.
70 lines
2.1 KiB
70 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 { btc } from 'lib/utils'
|
||
7 years ago
|
|
||
7 years ago
|
import Isvg from 'react-inlinesvg'
|
||
7 years ago
|
import Value from 'components/Value'
|
||
7 years ago
|
import checkmarkIcon from 'icons/check_circle.svg'
|
||
7 years ago
|
import styles from '../Activity.scss'
|
||
7 years ago
|
|
||
7 years ago
|
const Invoice = ({ invoice, ticker, currentTicker, showActivityModal, currencyName }) => (
|
||
7 years ago
|
<div
|
||
7 years ago
|
className={`${styles.container} ${!invoice.settled ? styles.unpaid : undefined}`}
|
||
7 years ago
|
onClick={() => showActivityModal('INVOICE', invoice.payment_request)}
|
||
7 years ago
|
>
|
||
7 years ago
|
<div className={styles.activityTypeIcon}>
|
||
|
<section
|
||
|
className="hint--bottom"
|
||
7 years ago
|
data-hint={`Lightning invoice (${invoice.settled ? 'paid)' : 'unpaid'})`}
|
||
7 years ago
|
>
|
||
|
<Isvg src={checkmarkIcon} />
|
||
|
</section>
|
||
|
</div>
|
||
7 years ago
|
|
||
7 years ago
|
<div className={styles.data}>
|
||
|
<div className={styles.title}>
|
||
7 years ago
|
<h3>{invoice.settled ? 'Received payment' : 'Requested payment'}</h3>
|
||
7 years ago
|
</div>
|
||
|
<div className={styles.subtitle}>
|
||
7 years ago
|
<Moment format="h:mm a">
|
||
7 years ago
|
{invoice.settled ? invoice.settle_date * 1000 : invoice.creation_date * 1000}
|
||
7 years ago
|
</Moment>
|
||
7 years ago
|
</div>
|
||
|
</div>
|
||
7 years ago
|
<div
|
||
|
className={`hint--top-left ${styles.amount} ${
|
||
|
invoice.settled ? styles.positive : styles.negative
|
||
|
}`}
|
||
|
data-hint="Invoice amount"
|
||
|
>
|
||
|
<span>
|
||
7 years ago
|
<i className={styles.plus}>+</i>
|
||
7 years ago
|
<Value
|
||
7 years ago
|
value={invoice.value}
|
||
7 years ago
|
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>
|
||
7 years ago
|
<span>
|
||
|
{currentTicker[ticker.fiatTicker].symbol}
|
||
7 years ago
|
{btc.convert('sats', 'fiat', invoice.value, currentTicker[ticker.fiatTicker].last)}
|
||
7 years ago
|
</span>
|
||
7 years ago
|
</span>
|
||
7 years ago
|
</div>
|
||
7 years ago
|
</div>
|
||
|
)
|
||
|
|
||
|
Invoice.propTypes = {
|
||
7 years ago
|
invoice: 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 Invoice
|