/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ import * as React from 'react' import { StyledWrapper, StyledTitle, StyledNote, StyledAddresses, StyledAddress, StyledLogo, StyledData, StyledShowQR, StyledQRImageWrapper, StyledQRImage, StyledAddressTitle, StyledLink, StyledHeader, StyledWalletAddress, StyledQRButton, StyledText } from './style' import Modal from '../../../components/popupModals/modal/index' import { getLocale } from '../../../helpers' import Input from '../../../components/formControls/input' import { BatColorIcon, BitcoinColorIcon, EthereumColorIcon, LitecoinColorIcon } from '../../../components/icons' export type Type = 'BAT' | 'ETH' | 'BTC' | 'LTC' export interface Address { address: string qr: string | null type: Type } export interface Props { onClose: () => void id?: string isMobile?: boolean addresses: Address[] } const icons: Record = { BAT: , ETH: , BTC: , LTC: } interface State { current?: Type } export default class ModalAddFunds extends React.PureComponent { constructor (props: Props) { super(props) this.state = { current: undefined } } onQR = (type: Type) => { this.setState({ current: type }) } getAddress = (address: Address) => { const { isMobile } = this.props const current = address.type === this.state.current return ( {icons[address.type]} {getLocale(`title${address.type}`)} {getLocale('walletAddress')} { address.qr ? (<> { current ? : } ) : null } ) } render () { const { id, onClose, addresses, isMobile } = this.props return ( {getLocale('addFundsTitle')} {getLocale('addFundsText')} { addresses && addresses.map((address: Address) => this.getAddress(address)) } {getLocale('addFundsNote')} {getLocale('addFundsFAQ')} . ) } }