Browse Source

Merge pull request #117 from NahomAgidew/feature/copy-invoice-button

added button to copy invoice
renovate/lint-staged-8.x
JimmyMow 7 years ago
committed by GitHub
parent
commit
61b9b3aaf4
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 85
      app/routes/activity/components/components/Modal/Invoice/Invoice.js
  2. 30
      app/routes/activity/components/components/Modal/Invoice/Invoice.scss

85
app/routes/activity/components/components/Modal/Invoice/Invoice.js

@ -5,56 +5,65 @@ import Moment from 'react-moment'
import 'moment-timezone' import 'moment-timezone'
import QRCode from 'qrcode.react' import QRCode from 'qrcode.react'
import copy from 'copy-to-clipboard'
import { showNotification } from 'notifications'
import { FaCircle } from 'react-icons/lib/fa' import { FaCircle, FaCopy } from 'react-icons/lib/fa'
import { btc } from 'utils' import { btc } from 'utils'
import styles from './Invoice.scss' import styles from './Invoice.scss'
const Invoice = ({ invoice, ticker, currentTicker }) => ( const Invoice = ({ invoice, ticker, currentTicker }) => {
<div className={styles.container}> const copyPaymentRequest = () => {
<div className={styles.settled}> copy(invoice.payment_request)
{ showNotification('Noice', 'Successfully copied to clipboard')
!invoice.settled && }
return (
<div className={styles.container}>
<div className={styles.settled}>
{
!invoice.settled &&
<p> <p>
<FaCircle /> <FaCircle />
<span>Not Paid</span> <span>Not Paid</span>
</p> </p>
} }
</div> </div>
<header> <header>
<h3>{invoice.memo}</h3> <h3>{invoice.memo}</h3>
<h1> <h1>
<span className={styles.value}> <span className={styles.value}>
{ {
ticker.currency === 'usd' ? ticker.currency === 'usd' ?
btc.satoshisToUsd(invoice.value, currentTicker.price_usd) btc.satoshisToUsd(invoice.value, currentTicker.price_usd)
: :
btc.satoshisToBtc(invoice.value) btc.satoshisToBtc(invoice.value)
} }
</span> </span>
<i>BTC</i> <i>BTC</i>
</h1> </h1>
</header> </header>
<div className={styles.qrcode}> <div className={styles.qrcode}>
<QRCode value={invoice.payment_request} size={150} /> <QRCode value={invoice.payment_request} size={150} />
</div> </div>
<div className={styles.input}> <div className={styles.input}>
<input <p className={styles.invoiceAddress}>
readOnly <span>{invoice.payment_request}</span>
className={styles.paymentRequest} <span onClick={copyPaymentRequest} className='hint--left' data-hint='Copy Invoice'>
onClick={event => event.target.select()} <FaCopy />
defaultValue={invoice.payment_request} </span>
/> </p>
</div> </div>
<p className={styles.date}> <p className={styles.date}>
Created on Created on
<Moment format='MMM Do'>{invoice.creation_date * 1000}</Moment> <Moment format='MMM Do'>{invoice.creation_date * 1000}</Moment>
</p> </p>
</div> </div>
) )
}
Invoice.propTypes = { Invoice.propTypes = {
invoice: PropTypes.object.isRequired, invoice: PropTypes.object.isRequired,

30
app/routes/activity/components/components/Modal/Invoice/Invoice.scss

@ -53,7 +53,6 @@
.input { .input {
padding: 10px 40px; padding: 10px 40px;
.paymentRequest { .paymentRequest {
text-align: center; text-align: center;
font-size: 12px; font-size: 12px;
@ -75,4 +74,33 @@
margin-left: 3px; margin-left: 3px;
} }
} }
.invoiceAddress {
display: flex;
flex-direction: row;
font-family: 'Roboto';
font-size: 14px;
font-weight: 200;
background: $lightgrey;
span {
padding: 15px;
}
span:nth-child(1) {
flex: 9;
overflow-x: scroll;
}
span:nth-child(2) {
background: $darkgrey;
color: $black;
cursor: pointer;
transition: all 0.25s;
&:hover {
background: $darkestgrey;
}
}
}
} }
Loading…
Cancel
Save