@@ -1,14 +1,10 @@
1import React, { useCallback, useState } from 'react';
1import React, { useCallback, useState } from 'react';
2−import { Just, Nothing } from 'folktale/maybe';
2+import { Nothing } from 'folktale/maybe';
3−import * as azimuth from 'azimuth-js';
4import { H4, Grid } from 'indigo-react';
3import { H4, Grid } from 'indigo-react';
6import { useHistory } from 'store/history';
5import { useHistory } from 'store/history';
7−import { useNetwork } from 'store/network';
8import { useWallet } from 'store/wallet';
6import { useWallet } from 'store/wallet';
9−import { usePointCursor } from 'store/pointCursor';
11−import * as need from 'lib/need';
12import { WALLET_TYPES } from 'lib/wallet';
8import { WALLET_TYPES } from 'lib/wallet';
14import View from 'components/View';
10import View from 'components/View';
@@ -64,11 +60,7 @@ const walletTypeToViewName = walletType => {
64export default function Login() {
60export default function Login() {
65 // globals
61 // globals
66 const { pop, push, names } = useHistory();
62 const { pop, push, names } = useHistory();
67− const { contracts } = useNetwork();
68 const { wallet, walletType } = useWallet();
63 const { wallet, walletType } = useWallet();
69− const { pointCursor, setPointCursor } = usePointCursor();
71− const [deducing, setDeducing] = useState(false);
74 const [currentTab, setCurrentTab] = useState(
66 const [currentTab, setCurrentTab] = useState(
@@ -80,45 +72,10 @@ export default function Login() {
80 names.ACTIVATE,
72 names.ACTIVATE,
83− const goToPoints = useCallback(() => {
75+ const doContinue = useCallback(() => {
84 push(names.POINTS);
76 push(names.POINTS);
85 }, [push, names]);
77 }, [push, names]);
87− const goToPoint = useCallback(() => {
90− }, [goToPoints, push, names]);
92− const doContinue = useCallback(async () => {
93− const _wallet = need.wallet(wallet);
94− const _contracts = need.contracts(contracts);
98− let deduced = pointCursor;
99− // if no point cursor set by login logic, try to deduce it
100− if (Nothing.hasInstance(deduced)) {
101− const owned = await azimuth.azimuth.getOwnedPoints(
105− if (owned.length === 1) {
106− deduced = Just(owned[0]);
112− // if we have a deduced point or one in the global context,
113− // navigate to that specific point, otherwise navigate to list of points
114− if (Just.hasInstance(deduced)) {
115− setPointCursor(deduced);
120− }, [contracts, pointCursor, setPointCursor, wallet, goToPoint, goToPoints]);
123 <View pop={pop} inset>
80 <View pop={pop} inset>
@@ -142,8 +99,7 @@ export default function Login() {
142 as={ForwardButton}
99 as={ForwardButton}
144 className="mt2"
101 className="mt2"
146− disabled={Nothing.hasInstance(wallet) || deducing}
102+ disabled={Nothing.hasInstance(wallet)}
147 onClick={doContinue}>
103 onClick={doContinue}>
149 </Grid.Item>
105 </Grid.Item>