1import React, { useCallback, useState } from 'react';
2import { Nothing } from 'folktale/maybe';
3import { H4, Grid } from 'indigo-react';
5import { useHistory } from 'store/history';
6import { useWallet } from 'store/wallet';
8import { WALLET_TYPES } from 'lib/wallet';
10import View from 'components/View';
11import Tabs from 'components/Tabs';
12import Crumbs from 'components/Crumbs';
13import Footer from 'components/Footer';
14import { ForwardButton, OfflineButton } from 'components/Buttons';
16import Ticket from './Login/Ticket';
17import Mnemonic from './Login/Mnemonic';
18import Advanced from './Login/Advanced';
19import Hardware from './Login/Hardware';
29 [NAMES.TICKET]: Ticket,
30 [NAMES.MNEMONIC]: Mnemonic,
31 [NAMES.HARDWARE]: Hardware,
32 [NAMES.ADVANCED]: Advanced,
36 { text: 'Master Ticket', value: NAMES.TICKET },
37 { text: 'Mnemonic', value: NAMES.MNEMONIC },
38 { text: 'Hardware', value: NAMES.HARDWARE },
39 { text: 'Advanced', value: NAMES.ADVANCED },
42const walletTypeToViewName = walletType => {
44 case WALLET_TYPES.MNEMONIC:
45 return NAMES.MNEMONIC;
46 case WALLET_TYPES.LEDGER:
47 case WALLET_TYPES.TREZOR:
48 return NAMES.HARDWARE;
49 case WALLET_TYPES.KEYSTORE:
50 case WALLET_TYPES.PRIVATE_KEY:
51 return NAMES.ADVANCED;
52 case WALLET_TYPES.TICKET:
53 case WALLET_TYPES.SHARDS:
60export default function Login() {
62 const { pop, push, names } = useHistory();
63 const { wallet, walletType } = useWallet();
66 const [currentTab, setCurrentTab] = useState(
67 walletTypeToViewName(walletType)
70 const goToActivate = useCallback(() => push(names.ACTIVATE), [
75 const doContinue = useCallback(() => {
80 <View pop={pop} inset>
82 <Grid.Item full as={Crumbs} routes={[{ text: 'Bridge' }]} />
83 <Grid.Item full as={H4} className="mt4">
93 currentTab={currentTab}
94 onTabChange={setCurrentTab}
102 disabled={Nothing.hasInstance(wallet)}
103 onClick={doContinue}>
111 <Grid.Item full as={ForwardButton} onClick={goToActivate}>
115 <Grid.Item full as={OfflineButton} />
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list