aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components
diff options
context:
space:
mode:
authorThomas Huang <tmashuang@users.noreply.github.com>2017-06-29 01:09:58 +0800
committerGitHub <noreply@github.com>2017-06-29 01:09:58 +0800
commitbd523102fe2286456f5916c4c8b0fe46f3f48c73 (patch)
treee902bc4abbe6146b575885bcc6d443c36ab67a27 /ui/app/components
parentffd3773ef3c400c89c362580e7ae3969d00ae20c (diff)
parent40223687aeb8a5a593ab5af572e617f230f89140 (diff)
downloadtangerine-wallet-browser-bd523102fe2286456f5916c4c8b0fe46f3f48c73.tar
tangerine-wallet-browser-bd523102fe2286456f5916c4c8b0fe46f3f48c73.tar.gz
tangerine-wallet-browser-bd523102fe2286456f5916c4c8b0fe46f3f48c73.tar.bz2
tangerine-wallet-browser-bd523102fe2286456f5916c4c8b0fe46f3f48c73.tar.lz
tangerine-wallet-browser-bd523102fe2286456f5916c4c8b0fe46f3f48c73.tar.xz
tangerine-wallet-browser-bd523102fe2286456f5916c4c8b0fe46f3f48c73.tar.zst
tangerine-wallet-browser-bd523102fe2286456f5916c4c8b0fe46f3f48c73.zip
Merge pull request #1634 from MetaMask/i784-SendTokenButton
Add send token button (link to TokenFactory)
Diffstat (limited to 'ui/app/components')
-rw-r--r--ui/app/components/token-cell.js36
1 files changed, 29 insertions, 7 deletions
diff --git a/ui/app/components/token-cell.js b/ui/app/components/token-cell.js
index 4d2cacb01..48f46934a 100644
--- a/ui/app/components/token-cell.js
+++ b/ui/app/components/token-cell.js
@@ -18,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, {
@@ -33,16 +28,43 @@ 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) {
+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}`
+}
+