From 3e6a6d75cdc07f40e1406a4a44561d9af4a54afe Mon Sep 17 00:00:00 2001 From: nicocappabianca Date: Tue, 22 Sep 2020 23:28:35 -0300 Subject: [PATCH 1/4] copy address clicking QR --- package-lock.json | 13 ++++++++++++ package.json | 1 + .../admin-lte/send-receive/receive.js | 20 ++++++++++++++++++- .../admin-lte/send-receive/send-receive.css | 8 ++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index b07f6bf..ea8a449 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8330,6 +8330,14 @@ "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=" }, + "copy-to-clipboard": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/copy-to-clipboard/-/copy-to-clipboard-3.3.1.tgz", + "integrity": "sha512-i13qo6kIHTTpCm8/Wup+0b1mVWETvu2kIMzKoK8FpkLkFxlt0znUAHcMzox+T8sPlqtZXq3CulEjQHsYiGFJUw==", + "requires": { + "toggle-selection": "^1.0.6" + } + }, "copyfiles": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/copyfiles/-/copyfiles-2.3.0.tgz", @@ -39120,6 +39128,11 @@ } } }, + "toggle-selection": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/toggle-selection/-/toggle-selection-1.0.6.tgz", + "integrity": "sha1-bkWxJj8gF/oKzH2J14sVuL932jI=" + }, "toidentifier": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", diff --git a/package.json b/package.json index 088fe36..b899f39 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ }, "dependencies": { "adminlte-2-react": "^0.1.27", + "copy-to-clipboard": "^3.3.1", "gatsby": "^2.23.7", "gatsby-image": "^2.4.5", "gatsby-plugin-ipfs": "^2.0.2", diff --git a/src/components/admin-lte/send-receive/receive.js b/src/components/admin-lte/send-receive/receive.js index 770b534..4d68795 100644 --- a/src/components/admin-lte/send-receive/receive.js +++ b/src/components/admin-lte/send-receive/receive.js @@ -1,6 +1,7 @@ import React from 'react' import PropTypes from 'prop-types' import { Content, Row, Col, Box } from 'adminlte-2-react' +import copy from 'copy-to-clipboard' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' @@ -12,7 +13,8 @@ class Receive extends React.Component { super(props) _this = this this.state = { - addr: _this.props.walletInfo.cashAddress + addr: _this.props.walletInfo.cashAddress, + copySuccess: false } } @@ -37,11 +39,17 @@ class Receive extends React.Component { + {_this.state.copySuccess && +
+ Copied! +
}

{_this.state.addr}