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

Reduce token list clutter by only showing held tokens

We could change this when we allow hiding/removing tokens, but for now, this is a simple and pleasant solution.
This commit is contained in:
Dan Finlay 2017-06-20 08:58:25 -07:00
parent 41d992cca9
commit 027394b205

View File

@ -20,7 +20,7 @@ module.exports = TokenList
inherits(TokenList, Component) inherits(TokenList, Component)
function TokenList () { function TokenList () {
this.state = { this.state = {
tokens: null, tokens: [],
isLoading: true, isLoading: true,
network: null, network: null,
} }
@ -150,12 +150,9 @@ TokenList.prototype.componentWillUpdate = function (nextProps) {
} }
} }
TokenList.prototype.updateBalances = function (tokenData) { TokenList.prototype.updateBalances = function (tokens) {
const desired = this.props.tokens.map(token => token.address) const heldTokens = tokens.filter(token => {
const heldTokens = tokenData.filter(token => { return token.balance !== '0' && token.string !== '0.000'
const held = token.balance !== '0' && token.string !== '0.000'
const preferred = desired.includes(normalizeAddress(token.address))
return held || preferred
}) })
this.setState({ tokens: heldTokens, isLoading: false }) this.setState({ tokens: heldTokens, isLoading: false })
} }