aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/token-cell.js
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2017-07-12 03:18:44 +0800
committerfrankiebee <frankie.diamond@gmail.com>2017-07-12 03:18:44 +0800
commita670e54973ed1bae20455507a4b3c44e231ba822 (patch)
tree00300ea3362b7b48be26d6547f89ed4c5bfac597 /ui/app/components/token-cell.js
parentc121ac21ec3bed0381e36de7ead1b583a3da148c (diff)
parentf5de16c91174fbbf208e5aef8f542d3bbbb3cb93 (diff)
downloadtangerine-wallet-browser-a670e54973ed1bae20455507a4b3c44e231ba822.tar
tangerine-wallet-browser-a670e54973ed1bae20455507a4b3c44e231ba822.tar.gz
tangerine-wallet-browser-a670e54973ed1bae20455507a4b3c44e231ba822.tar.bz2
tangerine-wallet-browser-a670e54973ed1bae20455507a4b3c44e231ba822.tar.lz
tangerine-wallet-browser-a670e54973ed1bae20455507a4b3c44e231ba822.tar.xz
tangerine-wallet-browser-a670e54973ed1bae20455507a4b3c44e231ba822.tar.zst
tangerine-wallet-browser-a670e54973ed1bae20455507a4b3c44e231ba822.zip
Merge branch 'nonce-tracker' of https://github.com/MetaMask/metamask-plugin into nonce-tracker
Diffstat (limited to 'ui/app/components/token-cell.js')
-rw-r--r--ui/app/components/token-cell.js42
1 files changed, 34 insertions, 8 deletions
diff --git a/ui/app/components/token-cell.js b/ui/app/components/token-cell.js
index d3a895d36..19d7139bb 100644
--- a/ui/app/components/token-cell.js
+++ b/ui/app/components/token-cell.js
@@ -2,6 +2,7 @@ const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
const Identicon = require('./identicon')
+const prefixForNetwork = require('../../lib/etherscan-prefix-for-network')
module.exports = TokenCell
@@ -17,12 +18,7 @@ TokenCell.prototype.render = function () {
return (
h('li.token-cell', {
style: { cursor: network === '1' ? 'pointer' : 'default' },
- onClick: (event) => {
- const url = urlFor(address, userAddress, network)
- if (url) {
- navigateTo(url)
- }
- },
+ onClick: this.view.bind(this, address, userAddress, network),
}, [
h(Identicon, {
@@ -32,15 +28,45 @@ TokenCell.prototype.render = function () {
}),
h('h3', `${string || 0} ${symbol}`),
+
+ h('span', { style: { flex: '1 0 auto' } }),
+
+ /*
+ h('button', {
+ onClick: this.send.bind(this, address),
+ }, 'SEND'),
+ */
+
])
)
}
+TokenCell.prototype.send = function (address, event) {
+ event.preventDefault()
+ event.stopPropagation()
+ const url = tokenFactoryFor(address)
+ if (url) {
+ navigateTo(url)
+ }
+}
+
+TokenCell.prototype.view = function (address, userAddress, network, event) {
+ const url = etherscanLinkFor(address, userAddress, network)
+ if (url) {
+ navigateTo(url)
+ }
+}
+
function navigateTo (url) {
global.platform.openWindow({ url })
}
-function urlFor (tokenAddress, address, network) {
- return `https://etherscan.io/token/${tokenAddress}?a=${address}`
+function etherscanLinkFor (tokenAddress, address, network) {
+ const prefix = prefixForNetwork(network)
+ return `https://${prefix}etherscan.io/token/${tokenAddress}?a=${address}`
+}
+
+function tokenFactoryFor (tokenAddress) {
+ return `https://tokenfactory.surge.sh/#/token/${tokenAddress}`
}