1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

fix account selection

This commit is contained in:
brunobar79 2018-07-13 15:19:21 -04:00
parent 5399546388
commit 55382e9842
2 changed files with 11 additions and 3 deletions

View File

@ -59,8 +59,11 @@ class ConnectHardwareForm extends Component {
const newState = {} const newState = {}
// Default to the first account // Default to the first account
if (this.state.selectedAccount === null) { if (this.state.selectedAccount === null) {
const firstAccount = accounts[0] accounts.forEach((a, i) => {
newState.selectedAccount = firstAccount.index.toString() === '0' ? firstAccount.index.toString() : null if (a.address.toLowerCase() === this.props.address) {
newState.selectedAccount = a.index.toString()
}
})
// If the page doesn't contain the selected account, let's deselect it // If the page doesn't contain the selected account, let's deselect it
} else if (!accounts.filter(a => a.index.toString() === this.state.selectedAccount).length) { } else if (!accounts.filter(a => a.index.toString() === this.state.selectedAccount).length) {
newState.selectedAccount = null newState.selectedAccount = null
@ -167,6 +170,7 @@ ConnectHardwareForm.propTypes = {
t: PropTypes.func, t: PropTypes.func,
network: PropTypes.string, network: PropTypes.string,
accounts: PropTypes.object, accounts: PropTypes.object,
address: PropTypes.string,
} }
const mapStateToProps = state => { const mapStateToProps = state => {

View File

@ -242,7 +242,7 @@
&__item__index { &__item__index {
display: flex; display: flex;
margin-right: 20px; width: 28px;
} }
&__item__radio { &__item__radio {
@ -337,4 +337,8 @@
width: 150px; width: 150px;
min-width: initial; min-width: initial;
} }
&__button.btn-primary--disabled {
cursor: 'not-allowed';
}
} }