diff options
author | Dan Finlay <dan@danfinlay.com> | 2017-03-09 07:37:37 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2017-03-09 07:38:22 +0800 |
commit | 42e4a0621b17006a61ebfbe057b51f70091e3d55 (patch) | |
tree | e28ac1040af218394011090481247a9e7c50ac82 | |
parent | e3f6c010abb5cec35910dc4ea83f451287d25f11 (diff) | |
download | tangerine-wallet-browser-42e4a0621b17006a61ebfbe057b51f70091e3d55.tar tangerine-wallet-browser-42e4a0621b17006a61ebfbe057b51f70091e3d55.tar.gz tangerine-wallet-browser-42e4a0621b17006a61ebfbe057b51f70091e3d55.tar.bz2 tangerine-wallet-browser-42e4a0621b17006a61ebfbe057b51f70091e3d55.tar.lz tangerine-wallet-browser-42e4a0621b17006a61ebfbe057b51f70091e3d55.tar.xz tangerine-wallet-browser-42e4a0621b17006a61ebfbe057b51f70091e3d55.tar.zst tangerine-wallet-browser-42e4a0621b17006a61ebfbe057b51f70091e3d55.zip |
Add ENS click to copy
Also bump ethjs-ens version to get proper error for unregistered names.
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | ui/app/components/ens-input.js | 17 |
2 files changed, 9 insertions, 10 deletions
diff --git a/package.json b/package.json index a03f8a38d..96d58fa1b 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "ethereumjs-tx": "^1.0.0", "ethereumjs-util": "ethereumjs/ethereumjs-util#ac5d0908536b447083ea422b435da27f26615de9", "ethereumjs-wallet": "^0.6.0", - "ethjs-ens": "^1.0.1", + "ethjs-ens": "^1.0.2", "express": "^4.14.0", "extension-link-enabler": "^1.0.0", "extensionizer": "^1.0.0", diff --git a/ui/app/components/ens-input.js b/ui/app/components/ens-input.js index f018cc632..ffc4eab4a 100644 --- a/ui/app/components/ens-input.js +++ b/ui/app/components/ens-input.js @@ -3,6 +3,7 @@ const h = require('react-hyperscript') const inherits = require('util').inherits const extend = require('xtend') const debounce = require('debounce') +const copyToClipboard = require('copy-to-clipboard') const ENS = require('ethjs-ens') const ensRE = /.+\.eth$/ @@ -27,7 +28,6 @@ EnsInput.prototype.render = function () { const recipient = document.querySelector('input[name="address"]').value if (recipient.match(ensRE) === null) { - console.dir(recipient) return this.setState({ loadingEns: false, ensResolution: null, @@ -76,20 +76,15 @@ EnsInput.prototype.lookupEnsName = function () { log.info(`ENS attempting to resolve name: ${recipient}`) this.ens.lookup(recipient.trim()) .then((address) => { - console.log('ens called back with ' + address) - if (address !== ensResolution) { this.setState({ loadingEns: false, ensResolution: address, - hoverText: address, + hoverText: address + '\nClick to Copy', }) } }) .catch((reason) => { - console.log('ens threw error: ' + reason.message) - console.trace(reason) - debugger return this.setState({ loadingEns: false, ensFailure: true, @@ -103,7 +98,6 @@ EnsInput.prototype.componentDidUpdate = function (prevProps, prevState) { const { ensResolution } = state if (ensResolution && this.props.onChange && ensResolution !== prevState.ensResolution) { - console.log('Firing on change to parent') this.props.onChange(ensResolution) } } @@ -139,8 +133,13 @@ EnsInput.prototype.ensIconContents = function (recipient) { } if (ensResolution) { - return h('i.fa.fa-check-circle.fa-lg', { + return h('i.fa.fa-check-circle.fa-lg.cursor-pointer', { style: { color: 'green' }, + onClick: (event) => { + event.preventDefault() + event.stopPropagation() + copyToClipboard(ensResolution) + }, }) } } |