From 1ca6fff31719c4ff8d155dc9f7c88663a6719046 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Thu, 9 Mar 2017 11:31:00 -0800 Subject: Display owned addresses in datalist. --- ui/app/components/ens-input.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'ui/app/components') diff --git a/ui/app/components/ens-input.js b/ui/app/components/ens-input.js index ffc4eab4a..80c8deb22 100644 --- a/ui/app/components/ens-input.js +++ b/ui/app/components/ens-input.js @@ -21,6 +21,7 @@ function EnsInput () { EnsInput.prototype.render = function () { const props = this.props const opts = extend(props, { + list: 'addresses', onChange: () => { const network = this.props.network let resolverAddress = networkResolvers[network] @@ -46,6 +47,15 @@ EnsInput.prototype.render = function () { style: { width: '100%' }, }, [ h('input.large-input', opts), + h('datalist', + { + id: 'addresses', + }, + [ + Object.keys(props.identities).map((key) => { + return h('option', props.identities[key].address) + }), + ]), this.ensIcon(), ]) } -- cgit v1.2.3 From d270cbc9d2f45b6dae184efbe6c405889ee8cba5 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Thu, 9 Mar 2017 13:07:38 -0800 Subject: Create distinct labels and names for addresses. --- ui/app/components/ens-input.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ui/app/components') diff --git a/ui/app/components/ens-input.js b/ui/app/components/ens-input.js index 80c8deb22..2b224fa3e 100644 --- a/ui/app/components/ens-input.js +++ b/ui/app/components/ens-input.js @@ -53,7 +53,11 @@ EnsInput.prototype.render = function () { }, [ Object.keys(props.identities).map((key) => { - return h('option', props.identities[key].address) + let identity = props.identities[key] + return h('option', { + value: identity.address, + label: identity.name, + }) }), ]), this.ensIcon(), -- cgit v1.2.3 From b34ee4daa145c1d4eea2da6fd0cba0763e5c6483 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Thu, 9 Mar 2017 15:10:27 -0800 Subject: Allow for adding recently used addresses to address book. --- ui/app/components/ens-input.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'ui/app/components') diff --git a/ui/app/components/ens-input.js b/ui/app/components/ens-input.js index 2b224fa3e..06efe6652 100644 --- a/ui/app/components/ens-input.js +++ b/ui/app/components/ens-input.js @@ -59,6 +59,12 @@ EnsInput.prototype.render = function () { label: identity.name, }) }), + props.addressBook.map((identity) => { + return h('option', { + value: identity.address, + label: identity.name, + }) + }), ]), this.ensIcon(), ]) @@ -94,11 +100,13 @@ EnsInput.prototype.lookupEnsName = function () { this.setState({ loadingEns: false, ensResolution: address, + nickname: recipient.trim(), hoverText: address + '\nClick to Copy', }) } }) .catch((reason) => { + log.error(reason) return this.setState({ loadingEns: false, ensFailure: true, @@ -109,10 +117,11 @@ EnsInput.prototype.lookupEnsName = function () { EnsInput.prototype.componentDidUpdate = function (prevProps, prevState) { const state = this.state || {} - const { ensResolution } = state + const ensResolution = state.ensResolution + const nickname = state.nickname || ' ' if (ensResolution && this.props.onChange && ensResolution !== prevState.ensResolution) { - this.props.onChange(ensResolution) + this.props.onChange(ensResolution, nickname) } } -- cgit v1.2.3 From 2ab86b001dfc4ade4fc6df030175e64359b757e6 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Fri, 10 Mar 2017 09:34:13 -0800 Subject: Add comments. --- ui/app/components/ens-input.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ui/app/components') diff --git a/ui/app/components/ens-input.js b/ui/app/components/ens-input.js index 06efe6652..d5348ea62 100644 --- a/ui/app/components/ens-input.js +++ b/ui/app/components/ens-input.js @@ -47,11 +47,13 @@ EnsInput.prototype.render = function () { style: { width: '100%' }, }, [ h('input.large-input', opts), + // The address book functionality. h('datalist', { id: 'addresses', }, [ + // Corresponds to the addresses owned. Object.keys(props.identities).map((key) => { let identity = props.identities[key] return h('option', { @@ -59,6 +61,7 @@ EnsInput.prototype.render = function () { label: identity.name, }) }), + // Corresponds to previously sent-to addresses. props.addressBook.map((identity) => { return h('option', { value: identity.address, @@ -118,6 +121,8 @@ EnsInput.prototype.lookupEnsName = function () { EnsInput.prototype.componentDidUpdate = function (prevProps, prevState) { const state = this.state || {} const ensResolution = state.ensResolution + // If an address is sent without a nickname, meaning not from ENS or from + // the user's own accounts, a default of a one-space string is used. const nickname = state.nickname || ' ' if (ensResolution && this.props.onChange && ensResolution !== prevState.ensResolution) { -- cgit v1.2.3 From 1ec7930c75f10390e3e4ab553e1032056d1d2c2f Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 14 Mar 2017 14:04:52 -0700 Subject: Minor change in removing opts object. --- ui/app/components/ens-input.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'ui/app/components') diff --git a/ui/app/components/ens-input.js b/ui/app/components/ens-input.js index d5348ea62..facf29d97 100644 --- a/ui/app/components/ens-input.js +++ b/ui/app/components/ens-input.js @@ -48,10 +48,7 @@ EnsInput.prototype.render = function () { }, [ h('input.large-input', opts), // The address book functionality. - h('datalist', - { - id: 'addresses', - }, + h('datalist#addresses', [ // Corresponds to the addresses owned. Object.keys(props.identities).map((key) => { -- cgit v1.2.3