1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

show watch asset image from hide token modal

This commit is contained in:
Esteban MIno 2018-08-16 12:04:43 -03:00
parent 5289a36664
commit a36ea0e232
3 changed files with 15 additions and 13 deletions

View File

@ -15,7 +15,7 @@ class PreferencesController {
* @property {string} store.currentAccountTab Indicates the selected tab in the ui * @property {string} store.currentAccountTab Indicates the selected tab in the ui
* @property {array} store.tokens The tokens the user wants display in their token lists * @property {array} store.tokens The tokens the user wants display in their token lists
* @property {object} store.accountTokens The tokens stored per account and then per network type * @property {object} store.accountTokens The tokens stored per account and then per network type
* @property {object} store.objects Contains assets objects related to * @property {object} store.objects Contains assets objects related to assets added
* @property {boolean} store.useBlockie The users preference for blockie identicons within the UI * @property {boolean} store.useBlockie The users preference for blockie identicons within the UI
* @property {object} store.featureFlags A key-boolean map, where keys refer to features and booleans to whether the * @property {object} store.featureFlags A key-boolean map, where keys refer to features and booleans to whether the
* user wishes to see that feature * user wishes to see that feature

View File

@ -28,14 +28,17 @@ IdenticonComponent.prototype.render = function () {
var props = this.props var props = this.props
const { className = '', address, imageUrl } = props const { className = '', address, imageUrl } = props
var diameter = props.diameter || this.defaultDiameter 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) { if (imageUrl) {
return h('img.balance-icon', { return h('img', {
className: `${className} identicon`,
src: imageUrl, src: imageUrl,
style: { style: {
height: diameter, ...style,
width: diameter,
borderRadius: diameter / 2,
}, },
}) })
} else if (address) { } else if (address) {
@ -47,9 +50,7 @@ IdenticonComponent.prototype.render = function () {
flexShrink: 0, flexShrink: 0,
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
height: diameter, ...style,
width: diameter,
borderRadius: diameter / 2,
overflow: 'hidden', overflow: 'hidden',
}, },
}) })
@ -57,9 +58,7 @@ IdenticonComponent.prototype.render = function () {
return h('img.balance-icon', { return h('img.balance-icon', {
src: './images/eth_logo.svg', src: './images/eth_logo.svg',
style: { style: {
height: diameter, ...style,
width: diameter,
borderRadius: diameter / 2,
}, },
}) })
} }

View File

@ -10,6 +10,7 @@ function mapStateToProps (state) {
return { return {
network: state.metamask.network, network: state.metamask.network,
token: state.appState.modal.modalState.props.token, token: state.appState.modal.modalState.props.token,
tokenImagesHashes: state.metamask.objects,
} }
} }
@ -40,8 +41,9 @@ module.exports = connect(mapStateToProps, mapDispatchToProps)(HideTokenConfirmat
HideTokenConfirmationModal.prototype.render = function () { HideTokenConfirmationModal.prototype.render = function () {
const { token, network, hideToken, hideModal } = this.props const { token, network, hideToken, hideModal, tokenImagesHashes } = this.props
const { symbol, address } = token const { symbol, address } = token
const imageUrl = tokenImagesHashes[address]
return h('div.hide-token-confirmation', {}, [ return h('div.hide-token-confirmation', {}, [
h('div.hide-token-confirmation__container', { h('div.hide-token-confirmation__container', {
@ -55,6 +57,7 @@ HideTokenConfirmationModal.prototype.render = function () {
diameter: 45, diameter: 45,
address, address,
network, network,
imageUrl,
}), }),
h('div.hide-token-confirmation__symbol', {}, symbol), h('div.hide-token-confirmation__symbol', {}, symbol),