From a4c3f6b65c9a25da0319b9077d830c23f729b32f Mon Sep 17 00:00:00 2001 From: Esteban MIno Date: Tue, 14 Aug 2018 20:08:12 -0300 Subject: add support for images base64 and urls on new ui --- ui/app/components/identicon.js | 65 +++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 29 deletions(-) (limited to 'ui/app/components/identicon.js') diff --git a/ui/app/components/identicon.js b/ui/app/components/identicon.js index 424048745..eadd6d5a2 100644 --- a/ui/app/components/identicon.js +++ b/ui/app/components/identicon.js @@ -26,36 +26,43 @@ function mapStateToProps (state) { IdenticonComponent.prototype.render = function () { var props = this.props - const { className = '', address } = props + const { className = '', address, imageUrl } = props var diameter = props.diameter || this.defaultDiameter - - return address - ? ( - h('div', { - className: `${className} identicon`, - key: 'identicon-' + address, - style: { - display: 'flex', - flexShrink: 0, - alignItems: 'center', - justifyContent: 'center', - height: diameter, - width: diameter, - borderRadius: diameter / 2, - overflow: 'hidden', - }, - }) - ) - : ( - h('img.balance-icon', { - src: './images/eth_logo.svg', - style: { - height: diameter, - width: diameter, - borderRadius: diameter / 2, - }, - }) - ) + // for tokens added with `watchToken` we need to render the given image + if (imageUrl) { + return h('img.balance-icon', { + src: imageUrl, + style: { + height: diameter, + width: diameter, + borderRadius: diameter / 2, + }, + }) + } else if (address) { + return h('div', { + className: `${className} identicon`, + key: 'identicon-' + address, + style: { + display: 'flex', + flexShrink: 0, + alignItems: 'center', + justifyContent: 'center', + height: diameter, + width: diameter, + borderRadius: diameter / 2, + overflow: 'hidden', + }, + }) + } else { + return h('img.balance-icon', { + src: './images/eth_logo.svg', + style: { + height: diameter, + width: diameter, + borderRadius: diameter / 2, + }, + }) + } } IdenticonComponent.prototype.componentDidMount = function () { -- cgit v1.2.3 From a36ea0e2328e6ffedd5b526470dc1133c4f2f556 Mon Sep 17 00:00:00 2001 From: Esteban MIno Date: Thu, 16 Aug 2018 12:04:43 -0300 Subject: show watch asset image from hide token modal --- ui/app/components/identicon.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'ui/app/components/identicon.js') diff --git a/ui/app/components/identicon.js b/ui/app/components/identicon.js index eadd6d5a2..6b632352f 100644 --- a/ui/app/components/identicon.js +++ b/ui/app/components/identicon.js @@ -28,14 +28,17 @@ IdenticonComponent.prototype.render = function () { var props = this.props const { className = '', address, imageUrl } = props var diameter = props.diameter || this.defaultDiameter - // for tokens added with `watchToken` we need to render the given image + const style = { + height: diameter, + width: diameter, + borderRadius: diameter / 2, + } if (imageUrl) { - return h('img.balance-icon', { + return h('img', { + className: `${className} identicon`, src: imageUrl, style: { - height: diameter, - width: diameter, - borderRadius: diameter / 2, + ...style, }, }) } else if (address) { @@ -47,9 +50,7 @@ IdenticonComponent.prototype.render = function () { flexShrink: 0, alignItems: 'center', justifyContent: 'center', - height: diameter, - width: diameter, - borderRadius: diameter / 2, + ...style, overflow: 'hidden', }, }) @@ -57,9 +58,7 @@ IdenticonComponent.prototype.render = function () { return h('img.balance-icon', { src: './images/eth_logo.svg', style: { - height: diameter, - width: diameter, - borderRadius: diameter / 2, + ...style, }, }) } -- cgit v1.2.3 From b59a1e91b8f4b595500a0785f325e833fa35407d Mon Sep 17 00:00:00 2001 From: Esteban MIno Date: Thu, 23 Aug 2018 15:54:40 -0300 Subject: typo watchAsset imageUrl to image --- ui/app/components/identicon.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ui/app/components/identicon.js') diff --git a/ui/app/components/identicon.js b/ui/app/components/identicon.js index 6b632352f..076e65b81 100644 --- a/ui/app/components/identicon.js +++ b/ui/app/components/identicon.js @@ -26,17 +26,17 @@ function mapStateToProps (state) { IdenticonComponent.prototype.render = function () { var props = this.props - const { className = '', address, imageUrl } = props + const { className = '', address, image } = props var diameter = props.diameter || this.defaultDiameter const style = { height: diameter, width: diameter, borderRadius: diameter / 2, } - if (imageUrl) { + if (image) { return h('img', { className: `${className} identicon`, - src: imageUrl, + src: image, style: { ...style, }, -- cgit v1.2.3