on 04765bb help sign in
bridge/src/views/Login/Advanced.js
115 lines 3.0 kB history raw
1import React from 'react';
2import { P, InnerLabelDropdown } from '../../components/old/Base';
3import { Row, Col } from '../../components/old/Base';
5import Ticket from './Ticket';
6import Shards from './Shards';
7import Ledger from './Ledger';
8import Trezor from './Trezor';
9import Mnemonic from './Mnemonic';
10import PrivateKey from './PrivateKey';
11import Keystore from './Keystore';
13import { WALLET_TYPES, renderWalletType } from '../../lib/wallet';
14import { compose } from '../../lib/lib';
15import { withWallet } from '../../store/wallet';
17class Advanced extends React.Component {
18 constructor(props) {
19 super(props);
21 this.state = {
22 selected: WALLET_TYPES.TICKET,
23 };
25 this.handleSelection = this.handleSelection.bind(this);
26 }
28 getWalletOptions() {
29 return [
30 {
31 title: 'Urbit Master Ticket',
32 value: WALLET_TYPES.TICKET,
33 },
34 {
35 title: 'Urbit Master Ticket (Shards)',
36 value: WALLET_TYPES.SHARDS,
37 },
38 {
39 type: 'divider',
40 },
41 {
42 title: 'Ledger',
43 value: WALLET_TYPES.LEDGER,
44 },
45 {
46 title: 'Trezor',
47 value: WALLET_TYPES.TREZOR,
48 },
49 {
50 type: 'divider',
51 },
52 {
53 title: 'BIP39 Mnemonic',
54 value: WALLET_TYPES.MNEMONIC,
55 },
56 {
57 title: 'Ethereum Private Key',
58 value: WALLET_TYPES.PRIVATE_KEY,
59 },
60 {
61 title: 'Ethereum Keystore File',
62 value: WALLET_TYPES.KEYSTORE,
63 },
64 ];
65 }
67 handleSelection(selected) {
68 this.setState({ selected });
69 }
71 render() {
72 const loginCompleted = this.props.loginCompleted;
73 const inputs = (() => {
74 switch (this.state.selected) {
75 case WALLET_TYPES.TICKET:
76 return <Ticket advanced={true} loginCompleted={loginCompleted} />;
77 case WALLET_TYPES.SHARDS:
78 return <Shards loginCompleted={loginCompleted} />;
79 //
80 case WALLET_TYPES.LEDGER:
81 return <Ledger loginCompleted={loginCompleted} />;
82 case WALLET_TYPES.TREZOR:
83 return <Trezor loginCompleted={loginCompleted} />;
84 //
85 case WALLET_TYPES.MNEMONIC:
86 return <Mnemonic advanced={true} loginCompleted={loginCompleted} />;
87 case WALLET_TYPES.PRIVATE_KEY:
88 return <PrivateKey loginCompleted={loginCompleted} />;
89 case WALLET_TYPES.KEYSTORE:
90 return <Keystore loginCompleted={loginCompleted} />;
91 //
92 default:
93 return <P>{'Coming soon.'}</P>;
94 }
95 })();
97 return (
98 <Row>
99 <Col>
100 <InnerLabelDropdown
101 className={'mb-10 mt-6'}
102 title={'Wallet Type:'}
103 options={this.getWalletOptions()}
104 handleUpdate={this.handleSelection}
105 currentSelectionTitle={renderWalletType(this.state.selected)}
106 />
108 {inputs}
109 </Col>
110 </Row>
111 );
112 }
115export default compose(withWallet)(Advanced);