on e366ef3 help sign in
bridge/src/views/Wallet.js
112 lines 3.0 kB history raw
1import Maybe from 'folktale/maybe';
2import React from 'react';
3import { Button, H1, P } from '../components/old/Base';
4import { InnerLabelDropdown } from '../components/old/Base';
5import { Row, Col } from '../components/old/Base';
7import { ROUTE_NAMES } from '../lib/routeNames';
8import { withHistory } from '../store/history';
9import { WALLET_TYPES, renderWalletType } from '../lib/wallet';
10import { compose } from '../lib/lib';
11import { withWallet } from '../store/wallet';
13class Wallet extends React.Component {
14 componentDidMount() {
15 const { setWallet } = this.props;
16 setWallet(Maybe.Nothing());
17 }
19 getWalletOptions() {
20 return [
21 {
22 title: 'Urbit Master Ticket',
23 value: WALLET_TYPES.TICKET,
24 },
25 {
26 title: 'Urbit Master Ticket (Shards)',
27 value: WALLET_TYPES.SHARDS,
28 },
29 {
30 type: 'divider',
31 },
32 {
33 title: 'Ledger',
34 value: WALLET_TYPES.LEDGER,
35 },
36 {
37 title: 'Trezor',
38 value: WALLET_TYPES.TREZOR,
39 },
40 {
41 type: 'divider',
42 },
43 {
44 title: 'BIP39 Mnemonic',
45 value: WALLET_TYPES.MNEMONIC,
46 },
47 {
48 title: 'Ethereum Private Key',
49 value: WALLET_TYPES.PRIVATE_KEY,
50 },
51 {
52 title: 'Ethereum Keystore File',
53 value: WALLET_TYPES.KEYSTORE,
54 },
55 ];
56 }
58 render() {
59 const { props } = this;
60 const walletOptions = this.getWalletOptions();
62 return (
63 <Row>
64 <Col>
65 <H1>{'Unlock a Wallet'}</H1>
67 <P>
68 {`To manage your assets, you need to unlock a wallet.
69 Please select how you would like to access your wallet.`}
70 </P>
72 <InnerLabelDropdown
73 className={'mb-10 mt-6'}
74 title={'Wallet Type:'}
75 options={walletOptions}
76 handleUpdate={props.setWalletType}
77 currentSelectionTitle={renderWalletType(props.walletType)}
78 />
80 <Button
81 className={'mt-10'}
82 onClick={() =>
83 props.history.push(
84 props.walletType === WALLET_TYPES.MNEMONIC
85 ? ROUTE_NAMES.MNEMONIC
86 : props.walletType === WALLET_TYPES.TICKET
87 ? ROUTE_NAMES.TICKET
88 : props.walletType === WALLET_TYPES.SHARDS
89 ? ROUTE_NAMES.SHARDS
90 : props.walletType === WALLET_TYPES.LEDGER
91 ? ROUTE_NAMES.LEDGER
92 : props.walletType === WALLET_TYPES.TREZOR
93 ? ROUTE_NAMES.TREZOR
94 : props.walletType === WALLET_TYPES.PRIVATE_KEY
95 ? ROUTE_NAMES.PRIVATE_KEY
96 : props.walletType === WALLET_TYPES.KEYSTORE
97 ? ROUTE_NAMES.KEYSTORE
98 : ROUTE_NAMES.DEFAULT
99 )
100 }>
101 {'Continue →'}
102 </Button>
103 </Col>
104 </Row>
105 );
106 }
109export default compose(
110 withHistory,
111 withWallet
112)(Wallet);