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

Add placeholder etherscan token icons

This commit is contained in:
Dan Finlay 2017-04-24 13:55:19 -07:00
parent 40e2450022
commit bce4af2dca
3 changed files with 35 additions and 3 deletions

View File

@ -12,7 +12,7 @@ function TokenCell () {
TokenCell.prototype.render = function () { TokenCell.prototype.render = function () {
const props = this.props const props = this.props
const { address, symbol, string } = props const { address, symbol, string, network } = props
log.info({ address, symbol, string }) log.info({ address, symbol, string })
return ( return (
@ -21,9 +21,11 @@ TokenCell.prototype.render = function () {
h(Identicon, { h(Identicon, {
diameter: 50, diameter: 50,
address, address,
network,
}), }),
h('h3', `${string || 0} ${symbol}`), h('h3', `${string || 0} ${symbol}`),
]) ])
) )
} }

View File

@ -23,9 +23,10 @@ function TokenList () {
TokenList.prototype.render = function () { TokenList.prototype.render = function () {
const tokens = this.state.tokens const tokens = this.state.tokens
const network = this.props.network
const tokenViews = tokens.map((tokenData) => { const tokenViews = tokens.map((tokenData) => {
console.log('rendering token with', tokenData) tokenData.network = network
return h(TokenCell, tokenData) return h(TokenCell, tokenData)
}) })
@ -43,6 +44,11 @@ TokenList.prototype.render = function () {
margin-left: 12px; margin-left: 12px;
} }
li.token-cell:hover {
background: white;
cursor: pointer;
}
`)].concat(tokenViews)) `)].concat(tokenViews))
) )
} }

View File

@ -10,9 +10,33 @@ module.exports = function (jazzicon) {
function IconFactory (jazzicon) { function IconFactory (jazzicon) {
this.jazzicon = jazzicon this.jazzicon = jazzicon
this.cache = {} this.cache = {}
this.presets = {
'1':{ // Main network:
'0x48c80f1f4d53d5951e5d5438b54cba84f29f32a5': 'https://etherscan.io/token/images/augur.png',
'0xc66ea802717bfb9833400264dd12c2bceaa34a6d': 'https://etherscan.io/token/images/mkr-etherscan-35.png',
'0xa74476443119a942de498590fe1f2454d7d4ac0d': 'https://etherscan.io/token/images/golem.png',
'0xaec2e87e0a235266d9c5adc9deb4b2e29b54d009': 'https://etherscan.io/token/images/sngls.png',
}
}
} }
IconFactory.prototype.iconForAddress = function (address, diameter, imageify) { IconFactory.prototype.iconForAddress = function (address, diameter, imageify, network) {
try {
const presetUri = this.presets[network][address.toLowerCase()]
if (presetUri) {
var img = document.createElement('img')
img.src = presetUri
img.style.width = `${diameter}px`
img.style.height = `${diameter}px`
img.style.borderRadius = `${diameter/2}px`
return img
}
} catch (e) {}
if (imageify) { if (imageify) {
return this.generateIdenticonImg(address, diameter) return this.generateIdenticonImg(address, diameter)
} else { } else {