diff options
author | Kevin Serrano <kevgagser@gmail.com> | 2016-07-23 02:15:47 +0800 |
---|---|---|
committer | Kevin Serrano <kevgagser@gmail.com> | 2016-07-23 02:15:47 +0800 |
commit | 86832e6feb502a3f1de24b81b111addf1f06bea6 (patch) | |
tree | 8f3ac5ce8c1772916d93cf79e7fd7336e3b6a7bc /ui/app | |
parent | 22528002e1edef84ade67d5bc30b2580e6542c05 (diff) | |
parent | 0bbfedc2bf21d8c3eec17fef35e93a98a946469e (diff) | |
download | tangerine-wallet-browser-86832e6feb502a3f1de24b81b111addf1f06bea6.tar tangerine-wallet-browser-86832e6feb502a3f1de24b81b111addf1f06bea6.tar.gz tangerine-wallet-browser-86832e6feb502a3f1de24b81b111addf1f06bea6.tar.bz2 tangerine-wallet-browser-86832e6feb502a3f1de24b81b111addf1f06bea6.tar.lz tangerine-wallet-browser-86832e6feb502a3f1de24b81b111addf1f06bea6.tar.xz tangerine-wallet-browser-86832e6feb502a3f1de24b81b111addf1f06bea6.tar.zst tangerine-wallet-browser-86832e6feb502a3f1de24b81b111addf1f06bea6.zip |
Fix merge conflicts. Fix typos. Ensure currency immediately updated on load.
Diffstat (limited to 'ui/app')
-rw-r--r-- | ui/app/account-detail.js | 14 | ||||
-rw-r--r-- | ui/app/actions.js | 35 | ||||
-rw-r--r-- | ui/app/app.js | 4 | ||||
-rw-r--r-- | ui/app/css/index.css | 6 | ||||
-rw-r--r-- | ui/app/eth-store-warning.js | 89 | ||||
-rw-r--r-- | ui/app/reducers/app.js | 18 | ||||
-rw-r--r-- | ui/app/reducers/metamask.js | 5 |
7 files changed, 169 insertions, 2 deletions
diff --git a/ui/app/account-detail.js b/ui/app/account-detail.js index 6d50dbd71..b1b0495eb 100644 --- a/ui/app/account-detail.js +++ b/ui/app/account-detail.js @@ -28,6 +28,7 @@ function mapStateToProps (state) { network: state.metamask.network, unconfTxs: valuesFor(state.metamask.unconfTxs), unconfMsgs: valuesFor(state.metamask.unconfMsgs), + isEthWarningConfirmed: state.metamask.isEthConfirmed, } } @@ -171,6 +172,16 @@ AccountDetailScreen.prototype.render = function () { }), h('button', { + onClick: () => props.dispatch(actions.buyEth(selected)), + style: { + marginBottom: '20px', + marginRight: '8px', + position: 'absolute', + left: '219px', + }, + }, 'BUY'), + + h('button', { onClick: () => props.dispatch(actions.showSendPage()), style: { marginBottom: '20px', @@ -181,7 +192,7 @@ AccountDetailScreen.prototype.render = function () { ]), ]), - // subview (tx history, pk export confirm) + // subview (tx history, pk export confirm, buy eth warning) h(ReactCSSTransitionGroup, { className: 'css-transition-group', transitionName: 'main', @@ -239,3 +250,4 @@ AccountDetailScreen.prototype.transactionList = function () { AccountDetailScreen.prototype.requestAccountExport = function () { this.props.dispatch(actions.requestExportAccount()) } + diff --git a/ui/app/actions.js b/ui/app/actions.js index 8bf4d1c30..a5846f0d2 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -68,6 +68,10 @@ var actions = { showPrivateKey: showPrivateKey, SAVE_ACCOUNT_LABEL: 'SAVE_ACCOUNT_LABEL', saveAccountLabel: saveAccountLabel, + AGREE_TO_ETH_WARNING: 'AGREE_TO_ETH_WARNING', + agreeToEthWarning: agreeToEthWarning, + SHOW_ETH_WARNING: 'SHOW_ETH_WARNING', + showEthWarning: showEthWarning, // tx conf screen COMPLETED_TX: 'COMPLETED_TX', TRANSACTION_ERROR: 'TRANSACTION_ERROR', @@ -108,6 +112,9 @@ var actions = { HIDE_LOADING: 'HIDE_LOADING_INDICATION', showLoadingIndication: showLoadingIndication, hideLoadingIndication: hideLoadingIndication, + // buy Eth with coinbase + BUY_ETH: 'BUY_ETH', + buyEth: buyEth, } module.exports = actions @@ -578,3 +585,31 @@ function showSendPage () { type: actions.SHOW_SEND_PAGE, } } + +function agreeToEthWarning () { + return (dispatch) => { + _accountManager.agreeToEthWarning((err) => { + if (err) { + return dispatch(actions.showEthWarning(err.message)) + } + dispatch({ + type: actions.AGREE_TO_ETH_WARNING, + }) + }) + } +} + +function showEthWarning () { + return { + type: actions.SHOW_ETH_WARNING, + } +} + +function buyEth (address, amount) { + return (dispatch) => { + _accountManager.buyEth(address, amount) + dispatch({ + type: actions.BUY_ETH, + }) + } +} diff --git a/ui/app/app.js b/ui/app/app.js index 536b871b3..a11d679f1 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -27,6 +27,7 @@ const MenuDroppo = require('menu-droppo') const DropMenuItem = require('./components/drop-menu-item') const NetworkIndicator = require('./components/network') const Tooltip = require('./components/tooltip') +const EthStoreWarning = require('./eth-store-warning') module.exports = connect(mapStateToProps)(App) @@ -37,6 +38,7 @@ function mapStateToProps (state) { return { // state from plugin isConfirmed: state.metamask.isConfirmed, + isEthConfirmed: state.metamask.isEthConfirmed, isInitialized: state.metamask.isInitialized, isUnlocked: state.metamask.isUnlocked, currentView: state.appState.currentView, @@ -324,6 +326,8 @@ App.prototype.renderPrimary = function () { // show current view switch (props.currentView.name) { + case 'EthStoreWarning': + return h(EthStoreWarning, {key: 'ethWarning'}) case 'accounts': return h(AccountsScreen, {key: 'accounts'}) diff --git a/ui/app/css/index.css b/ui/app/css/index.css index 3f52b6ed4..36430b5eb 100644 --- a/ui/app/css/index.css +++ b/ui/app/css/index.css @@ -463,3 +463,9 @@ input.large-input { display: inline-block; padding-left: 5px; } + +/* buy eth warning screen */ + +.eth-warning{ + transition: opacity 400ms ease-in, transform 400ms ease-in; +} diff --git a/ui/app/eth-store-warning.js b/ui/app/eth-store-warning.js new file mode 100644 index 000000000..4cc5da81c --- /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, event), + }), + h('.warning', { + style: { + fontSize: '11px', + }, + + }, 'Dont 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 (event) { + this.props.dispatch(actions.agreeToEthWarning()) +} + +EthStoreWarning.prototype.toAccounts = function () { + this.props.dispatch(actions.showAccountDetail(this.props.account)) +} 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 46397edd4..eba59ab45 100644 --- a/ui/app/reducers/metamask.js +++ b/ui/app/reducers/metamask.js @@ -31,6 +31,11 @@ function reduceMetamask (state, action) { isConfirmed: true, }) + case actions.AGREE_TO_ETH_WARNING: + return extend(metamaskState, { + isEthConfirmed: true, + }) + case actions.UNLOCK_METAMASK: return extend(metamaskState, { isUnlocked: true, |