From 45fc1d6ec356232e51fe4a9cc1f01929e35e8014 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Wed, 9 Aug 2017 17:40:01 -0700 Subject: Readd loose label onto accounts. --- ui/app/app.js | 3 +++ ui/app/components/account-dropdowns.js | 20 +++++++++++++++++++- ui/app/components/dropdown.js | 2 +- ui/app/css/lib.css | 5 +++-- 4 files changed, 26 insertions(+), 4 deletions(-) (limited to 'ui/app') diff --git a/ui/app/app.js b/ui/app/app.js index 4565bdd37..2186c85a2 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -42,6 +42,7 @@ function mapStateToProps (state) { identities, accounts, address, + keyrings, } = state.metamask const selected = address || Object.keys(accounts)[0] @@ -69,6 +70,7 @@ function mapStateToProps (state) { // state needed to get account dropdown temporarily rendering from app bar identities, selected, + keyrings, } } @@ -187,6 +189,7 @@ App.prototype.renderAppBar = function () { identities: this.props.identities, selected: this.props.selected, network: this.props.network, + keyrings: this.props.keyrings, }, []), // hamburger diff --git a/ui/app/components/account-dropdowns.js b/ui/app/components/account-dropdowns.js index b23600e9b..9a68b8f20 100644 --- a/ui/app/components/account-dropdowns.js +++ b/ui/app/components/account-dropdowns.js @@ -22,12 +22,19 @@ class AccountDropdowns extends Component { } renderAccounts () { - const { identities, selected } = this.props + const { identities, selected, keyrings } = this.props return Object.keys(identities).map((key, index) => { const identity = identities[key] const isSelected = identity.address === selected + const simpleAddress = identity.address.substring(2).toLowerCase() + + const keyring = keyrings.find((kr) => { + return kr.accounts.includes(simpleAddress) || + kr.accounts.includes(identity.address) + }) + return h( DropdownMenuItem, { @@ -51,6 +58,7 @@ class AccountDropdowns extends Component { }, }, ), + this.indicateIfLoose(keyring.type), h('span', { style: { marginLeft: '20px', fontSize: '24px' } }, identity.name || ''), h('span', { style: { marginLeft: '20px', fontSize: '24px' } }, isSelected ? h('.check', '✓') : null), ] @@ -58,6 +66,13 @@ class AccountDropdowns extends Component { }) } + indicateIfLoose (type) { + try { // Sometimes keyrings aren't loaded yet: + const isLoose = type !== 'HD Key Tree' + return isLoose ? h('.keyring-label', 'LOOSE') : null + } catch (e) { return } + } + renderAccountSelector () { const { actions } = this.props const { accountSelectorActive } = this.state @@ -136,6 +151,8 @@ class AccountDropdowns extends Component { ) } + + renderAccountOptions () { const { actions } = this.props const { optionsMenuActive } = this.state @@ -269,6 +286,7 @@ AccountDropdowns.defaultProps = { AccountDropdowns.propTypes = { identities: PropTypes.objectOf(PropTypes.object), selected: PropTypes.string, + keyrings: PropTypes.objectOf(PropTypes.object), } const mapDispatchToProps = (dispatch) => { diff --git a/ui/app/components/dropdown.js b/ui/app/components/dropdown.js index 34c7149ee..73710acc2 100644 --- a/ui/app/components/dropdown.js +++ b/ui/app/components/dropdown.js @@ -32,7 +32,7 @@ class Dropdown extends Component { 'style', ` li.dropdown-menu-item:hover { color:rgb(225, 225, 225); } - li.dropdown-menu-item { color: rgb(185, 185, 185); } + li.dropdown-menu-item { color: rgb(185, 185, 185); position: relative } ` ), ...children, diff --git a/ui/app/css/lib.css b/ui/app/css/lib.css index 81647d1c1..f3acbee76 100644 --- a/ui/app/css/lib.css +++ b/ui/app/css/lib.css @@ -215,12 +215,13 @@ hr.horizontal-line { z-index: 1; font-size: 11px; background: rgba(255,0,0,0.8); - bottom: -47px; color: white; + bottom: 0px; + left: -8px; border-radius: 10px; height: 20px; min-width: 20px; - position: relative; + position: absolute; display: flex; align-items: center; justify-content: center; -- cgit From 399c51c04831381da0b9013018763b43618de614 Mon Sep 17 00:00:00 2001 From: DavidNinja Date: Mon, 14 Aug 2017 21:29:21 -0700 Subject: cancel all txs --- ui/app/actions.js | 8 ++++++++ ui/app/conf-tx.js | 12 ++++++++++++ 2 files changed, 20 insertions(+) (limited to 'ui/app') diff --git a/ui/app/actions.js b/ui/app/actions.js index eafd04b4c..d5ee3cc31 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -105,6 +105,8 @@ var actions = { txError: txError, nextTx: nextTx, previousTx: previousTx, + cancelAllTx: cancelAllTx, + CANCEL_ALL_TX: 'CANCEL_ALL_TX', viewPendingTx: viewPendingTx, VIEW_PENDING_TX: 'VIEW_PENDING_TX', // app messages @@ -470,6 +472,12 @@ function cancelTx (txData) { } } +function cancelAllTx (txsData) { + return (dispatch) => { + txsData.forEach((txData) => dispatch(actions.cancelTx(txData))) + dispatch(actions.goHome()) + } +} // // initialize screen // diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js index 34727ff78..d6ceb7ff5 100644 --- a/ui/app/conf-tx.js +++ b/ui/app/conf-tx.js @@ -89,6 +89,18 @@ ConfirmTxScreen.prototype.render = function () { }), ]), + h('h3', { + style: { + alignSelf: 'flex-end', + display: unconfTxList.length > 1 ? 'block' : 'none', + }, + }, [ + h('i.fa.fa-trash.fa-lg.cursor-pointer', { + title: 'Cancel All Pending Transactions', + onClick: () => props.dispatch(actions.cancelAllTx(unconfTxList)), + }), + ]), + warningIfExists(props.warning), currentTxView({ -- cgit From 39424cdf457e8348b50dde2588ad173aa4787fca Mon Sep 17 00:00:00 2001 From: davidp94 Date: Mon, 14 Aug 2017 21:35:57 -0700 Subject: remove unused action type --- ui/app/actions.js | 1 - 1 file changed, 1 deletion(-) (limited to 'ui/app') diff --git a/ui/app/actions.js b/ui/app/actions.js index d5ee3cc31..3b6b87b00 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -106,7 +106,6 @@ var actions = { nextTx: nextTx, previousTx: previousTx, cancelAllTx: cancelAllTx, - CANCEL_ALL_TX: 'CANCEL_ALL_TX', viewPendingTx: viewPendingTx, VIEW_PENDING_TX: 'VIEW_PENDING_TX', // app messages -- cgit From f52ef5d49657d126a2575c91c83481209e8ef0ab Mon Sep 17 00:00:00 2001 From: davidp94 Date: Mon, 14 Aug 2017 21:51:39 -0700 Subject: fix goHome --- ui/app/actions.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ui/app') diff --git a/ui/app/actions.js b/ui/app/actions.js index 3b6b87b00..a692267cb 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -473,8 +473,12 @@ function cancelTx (txData) { function cancelAllTx (txsData) { return (dispatch) => { - txsData.forEach((txData) => dispatch(actions.cancelTx(txData))) - dispatch(actions.goHome()) + txsData.forEach((txData, i) => { + background.cancelTransaction(txData.id, () => { + dispatch(actions.completedTx(txData.id)) + i === txsData.length - 1 ? dispatch(actions.goHome()) : null + }) + }) } } // -- cgit From 6168efc9cc16d6dc623cb981a6d7f28fedf54477 Mon Sep 17 00:00:00 2001 From: sdtsui Date: Tue, 15 Aug 2017 17:13:11 +0200 Subject: Fix overflow issue on QubesOS, flagged by @kumavis --- ui/app/account-detail.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/app') diff --git a/ui/app/account-detail.js b/ui/app/account-detail.js index f6041e856..02089ecd0 100644 --- a/ui/app/account-detail.js +++ b/ui/app/account-detail.js @@ -117,7 +117,7 @@ AccountDetailScreen.prototype.render = function () { h('h2', { style: { maxWidth: '180px', - overflowX: 'hidden', + overflow: 'hidden', textOverflow: 'ellipsis', padding: '5px 0px', }, -- cgit From 176dd6d214489e447460d20b4223596d84048f8d Mon Sep 17 00:00:00 2001 From: frankiebee Date: Tue, 15 Aug 2017 12:12:57 -0700 Subject: Disable token list --- ui/app/account-detail.js | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) (limited to 'ui/app') diff --git a/ui/app/account-detail.js b/ui/app/account-detail.js index f6041e856..9921d3067 100644 --- a/ui/app/account-detail.js +++ b/ui/app/account-detail.js @@ -12,7 +12,7 @@ const ExportAccountView = require('./components/account-export') const ethUtil = require('ethereumjs-util') const EditableLabel = require('./components/editable-label') const TabBar = require('./components/tab-bar') -const TokenList = require('./components/token-list') +// const TokenList = require('./components/token-list') const AccountDropdowns = require('./components/account-dropdowns').AccountDropdowns module.exports = connect(mapStateToProps)(AccountDetailScreen) @@ -255,17 +255,34 @@ AccountDetailScreen.prototype.tabSections = function () { AccountDetailScreen.prototype.tabSwitchView = function () { const props = this.props - const { address, network } = props - const { currentAccountTab, tokens } = this.props + const { address/*, network */} = props + const { currentAccountTab/*, tokens*/ } = this.props switch (currentAccountTab) { case 'tokens': - return h(TokenList, { - userAddress: address, - network, - tokens, - addToken: () => this.props.dispatch(actions.showAddTokenPage()), - }) + // return h(TokenList, { + // userAddress: address, + // network, + // tokens, + // addToken: () => this.props.dispatch(actions.showAddTokenPage()), + // }) + return h('.hotFix', { + style: { + padding: '80px', + }, + }, [` + Token List is temporally + you can check your token balnce + `, h('span.hotFix', { + style: { + color: 'rgba(247, 134, 28, 1)', + }, + onClick: () => { + global.platform.openWindow({ + url: `https://ethplorer.io/address/${address}`, + }) + }, + }, 'here')]) default: return this.transactionList() } -- cgit From a8d6e1fe98416db4d7c9e8615f79a8c77dbb62fc Mon Sep 17 00:00:00 2001 From: frankiebee Date: Tue, 15 Aug 2017 12:16:41 -0700 Subject: fix spelling --- ui/app/account-detail.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'ui/app') diff --git a/ui/app/account-detail.js b/ui/app/account-detail.js index 9921d3067..95e2c1cf9 100644 --- a/ui/app/account-detail.js +++ b/ui/app/account-detail.js @@ -270,10 +270,9 @@ AccountDetailScreen.prototype.tabSwitchView = function () { style: { padding: '80px', }, - }, [` - Token List is temporally - you can check your token balnce - `, h('span.hotFix', { + }, [ + 'Token lists are temporarily down. You can check you your token balances ', + h('span.hotFix', { style: { color: 'rgba(247, 134, 28, 1)', }, -- cgit From 9c7abacf64c3c83790330c04baf456a1f642ed36 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 15 Aug 2017 12:26:11 -0700 Subject: Change cursor type to indicate link. --- ui/app/account-detail.js | 1 + 1 file changed, 1 insertion(+) (limited to 'ui/app') diff --git a/ui/app/account-detail.js b/ui/app/account-detail.js index 95e2c1cf9..4046b5875 100644 --- a/ui/app/account-detail.js +++ b/ui/app/account-detail.js @@ -275,6 +275,7 @@ AccountDetailScreen.prototype.tabSwitchView = function () { h('span.hotFix', { style: { color: 'rgba(247, 134, 28, 1)', + cursor: 'pointer', }, onClick: () => { global.platform.openWindow({ -- cgit From b69f5533d902a1aba121b7d3752475c11084885b Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Wed, 16 Aug 2017 09:49:18 -0700 Subject: ReEnable Token List --- ui/app/account-detail.js | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) (limited to 'ui/app') diff --git a/ui/app/account-detail.js b/ui/app/account-detail.js index 7af53a694..02089ecd0 100644 --- a/ui/app/account-detail.js +++ b/ui/app/account-detail.js @@ -12,7 +12,7 @@ const ExportAccountView = require('./components/account-export') const ethUtil = require('ethereumjs-util') const EditableLabel = require('./components/editable-label') const TabBar = require('./components/tab-bar') -// const TokenList = require('./components/token-list') +const TokenList = require('./components/token-list') const AccountDropdowns = require('./components/account-dropdowns').AccountDropdowns module.exports = connect(mapStateToProps)(AccountDetailScreen) @@ -255,34 +255,17 @@ AccountDetailScreen.prototype.tabSections = function () { AccountDetailScreen.prototype.tabSwitchView = function () { const props = this.props - const { address/*, network */} = props - const { currentAccountTab/*, tokens*/ } = this.props + const { address, network } = props + const { currentAccountTab, tokens } = this.props switch (currentAccountTab) { case 'tokens': - // return h(TokenList, { - // userAddress: address, - // network, - // tokens, - // addToken: () => this.props.dispatch(actions.showAddTokenPage()), - // }) - return h('.hotFix', { - style: { - padding: '80px', - }, - }, [ - 'Token lists are temporarily down. You can check you your token balances ', - h('span.hotFix', { - style: { - color: 'rgba(247, 134, 28, 1)', - cursor: 'pointer', - }, - onClick: () => { - global.platform.openWindow({ - url: `https://ethplorer.io/address/${address}`, - }) - }, - }, 'here')]) + return h(TokenList, { + userAddress: address, + network, + tokens, + addToken: () => this.props.dispatch(actions.showAddTokenPage()), + }) default: return this.transactionList() } -- cgit From 722d91c8661a2c0912b7eaf9bcf20f220b76e384 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Wed, 16 Aug 2017 09:49:23 -0700 Subject: Remove default tokens --- ui/app/components/token-list.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'ui/app') diff --git a/ui/app/components/token-list.js b/ui/app/components/token-list.js index 5ea31ae8d..1ea15521a 100644 --- a/ui/app/components/token-list.js +++ b/ui/app/components/token-list.js @@ -5,16 +5,6 @@ const TokenTracker = require('eth-token-tracker') const TokenCell = require('./token-cell.js') const normalizeAddress = require('eth-sig-util').normalize -const defaultTokens = [] -const contracts = require('eth-contract-metadata') -for (const address in contracts) { - const contract = contracts[address] - if (contract.erc20) { - contract.address = address - defaultTokens.push(contract) - } -} - module.exports = TokenList inherits(TokenList, Component) @@ -153,7 +143,7 @@ TokenList.prototype.createFreshTokenTracker = function () { this.tracker = new TokenTracker({ userAddress, provider: global.ethereumProvider, - tokens: uniqueMergeTokens(defaultTokens, this.props.tokens), + tokens: this.props.tokens, pollingInterval: 8000, }) -- cgit From 3b6ee032f58de18c80f66833c54e4f9795ffbced Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Wed, 16 Aug 2017 09:50:16 -0700 Subject: Remove dead code --- ui/app/components/token-list.js | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'ui/app') diff --git a/ui/app/components/token-list.js b/ui/app/components/token-list.js index 1ea15521a..4bcde7d1d 100644 --- a/ui/app/components/token-list.js +++ b/ui/app/components/token-list.js @@ -3,7 +3,6 @@ const h = require('react-hyperscript') const inherits = require('util').inherits const TokenTracker = require('eth-token-tracker') const TokenCell = require('./token-cell.js') -const normalizeAddress = require('eth-sig-util').normalize module.exports = TokenList @@ -189,16 +188,3 @@ TokenList.prototype.componentWillUnmount = function () { this.tracker.stop() } -function uniqueMergeTokens (tokensA, tokensB) { - const uniqueAddresses = [] - const result = [] - tokensA.concat(tokensB).forEach((token) => { - const normal = normalizeAddress(token.address) - if (!uniqueAddresses.includes(normal)) { - uniqueAddresses.push(normal) - result.push(token) - } - }) - return result -} - -- cgit From 9fbdeab3deeb12999b14acfb9f8d6dd28b979c10 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Wed, 16 Aug 2017 12:53:53 -0700 Subject: Fallback to ethplorer link --- ui/app/components/token-list.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'ui/app') diff --git a/ui/app/components/token-list.js b/ui/app/components/token-list.js index 4bcde7d1d..2346568bc 100644 --- a/ui/app/components/token-list.js +++ b/ui/app/components/token-list.js @@ -27,7 +27,24 @@ TokenList.prototype.render = function () { if (error) { log.error(error) - return this.message('There was a problem loading your token balances.') + return h('.hotFix', { + style: { + padding: '80px', + }, + }, [ + 'We had trouble loading your token balances. You can view them ', + h('span.hotFix', { + style: { + color: 'rgba(247, 134, 28, 1)', + cursor: 'pointer', + }, + onClick: () => { + global.platform.openWindow({ + url: `https://ethplorer.io/address/${userAddress}`, + }) + }, + }, 'here'), + ]) } const tokenViews = tokens.map((tokenData) => { -- cgit From 343a7e9cce051d3045fe1a0c8a408c0d7402a1a1 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Wed, 16 Aug 2017 17:06:21 -0700 Subject: Transition to home view after tx error --- ui/app/actions.js | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'ui/app') diff --git a/ui/app/actions.js b/ui/app/actions.js index eafd04b4c..eebe65ba2 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -97,7 +97,6 @@ var actions = { cancelMsg: cancelMsg, signPersonalMsg, cancelPersonalMsg, - sendTx: sendTx, signTx: signTx, updateAndApproveTx, cancelTx: cancelTx, @@ -397,26 +396,13 @@ function signPersonalMsg (msgData) { function signTx (txData) { return (dispatch) => { + dispatch(actions.showLoadingIndication()) global.ethQuery.sendTransaction(txData, (err, data) => { dispatch(actions.hideLoadingIndication()) - if (err) return dispatch(actions.displayWarning(err.message)) - dispatch(actions.hideWarning()) - }) - dispatch(this.showConfTxPage()) - } -} - -function sendTx (txData) { - log.info(`actions - sendTx: ${JSON.stringify(txData.txParams)}`) - return (dispatch) => { - log.debug(`actions calling background.approveTransaction`) - background.approveTransaction(txData.id, (err) => { - if (err) { - dispatch(actions.txError(err)) - return log.error(err.message) - } - dispatch(actions.completedTx(txData.id)) + if (err) dispatch(actions.displayWarning(err.message)) + dispatch(this.goHome()) }) + dispatch(actions.showConfTxPage()) } } @@ -428,6 +414,7 @@ function updateAndApproveTx (txData) { dispatch(actions.hideLoadingIndication()) if (err) { dispatch(actions.txError(err)) + dispatch(actions.goHome()) return log.error(err.message) } dispatch(actions.completedTx(txData.id)) -- cgit From 98bedfabf932ff75445769898f8f97cf9f6e7f75 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Thu, 17 Aug 2017 15:35:17 -0700 Subject: Fix eth sign formatting --- ui/app/components/pending-msg-details.js | 2 +- ui/app/components/pending-msg.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'ui/app') diff --git a/ui/app/components/pending-msg-details.js b/ui/app/components/pending-msg-details.js index 16308d121..718a22de0 100644 --- a/ui/app/components/pending-msg-details.js +++ b/ui/app/components/pending-msg-details.js @@ -38,7 +38,7 @@ PendingMsgDetails.prototype.render = function () { // message data h('.tx-data.flex-column.flex-justify-center.flex-grow.select-none', [ - h('.flex-row.flex-space-between', [ + h('.flex-column.flex-space-between', [ h('label.font-small', 'MESSAGE'), h('span.font-small', msgParams.data), ]), diff --git a/ui/app/components/pending-msg.js b/ui/app/components/pending-msg.js index b2cac164a..b7133cda8 100644 --- a/ui/app/components/pending-msg.js +++ b/ui/app/components/pending-msg.js @@ -18,6 +18,9 @@ PendingMsg.prototype.render = function () { h('div', { key: msgData.id, + style: { + maxWidth: '350px', + }, }, [ // header @@ -35,7 +38,7 @@ PendingMsg.prototype.render = function () { }, `Signing this message can have dangerous side effects. Only sign messages from sites you fully trust with your entire account. - This will be fixed in a future version.`), + This dangerous method will be removed in a future version.`), // message details h(PendingTxDetails, state), -- cgit From e0ccdcd6fd4418e658d949247e2c258c5c8278a6 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Wed, 23 Aug 2017 09:40:24 -0700 Subject: Remove eth-tx-viz link from tx history icons --- ui/app/components/transaction-list-item.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'ui/app') diff --git a/ui/app/components/transaction-list-item.js b/ui/app/components/transaction-list-item.js index 9018bab06..5d5d0bcc5 100644 --- a/ui/app/components/transaction-list-item.js +++ b/ui/app/components/transaction-list-item.js @@ -60,16 +60,7 @@ TransactionListItem.prototype.render = function () { }, [ h('.identicon-wrapper.flex-column.flex-center.select-none', [ - h('.pop-hover', { - onClick: (event) => { - event.stopPropagation() - if (!isTx || isPending) return - var url = `https://metamask.github.io/eth-tx-viz/?tx=${transaction.hash}` - global.platform.openWindow({ url }) - }, - }, [ - h(TransactionIcon, { txParams, transaction, isTx, isMsg }), - ]), + h(TransactionIcon, { txParams, transaction, isTx, isMsg }), ]), h(Tooltip, { -- cgit From 54ce267a9f804b1733d2627ac7568d5eb6fe6518 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 29 Aug 2017 11:42:44 -0700 Subject: Add version to state logs Fixes #1986 --- ui/app/reducers.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ui/app') diff --git a/ui/app/reducers.js b/ui/app/reducers.js index 36045772f..6a2f44534 100644 --- a/ui/app/reducers.js +++ b/ui/app/reducers.js @@ -42,7 +42,10 @@ function rootReducer (state, action) { } window.logState = function () { - var stateString = JSON.stringify(window.METAMASK_CACHED_LOG_STATE, removeSeedWords, 2) + let state = window.METAMASK_CACHED_LOG_STATE + const version = global.platform.getVersion() + state.version = version + let stateString = JSON.stringify(state, removeSeedWords, 2) return stateString } -- cgit From 04011f9ea764cf2458637e41012c131d8b7a9aca Mon Sep 17 00:00:00 2001 From: Thomas Huang Date: Tue, 29 Aug 2017 17:54:01 -0700 Subject: Multiple tokens shows the amount when greater than 1 --- ui/app/components/token-list.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/app') diff --git a/ui/app/components/token-list.js b/ui/app/components/token-list.js index 2346568bc..998ec901d 100644 --- a/ui/app/components/token-list.js +++ b/ui/app/components/token-list.js @@ -95,7 +95,7 @@ TokenList.prototype.renderTokenStatusBar = function () { let msg if (tokens.length === 1) { msg = `You own 1 token` - } else if (tokens.length === 1) { + } else if (tokens.length > 1) { msg = `You own ${tokens.length} tokens` } else { msg = `No tokens found` -- cgit From ddd559718f5395190ad3903cdb9c42e2e6e50443 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Fri, 1 Sep 2017 11:01:53 -0700 Subject: Update support link --- ui/app/info.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/app') diff --git a/ui/app/info.js b/ui/app/info.js index 899841c83..c69d83715 100644 --- a/ui/app/info.js +++ b/ui/app/info.js @@ -103,7 +103,7 @@ InfoScreen.prototype.render = function () { [ h('div.fa.fa-support', [ h('a.info', { - href: 'http://metamask.consensyssupport.happyfox.com', + href: 'https://support.metamask.com', target: '_blank', }, 'Visit our Support Center'), ]), -- cgit From 90272e252fa265037ecdfb3f618aa1a8e16ee4fb Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 5 Sep 2017 11:44:26 -0700 Subject: Make eth_sign deprecation warning more useful Link to descriptive article that demonstrates the new preferred method. --- ui/app/components/pending-msg.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'ui/app') diff --git a/ui/app/components/pending-msg.js b/ui/app/components/pending-msg.js index b7133cda8..834719c53 100644 --- a/ui/app/components/pending-msg.js +++ b/ui/app/components/pending-msg.js @@ -35,10 +35,21 @@ PendingMsg.prototype.render = function () { style: { margin: '10px', }, - }, `Signing this message can have + }, [ + `Signing this message can have dangerous side effects. Only sign messages from sites you fully trust with your entire account. - This dangerous method will be removed in a future version.`), + This dangerous method will be removed in a future version. `, + h('a', { + href: 'https://medium.com/metamask/the-new-secure-way-to-sign-data-in-your-browser-6af9dd2a1527', + style: { color: 'rgb(247, 134, 28)' }, + onClick: (event) => { + event.preventDefault() + const url = 'https://medium.com/metamask/the-new-secure-way-to-sign-data-in-your-browser-6af9dd2a1527' + global.platform.openWindow({ url }) + }, + }, 'Read more here.'), + ]), // message details h(PendingTxDetails, state), -- cgit From f0ab4ce52d4383a6b07646b829023ca5217e4e6c Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Thu, 7 Sep 2017 11:51:04 -0700 Subject: Change expected type to array. --- ui/app/components/account-dropdowns.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/app') diff --git a/ui/app/components/account-dropdowns.js b/ui/app/components/account-dropdowns.js index c23f61c98..a53f3399d 100644 --- a/ui/app/components/account-dropdowns.js +++ b/ui/app/components/account-dropdowns.js @@ -295,7 +295,7 @@ AccountDropdowns.defaultProps = { AccountDropdowns.propTypes = { identities: PropTypes.objectOf(PropTypes.object), selected: PropTypes.string, - keyrings: PropTypes.objectOf(PropTypes.object), + keyrings: PropTypes.array, } const mapDispatchToProps = (dispatch) => { -- cgit From 69c7fe24b3f14a885bb2ff0bb936d1a35b521de3 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Thu, 7 Sep 2017 12:17:36 -0700 Subject: Place object property retrieval inside try-catch --- ui/app/components/account-dropdowns.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ui/app') diff --git a/ui/app/components/account-dropdowns.js b/ui/app/components/account-dropdowns.js index a53f3399d..b087a40d4 100644 --- a/ui/app/components/account-dropdowns.js +++ b/ui/app/components/account-dropdowns.js @@ -58,7 +58,7 @@ class AccountDropdowns extends Component { }, }, ), - this.indicateIfLoose(keyring.type), + this.indicateIfLoose(keyring), h('span', { style: { marginLeft: '20px', @@ -75,8 +75,9 @@ class AccountDropdowns extends Component { }) } - indicateIfLoose (type) { + indicateIfLoose (keyring) { try { // Sometimes keyrings aren't loaded yet: + const type = keyring.type const isLoose = type !== 'HD Key Tree' return isLoose ? h('.keyring-label', 'LOOSE') : null } catch (e) { return } -- cgit From 3a87a30912e8c5e212f7d0cc5e01ed1f873bfe33 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Thu, 7 Sep 2017 13:55:59 -0700 Subject: Fold submit and buy ether into one button slot --- ui/app/components/pending-tx.js | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'ui/app') diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js index 5324ccd64..65f64adfe 100644 --- a/ui/app/components/pending-tx.js +++ b/ui/app/components/pending-tx.js @@ -66,6 +66,7 @@ PendingTx.prototype.render = function () { const balanceBn = hexToBn(balance) const insufficientBalance = balanceBn.lt(maxCost) + const buyDisabled = insufficientBalance || !this.state.valid || !isValidAddress || this.state.submitting this.inputs = [] @@ -297,14 +298,6 @@ PendingTx.prototype.render = function () { margin: '14px 25px', }, }, [ - - - insufficientBalance ? - h('button.btn-green', { - onClick: props.buyEth, - }, 'Buy Ether') - : null, - h('button', { onClick: (event) => { this.resetGasFields() @@ -312,13 +305,14 @@ PendingTx.prototype.render = function () { }, }, 'Reset'), - // Accept Button - h('input.confirm.btn-green', { - type: 'submit', - value: 'SUBMIT', - style: { marginLeft: '10px' }, - disabled: insufficientBalance || !this.state.valid || !isValidAddress || this.state.submitting, - }), + // Accept Button or Buy Button + insufficientBalance ? h('button.btn-green', { onClick: props.buyEth }, 'Buy Ether') : + h('input.confirm.btn-green', { + type: 'submit', + value: 'SUBMIT', + style: { marginLeft: '10px' }, + disabled: buyDisabled, + }), h('button.cancel.btn-red', { onClick: props.cancelTransaction, -- cgit From 41e9904d9b6a6a9b828c02c7fe34b8eefb631374 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Thu, 7 Sep 2017 15:03:25 -0700 Subject: Convert icon to button. --- ui/app/components/pending-tx.js | 11 +++++++++++ ui/app/conf-tx.js | 19 +++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-) (limited to 'ui/app') diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js index 65f64adfe..4e7eeaecf 100644 --- a/ui/app/components/pending-tx.js +++ b/ui/app/components/pending-tx.js @@ -318,6 +318,17 @@ PendingTx.prototype.render = function () { onClick: props.cancelTransaction, }, 'Reject'), ]), + h('.flex-row.flex-space-around.conf-buttons', { + style: { + display: 'flex', + justifyContent: 'flex-end', + margin: '14px 25px', + }, + }, [ + h('button.cancel.btn-red', { + onClick: props.cancelAllTransactions, + }, 'Reject All'), + ]), ]), ]) ) diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js index d6ceb7ff5..8d819181f 100644 --- a/ui/app/conf-tx.js +++ b/ui/app/conf-tx.js @@ -89,18 +89,6 @@ ConfirmTxScreen.prototype.render = function () { }), ]), - h('h3', { - style: { - alignSelf: 'flex-end', - display: unconfTxList.length > 1 ? 'block' : 'none', - }, - }, [ - h('i.fa.fa-trash.fa-lg.cursor-pointer', { - title: 'Cancel All Pending Transactions', - onClick: () => props.dispatch(actions.cancelAllTx(unconfTxList)), - }), - ]), - warningIfExists(props.warning), currentTxView({ @@ -117,6 +105,7 @@ ConfirmTxScreen.prototype.render = function () { buyEth: this.buyEth.bind(this, txParams.from || props.selectedAddress), sendTransaction: this.sendTransaction.bind(this), cancelTransaction: this.cancelTransaction.bind(this, txData), + cancelAllTransactions: this.cancelAllTransactions.bind(this, unconfTxList), signMessage: this.signMessage.bind(this, txData), signPersonalMessage: this.signPersonalMessage.bind(this, txData), cancelMessage: this.cancelMessage.bind(this, txData), @@ -163,6 +152,12 @@ ConfirmTxScreen.prototype.cancelTransaction = function (txData, event) { this.props.dispatch(actions.cancelTx(txData)) } +ConfirmTxScreen.prototype.cancelAllTransactions = function (unconfTxList, event) { + this.stopPropagation(event) + event.preventDefault() + this.props.dispatch(actions.cancelAllTx(unconfTxList)) +} + ConfirmTxScreen.prototype.signMessage = function (msgData, event) { log.info('conf-tx.js: signing message') var params = msgData.msgParams -- cgit From 64717726c40e46dc7decffbaf3db6da0f4b0dc11 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Thu, 7 Sep 2017 15:27:30 -0700 Subject: Reword forgot password to restore seed phrase This always confuses people, I just finally did it. --- ui/app/unlock.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/app') diff --git a/ui/app/unlock.js b/ui/app/unlock.js index 9bacd5124..4180791c4 100644 --- a/ui/app/unlock.js +++ b/ui/app/unlock.js @@ -80,7 +80,7 @@ UnlockScreen.prototype.render = function () { color: 'rgb(247, 134, 28)', textDecoration: 'underline', }, - }, 'I forgot my password.'), + }, 'Restore from seed phrase'), ]), ]) ) -- cgit From 8d7f78c1a543cbbeb9d6599be346fc99db866340 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Thu, 7 Sep 2017 16:18:32 -0700 Subject: Add caret to indicate network is dropdown. --- ui/app/components/network.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ui/app') diff --git a/ui/app/components/network.js b/ui/app/components/network.js index 698a0bbb9..c7a28b363 100644 --- a/ui/app/components/network.js +++ b/ui/app/components/network.js @@ -74,6 +74,7 @@ Network.prototype.render = function () { color: '#039396', }}, 'Ethereum Main Net'), + h('i.fa.fa-caret-down.fa-lg'), ]) case 'ropsten-test-network': return h('.network-indicator', [ @@ -83,6 +84,7 @@ Network.prototype.render = function () { color: '#ff6666', }}, 'Ropsten Test Net'), + h('i.fa.fa-caret-down.fa-lg'), ]) case 'kovan-test-network': return h('.network-indicator', [ @@ -92,6 +94,7 @@ Network.prototype.render = function () { color: '#690496', }}, 'Kovan Test Net'), + h('i.fa.fa-caret-down.fa-lg'), ]) case 'rinkeby-test-network': return h('.network-indicator', [ @@ -101,6 +104,7 @@ Network.prototype.render = function () { color: '#e7a218', }}, 'Rinkeby Test Net'), + h('i.fa.fa-caret-down.fa-lg'), ]) default: return h('.network-indicator', [ @@ -116,6 +120,7 @@ Network.prototype.render = function () { color: '#AEAEAE', }}, 'Private Network'), + h('i.fa.fa-caret-down.fa-lg'), ]) } })(), -- cgit From 54fb8e8cef9b2692d1ad1bac9efd5cbe6eadf823 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Thu, 7 Sep 2017 16:26:31 -0700 Subject: Add cursor on hover on loading. Change some wording. --- ui/app/components/network.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ui/app') diff --git a/ui/app/components/network.js b/ui/app/components/network.js index c7a28b363..0dbe37cdd 100644 --- a/ui/app/components/network.js +++ b/ui/app/components/network.js @@ -22,7 +22,7 @@ Network.prototype.render = function () { let iconName, hoverText if (networkNumber === 'loading') { - return h('span', { + return h('span.pointer', { style: { display: 'flex', alignItems: 'center', @@ -37,7 +37,7 @@ Network.prototype.render = function () { }, src: 'images/loading.svg', }), - h('i.fa.fa-sort-desc'), + h('i.fa.fa-caret-down'), ]) } else if (providerName === 'mainnet') { hoverText = 'Main Ethereum Network' @@ -73,7 +73,7 @@ Network.prototype.render = function () { style: { color: '#039396', }}, - 'Ethereum Main Net'), + 'Main Network'), h('i.fa.fa-caret-down.fa-lg'), ]) case 'ropsten-test-network': -- cgit From 6560a2c3af66940e9fbfcc9943655ca5c7282121 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Thu, 7 Sep 2017 17:55:34 -0700 Subject: Add front-end validation for own adddresses as a token contract address. Add information on token contract addresses. --- ui/app/add-token.js | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'ui/app') diff --git a/ui/app/add-token.js b/ui/app/add-token.js index 15ef7a852..81894247b 100644 --- a/ui/app/add-token.js +++ b/ui/app/add-token.js @@ -3,6 +3,8 @@ const Component = require('react').Component const h = require('react-hyperscript') const connect = require('react-redux').connect const actions = require('./actions') +const Tooltip = require('./components/tooltip.js') + const ethUtil = require('ethereumjs-util') const abi = require('human-standard-token-abi') @@ -15,6 +17,7 @@ module.exports = connect(mapStateToProps)(AddTokenScreen) function mapStateToProps (state) { return { + identities: state.metamask.identities, } } @@ -64,15 +67,24 @@ AddTokenScreen.prototype.render = function () { }, [ h('div', [ - h('span', { - style: { fontWeight: 'bold', paddingRight: '10px'}, - }, 'Token Address'), + h(Tooltip, { + position: 'top', + title: 'The contract of the actual token contract. Click for more info.', + }, [ + h('a', { + style: { fontWeight: 'bold', paddingRight: '10px'}, + href: 'https://consensyssupport.happyfox.com/staff/kb/article/24-what-is-a-token-contract-address', + }, [ + h('span', 'Token Contract Address '), + h('i.fa.fa-question-circle'), + ]), + ]), ]), h('section.flex-row.flex-center', [ h('input#token-address', { name: 'address', - placeholder: 'Token Address', + placeholder: 'Token Contract Address', onChange: this.tokenAddressDidChange.bind(this), style: { width: 'inherit', @@ -171,7 +183,9 @@ AddTokenScreen.prototype.tokenAddressDidChange = function (event) { AddTokenScreen.prototype.validateInputs = function () { let msg = '' const state = this.state + const identitiesList = Object.keys(this.props.identities) const { address, symbol, decimals } = state + const standardAddress = ethUtil.addHexPrefix(address).toLowerCase() const validAddress = ethUtil.isValidAddress(address) if (!validAddress) { @@ -189,7 +203,12 @@ AddTokenScreen.prototype.validateInputs = function () { msg += 'Symbol must be between 0 and 10 characters.' } - const isValid = validAddress && validDecimals + const ownAddress = identitiesList.includes(standardAddress) + if (ownAddress) { + msg = 'Personal address detected. Input the token contact address.' + } + + const isValid = validAddress && validDecimals && !ownAddress if (!isValid) { this.setState({ @@ -216,4 +235,3 @@ AddTokenScreen.prototype.attemptToAutoFillTokenParams = async function (address) this.setState({ symbol: symbol[0], decimals: decimals[0].toString() }) } } - -- cgit From 54a5a117d55db826ac20059f70d748cd90516270 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Thu, 7 Sep 2017 18:00:45 -0700 Subject: Fix link to open new tab. --- ui/app/add-token.js | 1 + 1 file changed, 1 insertion(+) (limited to 'ui/app') diff --git a/ui/app/add-token.js b/ui/app/add-token.js index 81894247b..177adc572 100644 --- a/ui/app/add-token.js +++ b/ui/app/add-token.js @@ -74,6 +74,7 @@ AddTokenScreen.prototype.render = function () { h('a', { style: { fontWeight: 'bold', paddingRight: '10px'}, href: 'https://consensyssupport.happyfox.com/staff/kb/article/24-what-is-a-token-contract-address', + target: '_blank', }, [ h('span', 'Token Contract Address '), h('i.fa.fa-question-circle'), -- cgit From 0e6c11a3b5e7677d8d37da4d41bf19b09f85cd88 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Thu, 7 Sep 2017 18:01:39 -0700 Subject: Fix typo. --- ui/app/add-token.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/app') diff --git a/ui/app/add-token.js b/ui/app/add-token.js index 177adc572..18adc7eb5 100644 --- a/ui/app/add-token.js +++ b/ui/app/add-token.js @@ -206,7 +206,7 @@ AddTokenScreen.prototype.validateInputs = function () { const ownAddress = identitiesList.includes(standardAddress) if (ownAddress) { - msg = 'Personal address detected. Input the token contact address.' + msg = 'Personal address detected. Input the token contract address.' } const isValid = validAddress && validDecimals && !ownAddress -- cgit From 27ba7f6ed3b0c55f6f5d7fa7e3829bdc06e0df9f Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Mon, 11 Sep 2017 14:12:35 -0700 Subject: Show reject all only when tx count is > 1 --- ui/app/components/pending-tx.js | 5 +++-- ui/app/conf-tx.js | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'ui/app') diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js index 4e7eeaecf..3e53d47f9 100644 --- a/ui/app/components/pending-tx.js +++ b/ui/app/components/pending-tx.js @@ -67,6 +67,7 @@ PendingTx.prototype.render = function () { const balanceBn = hexToBn(balance) const insufficientBalance = balanceBn.lt(maxCost) const buyDisabled = insufficientBalance || !this.state.valid || !isValidAddress || this.state.submitting + const showRejectAll = props.unconfTxListLength > 1 this.inputs = [] @@ -318,7 +319,7 @@ PendingTx.prototype.render = function () { onClick: props.cancelTransaction, }, 'Reject'), ]), - h('.flex-row.flex-space-around.conf-buttons', { + showRejectAll ? h('.flex-row.flex-space-around.conf-buttons', { style: { display: 'flex', justifyContent: 'flex-end', @@ -328,7 +329,7 @@ PendingTx.prototype.render = function () { h('button.cancel.btn-red', { onClick: props.cancelAllTransactions, }, 'Reject All'), - ]), + ]) : null, ]), ]) ) diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js index 8d819181f..1ee4166f7 100644 --- a/ui/app/conf-tx.js +++ b/ui/app/conf-tx.js @@ -52,6 +52,8 @@ ConfirmTxScreen.prototype.render = function () { log.info(`rendering a combined ${unconfTxList.length} unconf msg & txs`) if (unconfTxList.length === 0) return h(Loading, { isLoading: true }) + const unconfTxListLength = unconfTxList.length + return ( h('.flex-column.flex-grow', [ @@ -101,6 +103,7 @@ ConfirmTxScreen.prototype.render = function () { conversionRate, currentCurrency, blockGasLimit, + unconfTxListLength, // Actions buyEth: this.buyEth.bind(this, txParams.from || props.selectedAddress), sendTransaction: this.sendTransaction.bind(this), -- cgit From 3a7d4a5d4e94d9a4c2556b161c5bad7dc00837a4 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Mon, 11 Sep 2017 16:13:28 -0700 Subject: Basic private key download file functionality. --- ui/app/components/account-export.js | 39 ++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) (limited to 'ui/app') diff --git a/ui/app/components/account-export.js b/ui/app/components/account-export.js index 330f73805..5bbdfca39 100644 --- a/ui/app/components/account-export.js +++ b/ui/app/components/account-export.js @@ -20,20 +20,21 @@ function mapStateToProps (state) { } ExportAccountView.prototype.render = function () { - var state = this.props - var accountDetail = state.accountDetail + const state = this.props + const accountDetail = state.accountDetail + const nickname = state.identities[state.address].name if (!accountDetail) return h('div') - var accountExport = accountDetail.accountExport + const accountExport = accountDetail.accountExport - var notExporting = accountExport === 'none' - var exportRequested = accountExport === 'requested' - var accountExported = accountExport === 'completed' + const notExporting = accountExport === 'none' + const exportRequested = accountExport === 'requested' + const accountExported = accountExport === 'completed' if (notExporting) return h('div') if (exportRequested) { - var warning = `Export private keys at your own risk.` + const warning = `Export private keys at your own risk.` return ( h('div', { style: { @@ -89,6 +90,8 @@ ExportAccountView.prototype.render = function () { } if (accountExported) { + const plainKey = ethUtil.stripHexPrefix(accountDetail.privateKey) + return h('div.privateKey', { style: { margin: '0 20px', @@ -105,10 +108,13 @@ ExportAccountView.prototype.render = function () { onClick: function (event) { copyToClipboard(ethUtil.stripHexPrefix(accountDetail.privateKey)) }, - }, ethUtil.stripHexPrefix(accountDetail.privateKey)), + }, plainKey), h('button', { onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address)), }, 'Done'), + h('button', { + onClick: () => this.exportAsFile(`MetaMask ${nickname} Private Key`, plainKey), + }, 'Save as File'), ]) } } @@ -117,6 +123,21 @@ ExportAccountView.prototype.onExportKeyPress = function (event) { if (event.key !== 'Enter') return event.preventDefault() - var input = document.getElementById('exportAccount').value + const input = document.getElementById('exportAccount').value this.props.dispatch(actions.exportAccount(input, this.props.address)) } + +ExportAccountView.prototype.exportAsFile = function (filename, data) { + // source: https://stackoverflow.com/a/33542499 by Ludovic Feltz + const blob = new Blob([data], {type: 'text/csv'}) + if (window.navigator.msSaveOrOpenBlob) { + window.navigator.msSaveBlob(blob, filename) + } else { + const elem = window.document.createElement('a') + elem.href = window.URL.createObjectURL(blob) + elem.download = filename + document.body.appendChild(elem) + elem.click() + document.body.removeChild(elem) + } +} -- cgit From fa1ec5dcd16ba09d31720a42d4015dedde91148c Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Mon, 11 Sep 2017 16:22:20 -0700 Subject: Move function as util function. --- ui/app/components/account-export.js | 18 ++---------------- ui/app/util.js | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 16 deletions(-) (limited to 'ui/app') diff --git a/ui/app/components/account-export.js b/ui/app/components/account-export.js index 5bbdfca39..d438c9ca5 100644 --- a/ui/app/components/account-export.js +++ b/ui/app/components/account-export.js @@ -1,6 +1,7 @@ const Component = require('react').Component const h = require('react-hyperscript') const inherits = require('util').inherits +const exportAsFile = require('../util').exportAsFile const copyToClipboard = require('copy-to-clipboard') const actions = require('../actions') const ethUtil = require('ethereumjs-util') @@ -113,7 +114,7 @@ ExportAccountView.prototype.render = function () { onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address)), }, 'Done'), h('button', { - onClick: () => this.exportAsFile(`MetaMask ${nickname} Private Key`, plainKey), + onClick: () => exportAsFile(`MetaMask ${nickname} Private Key`, plainKey), }, 'Save as File'), ]) } @@ -126,18 +127,3 @@ ExportAccountView.prototype.onExportKeyPress = function (event) { const input = document.getElementById('exportAccount').value this.props.dispatch(actions.exportAccount(input, this.props.address)) } - -ExportAccountView.prototype.exportAsFile = function (filename, data) { - // source: https://stackoverflow.com/a/33542499 by Ludovic Feltz - const blob = new Blob([data], {type: 'text/csv'}) - if (window.navigator.msSaveOrOpenBlob) { - window.navigator.msSaveBlob(blob, filename) - } else { - const elem = window.document.createElement('a') - elem.href = window.URL.createObjectURL(blob) - elem.download = filename - document.body.appendChild(elem) - elem.click() - document.body.removeChild(elem) - } -} diff --git a/ui/app/util.js b/ui/app/util.js index ac3f42c6b..1368ebf11 100644 --- a/ui/app/util.js +++ b/ui/app/util.js @@ -36,6 +36,7 @@ module.exports = { valueTable: valueTable, bnTable: bnTable, isHex: isHex, + exportAsFile: exportAsFile, } function valuesFor (obj) { @@ -215,3 +216,18 @@ function readableDate (ms) { function isHex (str) { return Boolean(str.match(/^(0x)?[0-9a-fA-F]+$/)) } + +function exportAsFile (filename, data) { + // source: https://stackoverflow.com/a/33542499 by Ludovic Feltz + const blob = new Blob([data], {type: 'text/csv'}) + if (window.navigator.msSaveOrOpenBlob) { + window.navigator.msSaveBlob(blob, filename) + } else { + const elem = window.document.createElement('a') + elem.href = window.URL.createObjectURL(blob) + elem.download = filename + document.body.appendChild(elem) + elem.click() + document.body.removeChild(elem) + } +} -- cgit From aa021b920942efd8075ca4e89cd92d50a1b21ed0 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Mon, 11 Sep 2017 16:40:45 -0700 Subject: Add some styling. --- ui/app/components/account-export.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'ui/app') diff --git a/ui/app/components/account-export.js b/ui/app/components/account-export.js index d438c9ca5..53a7f0fa1 100644 --- a/ui/app/components/account-export.js +++ b/ui/app/components/account-export.js @@ -115,6 +115,9 @@ ExportAccountView.prototype.render = function () { }, 'Done'), h('button', { onClick: () => exportAsFile(`MetaMask ${nickname} Private Key`, plainKey), + stlye: { + marginLeft: '10px', + }, }, 'Save as File'), ]) } -- cgit From e7c1a11b4de100f1966f639c79632a53763a8dac Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Mon, 11 Sep 2017 16:48:02 -0700 Subject: Add ability to save seed words as file. --- ui/app/keychains/hd/create-vault-complete.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'ui/app') diff --git a/ui/app/keychains/hd/create-vault-complete.js b/ui/app/keychains/hd/create-vault-complete.js index c32751fff..745990351 100644 --- a/ui/app/keychains/hd/create-vault-complete.js +++ b/ui/app/keychains/hd/create-vault-complete.js @@ -3,6 +3,7 @@ const Component = require('react').Component const connect = require('react-redux').connect const h = require('react-hyperscript') const actions = require('../../actions') +const exportAsFile = require('../../util').exportAsFile module.exports = connect(mapStateToProps)(CreateVaultCompleteScreen) @@ -65,8 +66,17 @@ CreateVaultCompleteScreen.prototype.render = function () { style: { margin: '24px', fontSize: '0.9em', + marginBottom: '10px', }, }, 'I\'ve copied it somewhere safe'), + + h('button.primary', { + onClick: () => exportAsFile(`MetaMask Seed Words`, seed), + style: { + margin: '10px', + fontSize: '0.9em', + }, + }, 'Save Seed Words As File'), ]) ) } -- cgit From 213af0cd6c84366b76a7ba5206fa5a6b79880028 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Mon, 11 Sep 2017 16:52:35 -0700 Subject: Fix typo. --- ui/app/components/account-export.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ui/app') diff --git a/ui/app/components/account-export.js b/ui/app/components/account-export.js index 53a7f0fa1..32b103c86 100644 --- a/ui/app/components/account-export.js +++ b/ui/app/components/account-export.js @@ -114,10 +114,10 @@ ExportAccountView.prototype.render = function () { onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address)), }, 'Done'), h('button', { - onClick: () => exportAsFile(`MetaMask ${nickname} Private Key`, plainKey), - stlye: { + style: { marginLeft: '10px', }, + onClick: () => exportAsFile(`MetaMask ${nickname} Private Key`, plainKey), }, 'Save as File'), ]) } -- cgit From ad14e9338d2e08b0fd0e371e7a81e20f8f9e90f7 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 12 Sep 2017 09:34:48 -0700 Subject: Convert state logs into a download. --- ui/app/config.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'ui/app') diff --git a/ui/app/config.js b/ui/app/config.js index 62785c49b..d64088ccb 100644 --- a/ui/app/config.js +++ b/ui/app/config.js @@ -5,7 +5,8 @@ const connect = require('react-redux').connect const actions = require('./actions') const currencies = require('./conversion.json').rows const validUrl = require('valid-url') -const copyToClipboard = require('copy-to-clipboard') +const exportAsFile = require('./util').exportAsFile + module.exports = connect(mapStateToProps)(ConfigScreen) @@ -110,9 +111,9 @@ ConfigScreen.prototype.render = function () { alignSelf: 'center', }, onClick (event) { - copyToClipboard(window.logState()) + exportAsFile('MetaMask State Logs', window.logState()) }, - }, 'Copy State Logs'), + }, 'Download State Logs'), ]), h('hr.horizontal-line'), -- cgit From 7ed1fe90f84284dd714b6f36165ed4b853272bb1 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 12 Sep 2017 15:07:08 -0700 Subject: Fix support link --- ui/app/info.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/app') diff --git a/ui/app/info.js b/ui/app/info.js index c69d83715..4c7d4cb4c 100644 --- a/ui/app/info.js +++ b/ui/app/info.js @@ -103,7 +103,7 @@ InfoScreen.prototype.render = function () { [ h('div.fa.fa-support', [ h('a.info', { - href: 'https://support.metamask.com', + href: 'https://support.metamask.io', target: '_blank', }, 'Visit our Support Center'), ]), -- cgit