From e7b3ef0708290a81dad5c469adaa6fab3f1c45b5 Mon Sep 17 00:00:00 2001 From: Dan Date: Tue, 29 Aug 2017 12:20:48 -0230 Subject: Lint fixes --- .../components/dropdowns/account-options-dropdown.js | 7 ++++--- .../components/dropdowns/account-selection-dropdown.js | 7 ++++--- .../dropdowns/components/account-dropdowns.js | 18 +++++++++--------- ui/app/components/dropdowns/index.js | 5 ++--- ui/app/components/dropdowns/network-dropdown.js | 8 ++++---- 5 files changed, 23 insertions(+), 22 deletions(-) (limited to 'ui/app/components/dropdowns') diff --git a/ui/app/components/dropdowns/account-options-dropdown.js b/ui/app/components/dropdowns/account-options-dropdown.js index 7d7188ec4..50e793d87 100644 --- a/ui/app/components/dropdowns/account-options-dropdown.js +++ b/ui/app/components/dropdowns/account-options-dropdown.js @@ -12,6 +12,7 @@ module.exports = AccountOptionsDropdown // TODO: specify default props and proptypes // TODO: hook up to state, connect to redux to clean up API +// TODO: selectedAddress is not defined... should we use selected? AccountOptionsDropdown.prototype.render = function () { const { selected, network, identities, style, dropdownWrapperStyle, menuItemStyles } = this.props @@ -21,8 +22,8 @@ AccountOptionsDropdown.prototype.render = function () { selected: selectedAddress, network, identities, - style: !!style ? style : {}, - dropdownWrapperStyle: !!dropdownWrapperStyle ? dropdownWrapperStyle : {}, - menuItemStyles: !!menuItemStyles ? menuItemStyles : {}, + style: style || {}, + dropdownWrapperStyle: dropdownWrapperStyle || {}, + menuItemStyles: menuItemStyles || {}, }, []) } diff --git a/ui/app/components/dropdowns/account-selection-dropdown.js b/ui/app/components/dropdowns/account-selection-dropdown.js index ccb73bde7..7a8502d18 100644 --- a/ui/app/components/dropdowns/account-selection-dropdown.js +++ b/ui/app/components/dropdowns/account-selection-dropdown.js @@ -12,6 +12,7 @@ module.exports = AccountSelectionDropdown // TODO: specify default props and proptypes // TODO: hook up to state, connect to redux to clean up API +// TODO: selectedAddress is not defined... should we use selected? AccountSelectionDropdown.prototype.render = function () { const { selected, network, identities, style, dropdownWrapperStyle, menuItemStyles } = this.props @@ -21,8 +22,8 @@ AccountSelectionDropdown.prototype.render = function () { selected: selectedAddress, network, identities, - style: !!style ? style : {}, - dropdownWrapperStyle: !!dropdownWrapperStyle ? dropdownWrapperStyle : {}, - menuItemStyles: !!menuItemStyles ? menuItemStyles : {}, + style: style || {}, + dropdownWrapperStyle: dropdownWrapperStyle || {}, + menuItemStyles: menuItemStyles || {}, }, []) } diff --git a/ui/app/components/dropdowns/components/account-dropdowns.js b/ui/app/components/dropdowns/components/account-dropdowns.js index c340fdaed..1e869251a 100644 --- a/ui/app/components/dropdowns/components/account-dropdowns.js +++ b/ui/app/components/dropdowns/components/account-dropdowns.js @@ -25,7 +25,7 @@ class AccountDropdowns extends Component { } renderAccounts () { - const { identities, accounts, selected, menuItemStyles, dropdownWrapperStyle, actions } = this.props + const { identities, accounts, selected, menuItemStyles, actions } = this.props return Object.keys(identities).map((key, index) => { const identity = identities[key] @@ -57,13 +57,13 @@ class AccountDropdowns extends Component { flex: '1 1 0', minWidth: '20px', minHeight: '30px', - } + }, }, [ h('span', { style: { flex: '1 1 auto', fontSize: '14px', - } + }, }, isSelected ? h('i.fa.fa-check') : null), ]), @@ -86,7 +86,7 @@ class AccountDropdowns extends Component { alignItems: 'flex-start', justifyContent: 'center', marginLeft: '10px', - } + }, }, [ h('span.account-dropdown-name', { style: { @@ -102,7 +102,7 @@ class AccountDropdowns extends Component { style: { fontSize: '14px', }, - }, formattedBalance) + }, formattedBalance), ]), h('span', { @@ -119,17 +119,17 @@ class AccountDropdowns extends Component { }, }, [ 'Edit', - ]) + ]), ]), - ]) + ]), ] ) }) } renderAccountSelector () { - const { actions, dropdownWrapperStyle, useCssTransition, innerStyle } = this.props + const { actions, useCssTransition, innerStyle } = this.props const { accountSelectorActive, menuItemStyles } = this.state return h( @@ -323,7 +323,7 @@ class AccountDropdowns extends Component { } render () { - const { style, enableAccountsSelector, enableAccountOptions, dropdownWrapperStyle } = this.props + const { style, enableAccountsSelector, enableAccountOptions } = this.props const { optionsMenuActive, accountSelectorActive } = this.state return h( diff --git a/ui/app/components/dropdowns/index.js b/ui/app/components/dropdowns/index.js index d21c795f5..fa66f5000 100644 --- a/ui/app/components/dropdowns/index.js +++ b/ui/app/components/dropdowns/index.js @@ -1,7 +1,6 @@ // Reusable Dropdown Components -//TODO: Refactor into separate components +// TODO: Refactor into separate components const Dropdown = require('./components/dropdown').Dropdown -const DropdownMenuItem = require('./components/dropdown').DropdownMenuItem const AccountDropdowns = require('./components/account-dropdowns') // App-Specific Instances @@ -15,4 +14,4 @@ module.exports = { NetworkDropdown, Dropdown, AccountDropdowns, -} \ No newline at end of file +} diff --git a/ui/app/components/dropdowns/network-dropdown.js b/ui/app/components/dropdowns/network-dropdown.js index 6228513c9..0c002b2f0 100644 --- a/ui/app/components/dropdowns/network-dropdown.js +++ b/ui/app/components/dropdowns/network-dropdown.js @@ -23,6 +23,7 @@ function mapDispatchToProps (dispatch) { dispatch(actions.setProviderType(type)) }, setDefaultRpcTarget: () => { + // TODO: type is not defined. Is it needed? dispatch(actions.setDefaultRpcTarget(type)) }, setRpcTarget: (target) => { @@ -31,8 +32,8 @@ function mapDispatchToProps (dispatch) { showConfigPage: () => { dispatch(actions.showConfigPage()) }, - showNetworkDropdown: () => {dispatch(actions.showNetworkDropdown())}, - hideNetworkDropdown: () => {dispatch(actions.hideNetworkDropdown())}, + showNetworkDropdown: () => { dispatch(actions.showNetworkDropdown()) }, + hideNetworkDropdown: () => { dispatch(actions.hideNetworkDropdown()) }, } } @@ -49,7 +50,6 @@ NetworkDropdown.prototype.render = function () { const props = this.props const { provider: { type: providerType, rpcTarget: activeNetwork } } = props const rpcList = props.frequentRpcList - const state = this.state || {} const isOpen = this.props.networkDropdownOpen return h(Dropdown, { @@ -135,7 +135,7 @@ NetworkDropdown.prototype.render = function () { { key: 'rinkeby', closeMenu: () => this.props.hideNetworkDropdown(), - onClick: () => propssetProviderType('rinkeby'), + onClick: () => props.setProviderType('rinkeby'), style: { fontSize: '18px', }, -- cgit