import React from 'react'
import PropTypes from 'prop-types'
import FaAngleDown from 'react-icons/lib/fa/angle-down'
import Isvg from 'react-inlinesvg'
import { btc, blockExplorer } from 'lib/utils'
import Value from 'components/Value'
import AnimatedCheckmark from 'components/AnimatedCheckmark'
import zapLogo from 'icons/zap_logo.svg'
import qrCode from 'icons/qrcode.svg'
import styles from './Wallet.scss'
const Wallet = ({
balance,
info,
openReceiveModal,
ticker,
currentTicker,
openPayForm,
openRequestForm,
showPayLoadingScreen,
showSuccessPayScreen,
successTransactionScreen,
currentCurrencyFilters,
currencyName,
setCurrency,
setWalletCurrencyFilters,
network
}) => {
const usdAmount = btc.satoshisToUsd(
parseInt(balance.walletBalance, 10) + parseInt(balance.channelBalance, 10),
currentTicker.price_usd
)
const onCurrencyFilterClick = currency => {
setCurrency(currency)
setWalletCurrencyFilters(false)
}
return (
{currencyName}
setWalletCurrencyFilters(!info.showWalletCurrencyFilters)}>
{currentCurrencyFilters.map(filter => (
- onCurrencyFilterClick(filter.key)}>
{filter.name}
))}
≈ ${usdAmount ? usdAmount.toLocaleString() : ''}
{showPayLoadingScreen && (
Sending your transaction...
)}
{showSuccessPayScreen && (
Successfully sent payment
)}
{successTransactionScreen.show && (
Successfully{' '}
{
return blockExplorer.showTransaction(network, successTransactionScreen.txid)
}}
>
sent
{' '}
transaction
)}
)
}
Wallet.propTypes = {
balance: PropTypes.object.isRequired,
info: PropTypes.object.isRequired,
ticker: PropTypes.object.isRequired,
currentTicker: PropTypes.object.isRequired,
openPayForm: PropTypes.func.isRequired,
openRequestForm: PropTypes.func.isRequired,
openReceiveModal: PropTypes.func.isRequired,
showPayLoadingScreen: PropTypes.bool.isRequired,
showSuccessPayScreen: PropTypes.bool.isRequired,
network: PropTypes.object.isRequired,
successTransactionScreen: PropTypes.object.isRequired,
currentCurrencyFilters: PropTypes.array.isRequired,
currencyName: PropTypes.string.isRequired,
setCurrency: PropTypes.func.isRequired,
setWalletCurrencyFilters: PropTypes.func.isRequired
}
export default Wallet