diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-06-22 04:56:04 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-06-22 04:56:04 +0800 |
commit | 8fde8a8921135112ccfdd13ce6b009755b5f71ed (patch) | |
tree | cd4ceb1dcd74a601506f92e5669e3022ca800c0c /ui | |
parent | ab15b4c8259d6f6c5ae9d1e51548d73cfc1c67cb (diff) | |
download | tangerine-wallet-browser-8fde8a8921135112ccfdd13ce6b009755b5f71ed.tar tangerine-wallet-browser-8fde8a8921135112ccfdd13ce6b009755b5f71ed.tar.gz tangerine-wallet-browser-8fde8a8921135112ccfdd13ce6b009755b5f71ed.tar.bz2 tangerine-wallet-browser-8fde8a8921135112ccfdd13ce6b009755b5f71ed.tar.lz tangerine-wallet-browser-8fde8a8921135112ccfdd13ce6b009755b5f71ed.tar.xz tangerine-wallet-browser-8fde8a8921135112ccfdd13ce6b009755b5f71ed.tar.zst tangerine-wallet-browser-8fde8a8921135112ccfdd13ce6b009755b5f71ed.zip |
Manually linted
Diffstat (limited to 'ui')
35 files changed, 75 insertions, 123 deletions
diff --git a/ui/app/account-detail.js b/ui/app/account-detail.js index 8e07822e0..93702f77d 100644 --- a/ui/app/account-detail.js +++ b/ui/app/account-detail.js @@ -40,8 +40,6 @@ AccountDetailScreen.prototype.render = function () { var selected = props.address || Object.keys(props.accounts)[0] var identity = props.identities[selected] var account = props.accounts[selected] - var accountDetail = props.accountDetail - var transactions = props.transactions return ( diff --git a/ui/app/accounts/account-panel.js b/ui/app/accounts/account-panel.js index 42d186201..53ccf7d2c 100644 --- a/ui/app/accounts/account-panel.js +++ b/ui/app/accounts/account-panel.js @@ -16,10 +16,8 @@ function NewComponent () { NewComponent.prototype.render = function () { const identity = this.props.identity - var mayBeFauceting = identity.mayBeFauceting var isSelected = this.props.selectedAddress === identity.address var account = this.props.accounts[identity.address] - var isFauceting = mayBeFauceting && account.balance === '0x0' const selectedClass = isSelected ? '.selected' : '' return ( diff --git a/ui/app/accounts/index.js b/ui/app/accounts/index.js index 240abd6d9..775df400b 100644 --- a/ui/app/accounts/index.js +++ b/ui/app/accounts/index.js @@ -2,7 +2,6 @@ const inherits = require('util').inherits const Component = require('react').Component const h = require('react-hyperscript') const connect = require('react-redux').connect -const extend = require('xtend') const actions = require('../actions') const valuesFor = require('../util').valuesFor const findDOMNode = require('react-dom').findDOMNode diff --git a/ui/app/actions.js b/ui/app/actions.js index 5ceae6b6c..0cbc3b9e6 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -139,12 +139,6 @@ function closeMenu () { } } -function getNetworkStatus () { - return { - type: actions.getNetworkStatus, - } -} - // async actions function tryUnlockMetamask (password) { @@ -164,6 +158,9 @@ function createNewVault (password, entropy) { return (dispatch) => { dispatch(actions.createNewVaultInProgress()) _accountManager.createNewVault(password, entropy, (err, result) => { + if (err) { + return dispatch(actions.showWarning(err.message)) + } dispatch(actions.showNewVaultSeed(result)) }) } @@ -318,6 +315,10 @@ function agreeToDisclaimer () { return (dispatch) => { dispatch(this.showLoadingIndication()) _accountManager.agreeToDisclaimer((err) => { + if (err) { + return dispatch(actions.showWarning(err.message)) + } + dispatch(this.hideLoadingIndication()) dispatch({ type: this.AGREE_TO_DISCLAIMER, @@ -372,10 +373,14 @@ function updateMetamaskState (newState) { function lockMetamask () { return (dispatch) => { _accountManager.setLocked((err) => { + dispatch(actions.hideLoadingIndication()) + if (err) { + return dispatch(actions.showWarning(err.message)) + } + dispatch({ type: actions.LOCK_METAMASK, }) - dispatch(actions.hideLoadingIndication()) }) } } @@ -385,6 +390,10 @@ function showAccountDetail (address) { dispatch(actions.showLoadingIndication()) _accountManager.setSelectedAddress(address, (err, address) => { dispatch(actions.hideLoadingIndication()) + if (err) { + return dispatch(actions.showWarning(err.message)) + } + dispatch({ type: actions.SHOW_ACCOUNT_DETAIL, value: address, @@ -410,6 +419,11 @@ function confirmSeedWords () { return (dispatch) => { dispatch(actions.showLoadingIndication()) _accountManager.clearSeedWordCache((err, account) => { + dispatch(actions.hideLoadingIndication()) + if (err) { + return dispatch(actions.showWarning(err.message)) + } + console.log('Seed word cache cleared. ' + account) dispatch(actions.showAccountDetail(account)) }) diff --git a/ui/app/app.js b/ui/app/app.js index b4a44f15e..7204fb098 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -1,10 +1,7 @@ const inherits = require('util').inherits -const React = require('react') const Component = require('react').Component -const PropTypes = require('react').PropTypes const connect = require('react-redux').connect const h = require('react-hyperscript') -const extend = require('xtend') const actions = require('./actions') const ReactCSSTransitionGroup = require('react-addons-css-transition-group') // init @@ -25,7 +22,6 @@ const ConfigScreen = require('./config') const RevealSeedConfirmation = require('./recover-seed/confirmation') const InfoScreen = require('./info') const LoadingIndicator = require('./loading') -const txHelper = require('../lib/tx-helper') const SandwichExpando = require('sandwich-expando') const MenuDroppo = require('menu-droppo') const DropMenuItem = require('./components/drop-menu-item') @@ -55,7 +51,6 @@ function mapStateToProps (state) { App.prototype.render = function () { var props = this.props - var view = props.currentView.name var transForward = props.transForward return ( @@ -148,8 +143,6 @@ App.prototype.renderNetworkDropdown = function () { const state = this.state || {} const isOpen = state.isNetworkMenuOpen - const checked = h('i.fa.fa-check.fa-lg', { ariaHidden: true }) - return h(MenuDroppo, { isOpen, onClickOutside: (event) => { diff --git a/ui/app/components/account-panel.js b/ui/app/components/account-panel.js index 05ac5d67b..112b897d5 100644 --- a/ui/app/components/account-panel.js +++ b/ui/app/components/account-panel.js @@ -1,9 +1,7 @@ const inherits = require('util').inherits -const ethUtil = require('ethereumjs-util') const Component = require('react').Component const h = require('react-hyperscript') const formatBalance = require('../util').formatBalance -const Identicon = require('./identicon') const addressSummary = require('../util').addressSummary const Panel = require('./panel') @@ -21,9 +19,6 @@ AccountPanel.prototype.render = function () { var account = state.account || {} var isFauceting = state.isFauceting - var identicon = new Identicon(identity.address, 46).toString() - var identiconSrc = `data:image/png;base64,${identicon}` - var panelOpts = { key: `accountPanel${identity.address}`, onClick: (event) => { diff --git a/ui/app/components/editable-label.js b/ui/app/components/editable-label.js index 303c49c44..3d7ca17d4 100644 --- a/ui/app/components/editable-label.js +++ b/ui/app/components/editable-label.js @@ -12,7 +12,7 @@ function EditableLabel () { EditableLabel.prototype.render = function () { const props = this.props - let state = this.state + const state = this.state if (state && state.isEditingLabel) { return h('div.editable-label', [ diff --git a/ui/app/components/eth-balance.js b/ui/app/components/eth-balance.js index 0423d2ab6..710d4fc8b 100644 --- a/ui/app/components/eth-balance.js +++ b/ui/app/components/eth-balance.js @@ -1,7 +1,6 @@ const Component = require('react').Component const h = require('react-hyperscript') const inherits = require('util').inherits -const parseBalance = require('../util').parseBalance const formatBalance = require('../util').formatBalance module.exports = EthBalanceComponent diff --git a/ui/app/components/mascot.js b/ui/app/components/mascot.js index 3e0ecc14f..ddd51f8ba 100644 --- a/ui/app/components/mascot.js +++ b/ui/app/components/mascot.js @@ -2,7 +2,6 @@ const inherits = require('util').inherits const Component = require('react').Component const h = require('react-hyperscript') const metamaskLogo = require('metamask-logo') -const getCaretCoordinates = require('textarea-caret') const debounce = require('debounce') module.exports = Mascot diff --git a/ui/app/components/network.js b/ui/app/components/network.js index 5a84e7d58..771be5f32 100644 --- a/ui/app/components/network.js +++ b/ui/app/components/network.js @@ -14,9 +14,8 @@ Network.prototype.render = function () { const state = this.props const networkNumber = state.network let iconName, hoverText - const imagePath = '/images/' - if (networkNumber == 'loading') { + if (networkNumber === 'loading') { return h('img', { title: 'Attempting to connect to blockchain.', onClick: (event) => this.props.onClick(event), @@ -26,10 +25,10 @@ Network.prototype.render = function () { }, src: 'images/loading.svg', }) - } else if (parseInt(networkNumber) == 1) { + } else if (parseInt(networkNumber) === 1) { hoverText = 'Main Ethereum Network' iconName = 'ethereum-network' - } else if (parseInt(networkNumber) == 2) { + } else if (parseInt(networkNumber) === 2) { hoverText = 'Morden Test Network' iconName = 'morden-test-network' } else { @@ -45,7 +44,7 @@ Network.prototype.render = function () { title: hoverText, onClick: (event) => this.props.onClick(event), }, [ - function () { + (function () { switch (iconName) { case 'ethereum-network': return h('.menu-icon.ether-icon') @@ -60,7 +59,7 @@ Network.prototype.render = function () { }, }) } - }(), + })(), ]) ) } diff --git a/ui/app/components/panel.js b/ui/app/components/panel.js index 8841247a7..cbdc82982 100644 --- a/ui/app/components/panel.js +++ b/ui/app/components/panel.js @@ -1,5 +1,4 @@ const inherits = require('util').inherits -const ethUtil = require('ethereumjs-util') const Component = require('react').Component const h = require('react-hyperscript') const Identicon = require('./identicon') @@ -14,9 +13,6 @@ function Panel () { Panel.prototype.render = function () { var state = this.props - var identity = state.identity || {} - var account = state.account || {} - var isFauceting = state.isFauceting var style = { flex: '1 0 auto', } diff --git a/ui/app/components/pending-msg.js b/ui/app/components/pending-msg.js index 2f1b88493..7f3914d56 100644 --- a/ui/app/components/pending-msg.js +++ b/ui/app/components/pending-msg.js @@ -3,10 +3,7 @@ const h = require('react-hyperscript') const inherits = require('util').inherits const AccountPanel = require('./account-panel') -const addressSummary = require('../util').addressSummary const readableDate = require('../util').readableDate -const formatBalance = require('../util').formatBalance -const dataSize = require('../util').dataSize module.exports = PendingMsg diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js index 69b9d2962..1835239e5 100644 --- a/ui/app/components/pending-tx.js +++ b/ui/app/components/pending-tx.js @@ -6,7 +6,6 @@ const AccountPanel = require('./account-panel') const addressSummary = require('../util').addressSummary const readableDate = require('../util').readableDate const formatBalance = require('../util').formatBalance -const dataSize = require('../util').dataSize module.exports = PendingTx diff --git a/ui/app/components/template.js b/ui/app/components/template.js index a5203aec8..b6ed8eaa0 100644 --- a/ui/app/components/template.js +++ b/ui/app/components/template.js @@ -10,9 +10,9 @@ function NewComponent () { } NewComponent.prototype.render = function () { - var state = this.props + const props = this.props return ( - h('span', 'Placeholder component') + h('span', props.message) ) } diff --git a/ui/app/components/transaction-list-item-icon.js b/ui/app/components/transaction-list-item-icon.js index beeec5192..c640de551 100644 --- a/ui/app/components/transaction-list-item-icon.js +++ b/ui/app/components/transaction-list-item-icon.js @@ -12,7 +12,7 @@ function TransactionIcon () { } TransactionIcon.prototype.render = function () { - const { transaction, txParams, isTx, isMsg } = this.props + const { transaction, txParams, isMsg } = this.props if (transaction.status === 'rejected') { return h('i.fa.fa-exclamation-triangle.fa-lg.error', { diff --git a/ui/app/components/transaction-list-item.js b/ui/app/components/transaction-list-item.js index f7b357d61..56f2103f3 100644 --- a/ui/app/components/transaction-list-item.js +++ b/ui/app/components/transaction-list-item.js @@ -5,7 +5,6 @@ const inherits = require('util').inherits const EtherBalance = require('./eth-balance') const addressSummary = require('../util').addressSummary const explorerLink = require('../../lib/explorer-link') -const formatBalance = require('../util').formatBalance const vreme = new (require('vreme')) const TransactionIcon = require('./transaction-list-item-icon') @@ -58,8 +57,8 @@ TransactionListItem.prototype.render = function () { // large identicon h('.identicon-wrapper.flex-column.flex-center.select-none', [ - transaction.status === 'unconfirmed' ? h('.red-dot', ' ') : - h(TransactionIcon, { txParams, transaction, isTx, isMsg }), + transaction.status === 'unconfirmed' ? h('.red-dot', ' ') + : h(TransactionIcon, { txParams, transaction, isTx, isMsg }), ]), h('.flex-column', [ @@ -108,11 +107,6 @@ function recipientField (txParams, transaction, isTx, isMsg) { ]) } -TransactionListItem.prototype.renderMessage = function () { - const { transaction, i, network } = this.props - return h('div', 'wowie, thats a message') -} - function formatDate (date) { return vreme.format(new Date(date), 'March 16 2014 14:30') } diff --git a/ui/app/components/transaction-list.js b/ui/app/components/transaction-list.js index e1b41fb44..a1a5db475 100644 --- a/ui/app/components/transaction-list.js +++ b/ui/app/components/transaction-list.js @@ -13,7 +13,7 @@ function TransactionList () { } TransactionList.prototype.render = function () { - const { txsToRender, network, unconfTxs, unconfMsgs } = this.props + const { txsToRender, network, unconfMsgs } = this.props const transactions = txsToRender.concat(unconfMsgs) .sort((a, b) => b.time - a.time) @@ -49,8 +49,8 @@ TransactionList.prototype.render = function () { }, }, ( - transactions.length ? - transactions.map((transaction, i) => { + transactions.length + ? transactions.map((transaction, i) => { return h(TransactionListItem, { transaction, i, network, showTx: (txId) => { @@ -58,12 +58,11 @@ TransactionList.prototype.render = function () { }, }) }) - : - [h('.flex-center', { - style: { - height: '100%', - }, - }, 'No transaction history...')] + : [h('.flex-center', { + style: { + height: '100%', + }, + }, 'No transaction history...')] )), ]) ) diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js index fd6dbb3a6..5c80939b9 100644 --- a/ui/app/conf-tx.js +++ b/ui/app/conf-tx.js @@ -3,10 +3,7 @@ const Component = require('react').Component const ReactCSSTransitionGroup = require('react-addons-css-transition-group') const h = require('react-hyperscript') const connect = require('react-redux').connect -const copyToClipboard = require('copy-to-clipboard') const actions = require('./actions') -const AccountPanel = require('./components/account-panel') -const valuesFor = require('./util').valuesFor const txHelper = require('../lib/tx-helper') const ConfirmTx = require('./components/pending-tx') diff --git a/ui/app/config.js b/ui/app/config.js index 7af3cf0f7..4094180dd 100644 --- a/ui/app/config.js +++ b/ui/app/config.js @@ -8,7 +8,6 @@ module.exports = connect(mapStateToProps)(ConfigScreen) function mapStateToProps (state) { return { - rpc: state.metamask.rpcTarget, metamask: state.metamask, } } @@ -20,7 +19,6 @@ function ConfigScreen () { ConfigScreen.prototype.render = function () { var state = this.props - var rpc = state.rpc var metamaskState = state.metamask return ( diff --git a/ui/app/first-time/init-menu.js b/ui/app/first-time/init-menu.js index 5fa6ec501..e63c30fc5 100644 --- a/ui/app/first-time/init-menu.js +++ b/ui/app/first-time/init-menu.js @@ -3,11 +3,8 @@ const EventEmitter = require('events').EventEmitter const Component = require('react').Component const connect = require('react-redux').connect const h = require('react-hyperscript') -const getCaretCoordinates = require('textarea-caret') const Mascot = require('../components/mascot') const actions = require('../actions') -const CreateVaultScreen = require('./create-vault') -const CreateVaultCompleteScreen = require('./create-vault-complete') module.exports = connect(mapStateToProps)(InitializeMenuScreen) @@ -40,7 +37,6 @@ InitializeMenuScreen.prototype.render = function () { // } InitializeMenuScreen.prototype.renderMenu = function () { - var state = this.props return ( h('.initialize-screen.flex-column.flex-center.flex-grow', [ diff --git a/ui/app/info.js b/ui/app/info.js index 04b740069..e3b68fed5 100644 --- a/ui/app/info.js +++ b/ui/app/info.js @@ -17,7 +17,6 @@ function InfoScreen () { InfoScreen.prototype.render = function () { var state = this.props - var rpc = state.rpc var manifest = chrome.runtime.getManifest() return ( h('.flex-column.flex-grow', [ diff --git a/ui/app/loading.js b/ui/app/loading.js index f65f58ade..606b53dde 100644 --- a/ui/app/loading.js +++ b/ui/app/loading.js @@ -2,7 +2,6 @@ const inherits = require('util').inherits const Component = require('react').Component const h = require('react-hyperscript') const connect = require('react-redux').connect -const actions = require('./actions') const ReactCSSTransitionGroup = require('react-addons-css-transition-group') module.exports = connect(mapStateToProps)(LoadingIndicator) diff --git a/ui/app/reducers.js b/ui/app/reducers.js index ccd8ac8f6..17f94f230 100644 --- a/ui/app/reducers.js +++ b/ui/app/reducers.js @@ -1,5 +1,3 @@ -const combineReducers = require('redux').combineReducers -const actions = require('./actions') const extend = require('xtend') // diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index 5ad6d82c3..f45be0433 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -1,6 +1,5 @@ const extend = require('xtend') const actions = require('../actions') -const valuesFor = require('../util').valuesFor const txHelper = require('../../lib/tx-helper') module.exports = reduceApp @@ -180,7 +179,7 @@ function reduceApp (state, action) { return extend(appState, { currentView: { name: 'accountDetail', - context: action.value || account, + context: action.value, }, accountDetail: { subview: 'transactions', @@ -205,7 +204,6 @@ function reduceApp (state, action) { }) case actions.SHOW_ACCOUNTS_PAGE: - var seedWords = state.metamask.seedWords return extend(appState, { currentView: { name: seedWords ? 'createVaultComplete' : 'accounts', diff --git a/ui/app/reducers/identities.js b/ui/app/reducers/identities.js index be5518b47..341a404e7 100644 --- a/ui/app/reducers/identities.js +++ b/ui/app/reducers/identities.js @@ -1,5 +1,4 @@ const extend = require('xtend') -const actions = require('../actions') module.exports = reduceIdentities diff --git a/ui/app/reducers/metamask.js b/ui/app/reducers/metamask.js index 670312830..f3ef8eb11 100644 --- a/ui/app/reducers/metamask.js +++ b/ui/app/reducers/metamask.js @@ -4,6 +4,8 @@ const actions = require('../actions') module.exports = reduceMetamask function reduceMetamask (state, action) { + let newState + // clone + defaults var metamaskState = extend({ isInitialized: false, @@ -17,9 +19,9 @@ function reduceMetamask (state, action) { switch (action.type) { case actions.SHOW_ACCOUNTS_PAGE: - var state = extend(metamaskState) - delete state.seedWords - return state + newState = extend(metamaskState) + delete newState.seedWords + return newState case actions.UPDATE_METAMASK_STATE: return extend(metamaskState, action.value) @@ -58,16 +60,16 @@ function reduceMetamask (state, action) { case actions.COMPLETED_TX: var stringId = String(action.id) - var newState = extend(metamaskState, { + newState = extend(metamaskState, { unconfTxs: {}, unconfMsgs: {}, }) - for (var id in metamaskState.unconfTxs) { + for (const id in metamaskState.unconfTxs) { if (id !== stringId) { newState.unconfTxs[id] = metamaskState.unconfTxs[id] } } - for (var id in metamaskState.unconfMsgs) { + for (const id in metamaskState.unconfMsgs) { if (id !== stringId) { newState.unconfMsgs[id] = metamaskState.unconfMsgs[id] } @@ -81,7 +83,7 @@ function reduceMetamask (state, action) { }) case actions.CLEAR_SEED_WORD_CACHE: - var newState = extend(metamaskState, { + newState = extend(metamaskState, { isUnlocked: true, isInitialized: true, selectedAccount: action.value, @@ -90,7 +92,7 @@ function reduceMetamask (state, action) { return newState case actions.SHOW_ACCOUNT_DETAIL: - const newState = extend(metamaskState, { + newState = extend(metamaskState, { isUnlocked: true, isInitialized: true, selectedAccount: action.value, diff --git a/ui/app/root.js b/ui/app/root.js index 92c32d324..9e7314b20 100644 --- a/ui/app/root.js +++ b/ui/app/root.js @@ -1,5 +1,4 @@ const inherits = require('util').inherits -const React = require('react') const Component = require('react').Component const Provider = require('react-redux').Provider const h = require('react-hyperscript') diff --git a/ui/app/send.js b/ui/app/send.js index a5a9d69f1..82c378dd2 100644 --- a/ui/app/send.js +++ b/ui/app/send.js @@ -6,7 +6,6 @@ const Identicon = require('./components/identicon') const actions = require('./actions') const util = require('./util') const numericBalance = require('./util').numericBalance -const formatBalance = require('./util').formatBalance const addressSummary = require('./util').addressSummary const EtherBalance = require('./components/eth-balance') const ethUtil = require('ethereumjs-util') @@ -212,14 +211,15 @@ SendTransactionScreen.prototype.onSubmit = function () { const value = util.normalizeEthStringToWei(input) const txData = document.querySelector('input[name="txData"]').value const balance = this.props.balance + let message if (value.gt(balance)) { - var message = 'Insufficient funds.' + message = 'Insufficient funds.' return this.props.dispatch(actions.displayWarning(message)) } if ((!util.isValidAddress(recipient) && !txData) || (!recipient && !txData)) { - var message = 'Recipient address is invalid.' + message = 'Recipient address is invalid.' return this.props.dispatch(actions.displayWarning(message)) } diff --git a/ui/app/settings.js b/ui/app/settings.js index 2b0c16c62..e56f4ee63 100644 --- a/ui/app/settings.js +++ b/ui/app/settings.js @@ -2,17 +2,12 @@ const inherits = require('util').inherits const Component = require('react').Component const h = require('react-hyperscript') const connect = require('react-redux').connect -const copyToClipboard = require('copy-to-clipboard') const actions = require('./actions') -const AccountPanel = require('./components/account-panel') module.exports = connect(mapStateToProps)(AppSettingsPage) function mapStateToProps (state) { - return { - identities: state.metamask.identities, - address: state.appState.currentView.context, - } + return {} } inherits(AppSettingsPage, Component) @@ -21,8 +16,6 @@ function AppSettingsPage () { } AppSettingsPage.prototype.render = function () { - var state = this.props - var identity = state.identities[state.address] return ( h('.account-detail-section.flex-column.flex-grow', [ diff --git a/ui/app/template.js b/ui/app/template.js index 3189a838c..d15b30fd2 100644 --- a/ui/app/template.js +++ b/ui/app/template.js @@ -2,7 +2,6 @@ const inherits = require('util').inherits const Component = require('react').Component const h = require('react-hyperscript') const connect = require('react-redux').connect -const actions = require('./actions') module.exports = connect(mapStateToProps)(COMPONENTNAME) @@ -24,7 +23,7 @@ COMPONENTNAME.prototype.render = function () { background: 'blue', }, }, [ - 'Hello, world!', + `Hello, ${props.sender}`, ]) ) } diff --git a/ui/app/util.js b/ui/app/util.js index de631dba9..db12a1282 100644 --- a/ui/app/util.js +++ b/ui/app/util.js @@ -84,13 +84,13 @@ function weiToEth (bn) { // Takes hex, returns [beforeDecimal, afterDecimal] function parseBalance (balance) { - let beforeDecimal, afterDecimal - let wei = numericBalance(balance).toString() - let trailingZeros = /0+$/ + var beforeDecimal, afterDecimal + const wei = numericBalance(balance).toString() + const trailingZeros = /0+$/ - beforeDecimal = wei.length > 18 ? wei.slice(0, wei.length - 18) : '0' - afterDecimal = ("000000000000000000" + wei).slice(-18).replace(trailingZeros, "") - if(afterDecimal == ""){afterDecimal = "0" } + beforeDecimal = wei.length > 18 ? wei.slice(0, wei.length - 18) : '0' + afterDecimal = ('000000000000000000' + wei).slice(-18).replace(trailingZeros, '') + if (afterDecimal === '') { afterDecimal = '0' } return [beforeDecimal, afterDecimal] } @@ -161,7 +161,7 @@ function readableDate (ms) { var minutes = '0' + date.getMinutes() var seconds = '0' + date.getSeconds() - var date = `${month}/${day}/${year}` + var dateStr = `${month}/${day}/${year}` var time = `${hours}:${minutes.substr(-2)}:${seconds.substr(-2)}` - return `${date} ${time}` + return `${dateStr} ${time}` } @@ -1,13 +1,14 @@ const fs = require('fs') +const path = require('path') module.exports = bundleCss var cssFiles = { - 'fonts.css': fs.readFileSync(__dirname + '/app/css/fonts.css', 'utf8'), - 'reset.css': fs.readFileSync(__dirname + '/app/css/reset.css', 'utf8'), - 'lib.css': fs.readFileSync(__dirname + '/app/css/lib.css', 'utf8'), - 'index.css': fs.readFileSync(__dirname + '/app/css/index.css', 'utf8'), - 'transitions.css': fs.readFileSync(__dirname + '/app/css/transitions.css', 'utf8'), + 'fonts.css': fs.readFileSync(path.join(__dirname, '/app/css/fonts.css'), 'utf8'), + 'reset.css': fs.readFileSync(path.join(__dirname, '/app/css/reset.css'), 'utf8'), + 'lib.css': fs.readFileSync(path.join(__dirname, '/app/css/lib.css'), 'utf8'), + 'index.css': fs.readFileSync(path.join(__dirname, '/app/css/index.css'), 'utf8'), + 'transitions.css': fs.readFileSync(path.join(__dirname, '/app/css/transitions.css'), 'utf8'), } function bundleCss () { diff --git a/ui/example.js b/ui/example.js index c143937c1..f4126438c 100644 --- a/ui/example.js +++ b/ui/example.js @@ -106,7 +106,7 @@ var container = document.getElementById('app-content') var css = MetaMaskUiCss() injectCss(css) -var app = MetaMaskUi({ +MetaMaskUi({ container: container, accountManager: accountManager, }) diff --git a/ui/index.js b/ui/index.js index 694a7164c..8cf74f6ee 100644 --- a/ui/index.js +++ b/ui/index.js @@ -1,7 +1,5 @@ -const React = require('react') const render = require('react-dom').render const h = require('react-hyperscript') -const extend = require('xtend') const Root = require('./app/root') const actions = require('./app/actions') const configureStore = require('./app/store') @@ -40,11 +38,6 @@ function startApp (metamaskState, accountManager, opts) { store.dispatch(actions.showConfTxPage()) } - // if unconfirmed messages, start on msgConf page - if (Object.keys(metamaskState.unconfMsgs || {}).length) { - store.dispatch(actions.showConfTxPage()) - } - accountManager.on('update', function (metamaskState) { store.dispatch(actions.updateMetamaskState(metamaskState)) }) diff --git a/ui/lib/icon-factory.js b/ui/lib/icon-factory.js index ee784dbd8..1f7cca859 100644 --- a/ui/lib/icon-factory.js +++ b/ui/lib/icon-factory.js @@ -34,9 +34,11 @@ IconFactory.prototype.cacheIcon = function (address, diameter, icon) { if (!(address in this.cache)) { var sizeCache = {} sizeCache[diameter] = icon - return this.cache[address] = sizeCache + this.cache[address] = sizeCache + return sizeCache } else { - return this.cache[address][diameter] = icon + this.cache[address][diameter] = icon + return icon } } |