@@ -12,17 +12,8 @@ import { ROUTE_NAMES } from '../lib/router'
12import { WALLET_NAMES, renderWalletType } from '../lib/wallet'
12import { WALLET_NAMES, renderWalletType } from '../lib/wallet'
14class Wallet extends React.Component {
14class Wallet extends React.Component {
16 constructor(props) {
15 constructor(props) {
17 super(props)
16 super(props)
23− this.toggle = this.toggle.bind(this)
24− this.close = this.close.bind(this)
28 componentDidMount() {
19 componentDidMount() {
@@ -30,23 +21,38 @@ class Wallet extends React.Component {
30 setWallet(Maybe.Nothing())
21 setWallet(Maybe.Nothing())
33− toggle() {
24+ getWalletOptions() {
34− this.setState((state, _) => ({
25+ return [{
35− dropdownOpen: !state.dropdownOpen
26+ title: 'Urbit Master Ticket',
36− }))
27+ value: WALLET_NAMES.TICKET
29+ title: 'Urbit Master Ticket (Shards)',
30+ value: WALLET_NAMES.SHARDS
39− selectClose(f) {
33+ }, {
40− f()
34+ title: 'Ledger',
41− this.setState({ dropdownOpen: false })
35+ value: WALLET_NAMES.LEDGER
38+ value: WALLET_NAMES.TREZOR
43−
42+ title: 'BIP39 Mnemonic',
44− close () {
43+ value: WALLET_NAMES.MNEMONIC
45− this.setState({ dropdownOpen: false })
44+ }, {
45+ title: 'Ethereum Private Key',
46+ value: WALLET_NAMES.PRIVATE_KEY
48+ title: 'Ethereum Keystore File',
49+ value: WALLET_NAMES.KEYSTORE
48 render() {
53 render() {
49 const { props, state } = this
54 const { props, state } = this
55+ const walletOptions = this.getWalletOptions()
@@ -63,60 +69,10 @@ class Wallet extends React.Component {
64 <InnerLabelDropdown
70 <InnerLabelDropdown
65 className={'mb-10 mt-6'}
71 className={'mb-10 mt-6'}
66− handleToggle={this.toggle}
67− handleClose={this.close}
68− isOpen={state.dropdownOpen}
69 title={'Wallet Type:'}
72 title={'Wallet Type:'}
73+ options={walletOptions}
74+ handleUpdate={props.setWalletType}
70 currentSelectionTitle={renderWalletType(props.walletType)}>
75 currentSelectionTitle={renderWalletType(props.walletType)}>
73− onClick={ () => this.selectClose(() => props.setWalletType(WALLET_NAMES.TICKET)) }
75− { 'Urbit Master Ticket' }
79− onClick={ () => this.selectClose(() => props.setWalletType(WALLET_NAMES.SHARDS)) }
81− { 'Urbit Master Ticket (Shards)' }
87− onClick={ () => this.selectClose(() => props.setWalletType(WALLET_NAMES.LEDGER)) }
93− onClick={ () => this.selectClose(() => props.setWalletType(WALLET_NAMES.TREZOR)) }
101− onClick={ () => this.selectClose(() => props.setWalletType(WALLET_NAMES.MNEMONIC)) }
103− { 'BIP39 Mnemonic' }
107− onClick={ () => this.selectClose(() => props.setWalletType(WALLET_NAMES.PRIVATE_KEY)) }
109− { 'Ethereum Private Key' }
113− onClick={ () => this.selectClose(() => props.setWalletType(WALLET_NAMES.KEYSTORE)) }
115− { 'Ethereum Keystore File' }
120 </InnerLabelDropdown>
76 </InnerLabelDropdown>