diff --git a/package.json b/package.json index 2fcd9ac6..e8735412 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "@solana/web3.js": "^0.14.18", "babel-plugin-transform-runtime": "^6.23.0", "base-58": "^0.0.1", + "copy-to-clipboard": "^3.1.0", "cors": "^2.8.5", "express": "^4.16.4", "express-ws": "^4.0.0", diff --git a/src/BxStatsTable.jsx b/src/BxStatsTable.jsx index ec5146c5..b97c6515 100644 --- a/src/BxStatsTable.jsx +++ b/src/BxStatsTable.jsx @@ -7,8 +7,18 @@ import CardContent from '@material-ui/core/CardContent'; import Grid from '@material-ui/core/Grid'; import Typography from '@material-ui/core/Typography'; import _ from 'lodash'; +import copy from 'copy-to-clipboard'; class BxStatsTable extends React.Component { + + copyLeaderPublickey() { + const leader = this.props.globalStats['!ent-last-leader']; + if (leader) { + console.log(`Copied ${leader} to clipboard`); + copy(leader); + } + } + render() { const {globalStats} = this.props; @@ -23,7 +33,7 @@ class BxStatsTable extends React.Component { - + this.copyLeaderPublickey()}> Current Leader diff --git a/yarn.lock b/yarn.lock index 63d36524..79fecd2b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3654,6 +3654,13 @@ copy-descriptor@^0.1.0: resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= +copy-to-clipboard@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/copy-to-clipboard/-/copy-to-clipboard-3.1.0.tgz#0a28141899e6bd217b9dc13fd1689b3b38820b44" + integrity sha512-+RNyDq266tv5aGhfRsL6lxgj8Y6sCvTrVJnFUVvuxuqkcSMaLISt1wd4JkdQSphbcLTIQ9kEpTULNnoCXAFdng== + dependencies: + toggle-selection "^1.0.6" + core-js@2.6.4: version "2.6.4" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.4.tgz#b8897c062c4d769dd30a0ac5c73976c47f92ea0d" @@ -12657,6 +12664,11 @@ to-regex@^3.0.1, to-regex@^3.0.2: regex-not "^1.0.2" safe-regex "^1.1.0" +toggle-selection@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/toggle-selection/-/toggle-selection-1.0.6.tgz#6e45b1263f2017fa0acc7d89d78b15b8bf77da32" + integrity sha1-bkWxJj8gF/oKzH2J14sVuL932jI= + topo@2.x.x: version "2.0.2" resolved "https://registry.yarnpkg.com/topo/-/topo-2.0.2.tgz#cd5615752539057c0dc0491a621c3bc6fbe1d182"