diff --git a/app/soapbox/features/crypto_donate/components/crypto_address.js b/app/soapbox/features/crypto_donate/components/crypto_address.js index 512ba686c..483c04953 100644 --- a/app/soapbox/features/crypto_donate/components/crypto_address.js +++ b/app/soapbox/features/crypto_donate/components/crypto_address.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import QRCode from 'qrcode.react'; +import { FormattedMessage } from 'react-intl'; import CoinDB from '../utils/coin_db'; import { getCoinIcon } from '../utils/coin_icons'; @@ -13,6 +13,19 @@ export default class CryptoAddress extends ImmutablePureComponent { note: PropTypes.string, } + setInputRef = c => { + this.input = c; + } + + handleCopyClick = e => { + if (!this.input) return; + + this.input.select(); + this.input.setSelectionRange(0, 99999); + + document.execCommand('copy'); + } + render() { const { address, ticker, note } = this.props; const title = CoinDB.getIn([ticker, 'name']); @@ -22,12 +35,14 @@ export default class CryptoAddress extends ImmutablePureComponent {