Skip to content
This repository has been archived by the owner on Jul 22, 2020. It is now read-only.

Commit

Permalink
feat: clicking on "Current Leader" now copies the pubkey to the clipb…
Browse files Browse the repository at this point in the history
…oard
  • Loading branch information
mvines committed Apr 22, 2019
1 parent 283147b commit 9e34473
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 11 additions & 1 deletion src/BxStatsTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -23,7 +33,7 @@ class BxStatsTable extends React.Component {
<Grid container justify="center" spacing={24} className="sideBySide">
<Grid item>
<Card>
<CardContent>
<CardContent onClick={() => this.copyLeaderPublickey()}>
<Typography variant="h5" component="h2" align="center">
Current Leader
<BxHelpLink text="Leader" term="leader"/>
Expand Down
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"

[email protected]:
version "2.6.4"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.4.tgz#b8897c062c4d769dd30a0ac5c73976c47f92ea0d"
Expand Down Expand Up @@ -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=

[email protected]:
version "2.0.2"
resolved "https://registry.yarnpkg.com/topo/-/topo-2.0.2.tgz#cd5615752539057c0dc0491a621c3bc6fbe1d182"
Expand Down

0 comments on commit 9e34473

Please sign in to comment.