aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/token-cell.js
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2017-06-20 07:12:34 +0800
committerDan Finlay <dan@danfinlay.com>2017-06-20 10:02:13 +0800
commit60855b05106899149824feecbd0f5d54907b0451 (patch)
tree8d5a64ad0362a7141abcc81004ef07fd5070c9b2 /ui/app/components/token-cell.js
parent48789f2a3df2c820b61902fb49057f9f7b6cbd8c (diff)
downloadtangerine-wallet-browser-60855b05106899149824feecbd0f5d54907b0451.tar
tangerine-wallet-browser-60855b05106899149824feecbd0f5d54907b0451.tar.gz
tangerine-wallet-browser-60855b05106899149824feecbd0f5d54907b0451.tar.bz2
tangerine-wallet-browser-60855b05106899149824feecbd0f5d54907b0451.tar.lz
tangerine-wallet-browser-60855b05106899149824feecbd0f5d54907b0451.tar.xz
tangerine-wallet-browser-60855b05106899149824feecbd0f5d54907b0451.tar.zst
tangerine-wallet-browser-60855b05106899149824feecbd0f5d54907b0451.zip
Add send button to TokenFactory
A simple solution to a temporary token send screen: Linking to EtherScan. Will hold us over until we make our own token send view.
Diffstat (limited to 'ui/app/components/token-cell.js')
-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 d3a895d36..1b226983b 100644
--- a/ui/app/components/token-cell.js
+++ b/ui/app/components/token-cell.js
@@ -17,12 +17,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 +27,42 @@ 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) {
return `https://etherscan.io/token/${tokenAddress}?a=${address}`
}
+function tokenFactoryFor (tokenAddress) {
+ return `https://tokenfactory.surge.sh/#/token/${tokenAddress}`
+}
+