1import { Nothing, Just } from 'folktale/maybe';
2import React from 'react';
3import * as azimuth from 'azimuth-js';
5import { H1, Row, Col } from '../components/old/Base';
6import Tabs from '../components/Tabs';
8import Ticket from './Login/Ticket';
9import Mnemonic from './Login/Mnemonic';
10import Advanced from './Login/Advanced';
12import * as need from '../lib/need';
13import { compose } from '../lib/lib';
14import { ROUTE_NAMES } from '../lib/routeNames';
16import { withHistory } from '../store/history';
17import { withNetwork } from '../store/network';
18import { withWallet } from '../store/wallet';
19import { withPointCursor } from '../store/pointCursor';
22 TICKET: Symbol('TICKET'),
23 MNEMONIC: Symbol('MNEMONIC'),
24 ADVANCED: Symbol('ADVANCED'),
27class Login extends React.Component {
32 currentTab: TABS.TICKET,
35 this.handleTabChange = this.handleTabChange.bind(this);
36 this.continue = this.continue.bind(this);
40 // we expect wallet and pointCursor to not be set yet
41 this.props.setUrbitWallet(Nothing());
42 this.props.setWallet(Nothing());
43 this.props.setPointCursor(Nothing());
46 handleTabChange(currentTab) {
47 this.setState({ currentTab });
51 const wallet = need.wallet(this.props);
52 const contracts = need.contracts(this.props);
54 // if no point cursor set by login logic, try to deduce it
55 let deduced = Nothing();
56 if (Nothing.hasInstance(this.props.pointCursor)) {
57 const owned = await azimuth.azimuth.getOwnedPoints(
61 if (owned.length === 1) {
62 deduced = Just(owned[0]);
63 } else if (owned.length === 0) {
64 const canOwn = await azimuth.azimuth.getTransferringFor(
68 if (canOwn.length === 1) {
69 deduced = Just(canOwn[0]);
74 if (Just.hasInstance(deduced)) {
75 this.props.setPointCursor(deduced);
76 this.props.history.popAndPush(ROUTE_NAMES.POINT_HOME);
77 } else if (Just.hasInstance(this.props.pointCursor)) {
78 this.props.history.popAndPush(ROUTE_NAMES.POINT_HOME);
80 //TODO to new overview (maybe should be merged into point home?)
81 this.props.history.popAndPush(ROUTE_NAMES.SHIPS);
87 { title: 'Ticket', value: TABS.TICKET },
88 { title: 'Mnemonic', value: TABS.MNEMONIC },
89 { title: 'Advanced', value: TABS.ADVANCED },
93 [TABS.TICKET]: Ticket,
94 [TABS.MNEMONIC]: Mnemonic,
95 [TABS.ADVANCED]: Advanced,
105 tabOptions={tabOptions}
106 currentTab={this.state.currentTab}
107 onTabChange={this.handleTabChange}
109 loginCompleted={this.continue}
117export default compose(
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