|
|
@ -3,6 +3,7 @@ import PropTypes from 'prop-types' |
|
|
|
import { FaAngleDown } from 'react-icons/lib/fa' |
|
|
|
import Isvg from 'react-inlinesvg' |
|
|
|
import { btc } from 'utils' |
|
|
|
import Value from 'components/Value' |
|
|
|
import bitcoinIcon from 'icons/bitcoin.svg' |
|
|
|
import zapLogo from 'icons/zap_logo.svg' |
|
|
|
import qrCode from 'icons/qrcode.svg' |
|
|
@ -22,17 +23,18 @@ class Wallet extends Component { |
|
|
|
|
|
|
|
render() { |
|
|
|
const { |
|
|
|
setCurrency, |
|
|
|
balance, |
|
|
|
address, |
|
|
|
info, |
|
|
|
newAddress, |
|
|
|
ticker, |
|
|
|
currentTicker, |
|
|
|
openPayForm, |
|
|
|
openRequestForm |
|
|
|
} = this.props |
|
|
|
|
|
|
|
const { modalOpen, qrCodeType } = this.state |
|
|
|
const usdAmount = btc.satoshisToUsd((parseInt(balance.walletBalance, 10) + parseInt(balance.channelBalance, 10)), currentTicker.price_usd) |
|
|
|
|
|
|
|
const changeQrCode = () => { |
|
|
|
const qrCodeNum = this.state.qrCodeType === 1 ? 2 : 1 |
|
|
@ -76,13 +78,31 @@ class Wallet extends Component { |
|
|
|
<div className={styles.details}> |
|
|
|
<h1> |
|
|
|
<span> |
|
|
|
{btc.satoshisToBtc(parseFloat(balance.walletBalance) + parseFloat(balance.channelBalance))}BTC |
|
|
|
<Value |
|
|
|
value={parseFloat(balance.walletBalance) + parseFloat(balance.channelBalance)} |
|
|
|
currency={ticker.currency} |
|
|
|
currentTicker={currentTicker} |
|
|
|
/> |
|
|
|
<i className={styles.currency}>{btc.renderCurrency(ticker.currency)}</i> |
|
|
|
</span> |
|
|
|
<span onClick={() => this.setState({ modalOpen: true })}> |
|
|
|
<Isvg className={styles.bitcoinLogo} src={qrCode} /> |
|
|
|
</span> |
|
|
|
</h1> |
|
|
|
<span className={styles.usdValue}>≈ ${usdAmount ? usdAmount.toLocaleString() : ''}</span> |
|
|
|
<div className={styles.tickerButtons}> |
|
|
|
<section className={ticker.currency === 'btc' && styles.active} onClick={() => setCurrency('btc')}> |
|
|
|
BTC |
|
|
|
</section> |
|
|
|
<section className={ticker.currency === 'bits' && styles.active} onClick={() => setCurrency('bits')}> |
|
|
|
Bits |
|
|
|
</section> |
|
|
|
<section className={ticker.currency === 'sats' && styles.active} onClick={() => setCurrency('sats')}> |
|
|
|
Satoshis |
|
|
|
</section> |
|
|
|
<section className={ticker.currency === 'usd' && styles.active} onClick={() => setCurrency('usd')}> |
|
|
|
USD |
|
|
|
</section> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -103,6 +123,7 @@ Wallet.propTypes = { |
|
|
|
address: PropTypes.string.isRequired, |
|
|
|
info: PropTypes.object.isRequired, |
|
|
|
newAddress: PropTypes.func.isRequired, |
|
|
|
ticker: PropTypes.object.isRequired, |
|
|
|
currentTicker: PropTypes.object.isRequired, |
|
|
|
openPayForm: PropTypes.func.isRequired, |
|
|
|
openRequestForm: PropTypes.func.isRequired |
|
|
|