aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorFrankie <frankie.pangilinan@consensys.net>2016-08-11 04:48:34 +0800
committerFrankie <frankie.pangilinan@consensys.net>2016-08-11 04:48:34 +0800
commitba1edc429b948962fe0f03ef43588f7945cea3f2 (patch)
treeeda1b54a424c2fc06ef151763b5cb57d2e838116 /ui
parent9c6dd9ef4953f6e421feb6e6684ef43da26f6b75 (diff)
parentc48b60d7a6f14d2d2348be8d9a63965ca1267433 (diff)
downloadtangerine-wallet-browser-ba1edc429b948962fe0f03ef43588f7945cea3f2.tar.gz
tangerine-wallet-browser-ba1edc429b948962fe0f03ef43588f7945cea3f2.tar.zst
tangerine-wallet-browser-ba1edc429b948962fe0f03ef43588f7945cea3f2.zip
Merge branch 'master' into buyForm
Diffstat (limited to 'ui')
-rw-r--r--ui/app/account-detail.js8
-rw-r--r--ui/app/accounts/index.js3
-rw-r--r--ui/app/actions.js2
-rw-r--r--ui/app/app.js1
-rw-r--r--ui/app/components/drop-menu-item.js15
-rw-r--r--ui/app/components/network.js26
-rw-r--r--ui/app/components/pending-tx-details.js3
-rw-r--r--ui/app/components/transaction-list-item.js3
-rw-r--r--ui/app/css/lib.css5
-rw-r--r--ui/app/eth-store-warning.js89
-rw-r--r--ui/app/first-time/create-vault.js2
-rw-r--r--ui/app/info.js7
-rw-r--r--ui/app/reducers/app.js18
-rw-r--r--ui/app/reducers/metamask.js6
-rw-r--r--ui/app/send.js2
-rw-r--r--ui/app/settings.js1
-rw-r--r--ui/app/util.js7
17 files changed, 177 insertions, 21 deletions
diff --git a/ui/app/account-detail.js b/ui/app/account-detail.js
index cf65cbb7d..814d8bab0 100644
--- a/ui/app/account-detail.js
+++ b/ui/app/account-detail.js
@@ -172,19 +172,27 @@ AccountDetailScreen.prototype.render = function () {
}),
h('button', {
+<<<<<<< HEAD
onClick: this.buyButtonDeligator.bind(this),
+=======
+ onClick: () => props.dispatch(actions.buyEth(selected)),
+>>>>>>> master
style: {
marginBottom: '20px',
marginRight: '8px',
position: 'absolute',
left: '219px',
},
+<<<<<<< HEAD
}, props.accountDetail.subview === 'buyForm' ? [h('i.fa.fa-arrow-left', {
style: {
width: '22.641px',
height: '14px',
},
})] : 'BUY'),
+=======
+ }, 'BUY'),
+>>>>>>> master
h('button', {
onClick: () => props.dispatch(actions.showSendPage()),
diff --git a/ui/app/accounts/index.js b/ui/app/accounts/index.js
index f7ae5c53e..6e12accc7 100644
--- a/ui/app/accounts/index.js
+++ b/ui/app/accounts/index.js
@@ -37,7 +37,6 @@ AccountsScreen.prototype.render = function () {
var actions = {
onSelect: this.onSelect.bind(this),
onShowDetail: this.onShowDetail.bind(this),
- revealAccount: this.onRevealAccount.bind(this),
goHome: this.goHome.bind(this),
}
return (
@@ -88,7 +87,7 @@ AccountsScreen.prototype.render = function () {
h('div.footer.hover-white.pointer', {
key: 'reveal-account-bar',
onClick: () => {
- actions.revealAccount()
+ this.onRevealAccount()
},
style: {
display: 'flex',
diff --git a/ui/app/actions.js b/ui/app/actions.js
index 754ffced8..bdf100040 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -131,7 +131,6 @@ var actions = {
showSubLoadingIndication: showSubLoadingIndication,
HIDE_SUB_LOADING_INDICATION: 'HIDE_SUB_LOADING_INDICATION',
hideSubLoadingIndication: hideSubLoadingIndication,
-
}
module.exports = actions
@@ -625,6 +624,7 @@ function buyEth (address, amount) {
})
}
}
+<<<<<<< HEAD
function buyEthSubview () {
return {
diff --git a/ui/app/app.js b/ui/app/app.js
index b8deedc13..cc616fb7c 100644
--- a/ui/app/app.js
+++ b/ui/app/app.js
@@ -267,6 +267,7 @@ App.prototype.renderDropdown = function () {
style: {
position: 'absolute',
right: 0,
+ top: '36px',
},
innerStyle: {
background: 'white',
diff --git a/ui/app/components/drop-menu-item.js b/ui/app/components/drop-menu-item.js
index f5800f799..1a0d6cbd5 100644
--- a/ui/app/components/drop-menu-item.js
+++ b/ui/app/components/drop-menu-item.js
@@ -32,20 +32,25 @@ DropMenuItem.prototype.render = function () {
}
DropMenuItem.prototype.activeNetworkRender = function () {
- var activeNetwork = this.props.activeNetworkRender
+ let activeNetwork = this.props.activeNetworkRender
+ let { provider } = this.props
+ let providerType = provider ? provider.type : null
if (activeNetwork === undefined) return
switch (this.props.label) {
case 'Main Ethereum Network':
- if (activeNetwork === '1') return h('.check', ' ✓')
+ if (providerType === 'mainnet') return h('.check', '✓')
+ break
+ case 'Ethereum Classic Network':
+ if (providerType === 'classic') return h('.check', '✓')
break
case 'Morden Test Network':
- if (activeNetwork === '2') return h('.check', ' ✓')
+ if (activeNetwork === '2') return h('.check', '✓')
break
case 'Localhost 8545':
- if (activeNetwork === 'http://localhost:8545') return h('.check', ' ✓')
+ if (activeNetwork === 'http://localhost:8545') return h('.check', '✓')
break
default:
- if (activeNetwork === 'custom') return h('.check', ' ✓')
+ if (activeNetwork === 'custom') return h('.check', '✓')
}
}
diff --git a/ui/app/components/network.js b/ui/app/components/network.js
index 032e71699..95901fe70 100644
--- a/ui/app/components/network.js
+++ b/ui/app/components/network.js
@@ -11,11 +11,18 @@ function Network () {
}
Network.prototype.render = function () {
- const state = this.props
- const networkNumber = state.network
+ const props = this.props
+ const networkNumber = props.network
+ let providerName
+ try {
+ providerName = props.provider.type
+ } catch (e) {
+ providerName = null
+ }
let iconName, hoverText
if (networkNumber === 'loading') {
+
return h('img', {
title: 'Attempting to connect to blockchain.',
onClick: (event) => this.props.onClick(event),
@@ -25,9 +32,13 @@ Network.prototype.render = function () {
},
src: 'images/loading.svg',
})
- } else if (parseInt(networkNumber) === 1) {
+
+ } else if (providerName === 'mainnet') {
hoverText = 'Main Ethereum Network'
iconName = 'ethereum-network'
+ } else if (providerName === 'classic') {
+ hoverText = 'Ethereum Classic Network'
+ iconName = 'classic-network'
} else if (parseInt(networkNumber) === 2) {
hoverText = 'Morden Test Network'
iconName = 'morden-test-network'
@@ -55,6 +66,15 @@ Network.prototype.render = function () {
}},
'Etherum Main Net'),
])
+ case 'classic-network':
+ return h('.network-indicator', [
+ h('.menu-icon.hollow-diamond'),
+ h('.network-name', {
+ style: {
+ color: '#039396',
+ }},
+ 'Etherum Classic'),
+ ])
case 'morden-test-network':
return h('.network-indicator', [
h('.menu-icon.red-dot'),
diff --git a/ui/app/components/pending-tx-details.js b/ui/app/components/pending-tx-details.js
index a6f72a89b..2fb0eae3f 100644
--- a/ui/app/components/pending-tx-details.js
+++ b/ui/app/components/pending-tx-details.js
@@ -28,7 +28,8 @@ PTXP.render = function () {
var txParams = txData.txParams || {}
var address = txParams.from || props.selectedAddress
var identity = props.identities[address] || { address: address }
- var balance = props.accounts[address].balance
+ var account = props.accounts[address]
+ var balance = account ? account.balance : '0x0'
var gasCost = new BN(ethUtil.stripHexPrefix(txParams.gas || txData.estimatedGas), 16)
var gasPrice = new BN(ethUtil.stripHexPrefix(txParams.gasPrice || '0x4a817c800'), 16)
diff --git a/ui/app/components/transaction-list-item.js b/ui/app/components/transaction-list-item.js
index 78867fca4..796ba61ae 100644
--- a/ui/app/components/transaction-list-item.js
+++ b/ui/app/components/transaction-list-item.js
@@ -7,6 +7,7 @@ const addressSummary = require('../util').addressSummary
const explorerLink = require('../../lib/explorer-link')
const CopyButton = require('./copyButton')
const vreme = new (require('vreme'))
+const extension = require('../../../app/scripts/lib/extension')
const TransactionIcon = require('./transaction-list-item-icon')
@@ -49,7 +50,7 @@ TransactionListItem.prototype.render = function () {
if (!transaction.hash || !isLinkable) return
var url = explorerLink(transaction.hash, parseInt(network))
- chrome.tabs.create({ url })
+ extension.tabs.create({ url })
},
style: {
padding: '20px 0',
diff --git a/ui/app/css/lib.css b/ui/app/css/lib.css
index 22b26d4f1..bcd6a4a67 100644
--- a/ui/app/css/lib.css
+++ b/ui/app/css/lib.css
@@ -178,6 +178,11 @@ hr.horizontal-line {
background: #038789;
}
+.hollow-diamond {
+ transform: rotate(45deg);
+ border: 1px solid #038789;
+}
+
.pending-dot {
background: red;
left: 14px;
diff --git a/ui/app/eth-store-warning.js b/ui/app/eth-store-warning.js
new file mode 100644
index 000000000..7fe54a309
--- /dev/null
+++ b/ui/app/eth-store-warning.js
@@ -0,0 +1,89 @@
+const connect = require('react-redux').connect
+const Component = require('react').Component
+const h = require('react-hyperscript')
+const inherits = require('util').inherits
+const actions = require('./actions')
+
+module.exports = connect(mapStateToProps)(EthStoreWarning)
+
+inherits(EthStoreWarning, Component)
+function EthStoreWarning () {
+ Component.call(this)
+}
+
+function mapStateToProps (state) {
+ return {
+ selectedAccount: state.metamask.selectedAccount,
+ }
+}
+
+EthStoreWarning.prototype.render = function () {
+
+ return (
+
+ h('.flex-column', {
+ key: 'ethWarning',
+ style: {
+ paddingTop: '25px',
+ marginRight: '30px',
+ marginLeft: '30px',
+ alignItems: 'center',
+ },
+ }, [
+ h('.warning', {
+ style: {
+ margin: '10px 10px 10px 10px',
+ },
+ },
+ `MetaMask is currently in beta -
+ exercise caution while handling
+ and storing your ether.
+ `),
+
+ h('i.fa.fa-exclamation-triangle.fa-4', {
+ style: {
+ fontSize: '152px',
+ color: '#AEAEAE',
+ textAlign: 'center',
+ },
+ }),
+
+ h('.flex-row', {
+ style: {
+ marginTop: '25px',
+ marginBottom: '10px',
+ },
+ }, [
+ h('input', {
+ type: 'checkbox',
+ onChange: this.toggleShowWarning.bind(this),
+ }),
+ h('.warning', {
+ style: {
+ fontSize: '11px',
+ },
+
+ }, 'Don\'t show me this message again'),
+ ]),
+ h('.flex-row', {
+ style: {
+ width: '100%',
+ justifyContent: 'space-around',
+ },
+ }, [
+ h('button', {
+ onClick: this.toAccounts.bind(this),
+ },
+ 'Continue to MetaMask'),
+ ]),
+ ])
+ )
+}
+
+EthStoreWarning.prototype.toggleShowWarning = function () {
+ this.props.dispatch(actions.agreeToEthWarning())
+}
+
+EthStoreWarning.prototype.toAccounts = function () {
+ this.props.dispatch(actions.showAccountDetail(this.props.account))
+}
diff --git a/ui/app/first-time/create-vault.js b/ui/app/first-time/create-vault.js
index 3dfbf0dbd..33ae62179 100644
--- a/ui/app/first-time/create-vault.js
+++ b/ui/app/first-time/create-vault.js
@@ -120,7 +120,7 @@ CreateVaultScreen.prototype.createNewVault = function () {
return
}
if (password !== passwordConfirm) {
- this.warning = 'passwords dont match'
+ this.warning = 'passwords don\'t match'
this.props.dispatch(actions.displayWarning(this.warning))
return
}
diff --git a/ui/app/info.js b/ui/app/info.js
index d97998fd7..4e540bd03 100644
--- a/ui/app/info.js
+++ b/ui/app/info.js
@@ -3,6 +3,7 @@ const Component = require('react').Component
const h = require('react-hyperscript')
const connect = require('react-redux').connect
const actions = require('./actions')
+const extension = require('../../app/scripts/lib/extension')
module.exports = connect(mapStateToProps)(InfoScreen)
@@ -19,7 +20,7 @@ InfoScreen.prototype.render = function () {
var state = this.props
var manifest
try {
- manifest = chrome.runtime.getManifest()
+ manifest = extension.runtime.getManifest()
} catch (e) {
manifest = { version: '2.0.0' }
}
@@ -105,7 +106,7 @@ InfoScreen.prototype.render = function () {
h('a.info', {
target: '_blank',
style: { width: '85vw' },
- onClick () { chrome.tabs.create({url: 'mailto:help@metamask.io?subject=Feedback'}) },
+ onClick () { extension.tabs.create({url: 'mailto:help@metamask.io?subject=Feedback'}) },
}, 'Email us any questions or comments!'),
]),
@@ -124,5 +125,5 @@ InfoScreen.prototype.render = function () {
}
InfoScreen.prototype.navigateTo = function (url) {
- chrome.tabs.create({ url })
+ extension.tabs.create({ url })
}
diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js
index 06afd0ae1..a9d6e4ff0 100644
--- a/ui/app/reducers/app.js
+++ b/ui/app/reducers/app.js
@@ -28,10 +28,13 @@ function reduceApp (state, action) {
name: 'createVaultComplete',
seedWords,
}
+ var ethStoreWarning = {
+ name: 'EthStoreWarning',
+ }
var appState = extend({
menuOpen: false,
- currentView: seedWords ? seedConfView : defaultView,
+ currentView: seedWords ? seedConfView : !state.metamask.isEthConfirmed ? ethStoreWarning : defaultView,
accountDetail: {
subview: 'transactions',
},
@@ -366,6 +369,17 @@ function reduceApp (state, action) {
},
})
+ case actions.SHOW_ETH_WARNING:
+ return extend(appState, {
+ transForward: true,
+ currentView: {
+ name: 'accountDetail',
+ context: appState.currentView.context,
+ },
+ accountDetail: {
+ subview: 'buy-eth-warning',
+ },
+ })
default:
return appState
}
@@ -390,3 +404,5 @@ function indexForPending (state, txId) {
})
return idx
}
+
+
diff --git a/ui/app/reducers/metamask.js b/ui/app/reducers/metamask.js
index f3ef8eb11..4eef20f56 100644
--- a/ui/app/reducers/metamask.js
+++ b/ui/app/reducers/metamask.js
@@ -10,6 +10,7 @@ function reduceMetamask (state, action) {
var metamaskState = extend({
isInitialized: false,
isUnlocked: false,
+ isEthConfirmed: false,
currentDomain: 'example.com',
rpcTarget: 'https://rawtestrpc.metamask.io/',
identities: {},
@@ -31,6 +32,11 @@ function reduceMetamask (state, action) {
isConfirmed: true,
})
+ case actions.AGREE_TO_ETH_WARNING:
+ return extend(metamaskState, {
+ isEthConfirmed: !metamaskState.isEthConfirmed,
+ })
+
case actions.UNLOCK_METAMASK:
return extend(metamaskState, {
isUnlocked: true,
diff --git a/ui/app/send.js b/ui/app/send.js
index 540d85382..06ea199f4 100644
--- a/ui/app/send.js
+++ b/ui/app/send.js
@@ -173,7 +173,7 @@ SendTransactionScreen.prototype.render = function () {
marginBottom: 16,
},
}, [
- 'Tranasactional Data (optional)',
+ 'Transactional Data (optional)',
]),
// 'data' field
diff --git a/ui/app/settings.js b/ui/app/settings.js
index e56f4ee63..454cc95e0 100644
--- a/ui/app/settings.js
+++ b/ui/app/settings.js
@@ -32,7 +32,6 @@ AppSettingsPage.prototype.render = function () {
htmlFor: 'settings-rpc-endpoint',
}, 'RPC Endpoint:'),
h('input', {
- // value: '//testrpc.metamask.io',
type: 'url',
id: 'settings-rpc-endpoint',
onKeyPress: this.onKeyPress.bind(this),
diff --git a/ui/app/util.js b/ui/app/util.js
index a08006077..04ebcecdb 100644
--- a/ui/app/util.js
+++ b/ui/app/util.js
@@ -123,7 +123,12 @@ function generateBalanceObject (formattedBalance, decimalsToKeep = 1) {
var shortBalance = shortenBalance(balance, decimalsToKeep)
if (beforeDecimal === '0' && afterDecimal.substr(0, 5) === '00000') {
- balance = '<1.0e-5'
+ // eslint-disable-next-line eqeqeq
+ if (afterDecimal == 0) {
+ balance = '0'
+ } else {
+ balance = '<1.0e-5'
+ }
} else if (beforeDecimal !== '0') {
balance = `${beforeDecimal}.${afterDecimal.slice(0, decimalsToKeep)}`
}