A Metamask fork with Infura removed and default networks editable
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
ciphermask/development/selector.js

49 lines
1.3 KiB

import PropTypes from 'prop-types'
import React, {Component} from 'react'
export default class Selector extends Component {
state = {}
render () {
const {
states,
selectedKey,
actions,
store,
modifyBackgroundConnection,
backGroundConnectionModifiers,
} = this.props
const selected = this.state.selected || selectedKey
return (
<select
style={{ margin: '20px 20px 0px' }}
value={selected}
onChange={(event) => {
const selectedKey = event.target.value
const backgroundConnectionModifier = backGroundConnectionModifiers[selectedKey]
modifyBackgroundConnection(backgroundConnectionModifier || {})
store.dispatch(actions.update(selectedKey))
this.setState({ selected: selectedKey })
}}
>
{Object.keys(states).map((stateName, index) => {
return (
<option key={index} value={stateName}>
{stateName}
</option>
)
})}
</select>
)
}
}
Selector.propTypes = {
states: PropTypes.object.isRequired,
selectedKey: PropTypes.string.isRequired,
actions: PropTypes.object.isRequired,
store: PropTypes.object.isRequired,
modifyBackgroundConnection: PropTypes.func.isRequired,
backGroundConnectionModifiers: PropTypes.object.isRequired,
}