on master help sign in
Merge pull request #207 from urbit/mino-no-landing
56fd472Fang
src/Bridge.js+15−11
@@ -13,6 +13,7 @@ import { NETWORK_TYPES } from 'lib/network';
13import { walletFromMnemonic } from 'lib/wallet';
13import { walletFromMnemonic } from 'lib/wallet';
14import { isDevelopment } from 'lib/flags';
14import { isDevelopment } from 'lib/flags';
15import { hasDisclaimed } from 'lib/disclaimerCookie';
15import { hasDisclaimed } from 'lib/disclaimerCookie';
16+import useImpliedTicket from 'lib/useImpliedTicket';
16
17
17import 'style/index.scss';
18import 'style/index.scss';
18
19
@@ -23,16 +24,6 @@ const INITIAL_NETWORK_TYPE = isDevelopment
23// NB(shrugs): modify these variables to change the default local state.
24// NB(shrugs): modify these variables to change the default local state.
24const SHOULD_STUB_LOCAL = process.env.REACT_APP_STUB_LOCAL === 'true';
25const SHOULD_STUB_LOCAL = process.env.REACT_APP_STUB_LOCAL === 'true';
25const IS_STUBBED = isDevelopment && SHOULD_STUB_LOCAL;
26const IS_STUBBED = isDevelopment && SHOULD_STUB_LOCAL;
26−const INITIAL_ROUTES = IS_STUBBED
27− ? [
28− { key: ROUTE_NAMES.LANDING },
29− { key: ROUTE_NAMES.LOGIN },
30− { key: ROUTE_NAMES.POINTS },
31− { key: ROUTE_NAMES.POINT },
32− ]
33− : hasDisclaimed()
34− ? [{ key: ROUTE_NAMES.LANDING }]
35− : [{ key: ROUTE_NAMES.DISCLAIMER }];
36
27
37const INITIAL_WALLET = IS_STUBBED
28const INITIAL_WALLET = IS_STUBBED
38 ? walletFromMnemonic(
29 ? walletFromMnemonic(
@@ -46,11 +37,24 @@ const INITIAL_MNEMONIC = IS_STUBBED
46const INITIAL_POINT_CURSOR = IS_STUBBED ? Just(65792) : Nothing();
37const INITIAL_POINT_CURSOR = IS_STUBBED ? Just(65792) : Nothing();
47
38
48function Bridge() {
39function Bridge() {
40+ const landingPage = !!useImpliedTicket()
41+ ? ROUTE_NAMES.ACTIVATE
42+ : ROUTE_NAMES.LOGIN;
43+ const initialRoutes = IS_STUBBED
44+ ? [
45+ { key: ROUTE_NAMES.LOGIN },
46+ { key: ROUTE_NAMES.POINTS },
47+ { key: ROUTE_NAMES.POINT },
48+ ]
49+ : hasDisclaimed()
50+ ? [{ key: landingPage }]
51+ : [{ key: landingPage }, { key: ROUTE_NAMES.DISCLAIMER }];
52+
49 return (
53 return (
50 <Provider
54 <Provider
51 views={ROUTES}
55 views={ROUTES}
52 names={ROUTE_NAMES}
56 names={ROUTE_NAMES}
53− initialRoutes={INITIAL_ROUTES}
57+ initialRoutes={initialRoutes}
54 initialNetworkType={INITIAL_NETWORK_TYPE}
58 initialNetworkType={INITIAL_NETWORK_TYPE}
55 initialWallet={INITIAL_WALLET}
59 initialWallet={INITIAL_WALLET}
56 initialMnemonic={INITIAL_MNEMONIC}
60 initialMnemonic={INITIAL_MNEMONIC}
src/lib/router.js−2
@@ -1,4 +1,3 @@
1−import Landing from 'views/Landing';
2import Disclaimer from 'views/Disclaimer';
1import Disclaimer from 'views/Disclaimer';
3import Login from 'views/Login.js';
2import Login from 'views/Login.js';
4import Admin from 'views/Admin';
3import Admin from 'views/Admin';
@@ -16,7 +15,6 @@ import PartySetPoolSize from 'views/Party/PartySetPoolSize';
16import { ROUTE_NAMES } from './routeNames';
15import { ROUTE_NAMES } from './routeNames';
17
16
18export const ROUTES = {
17export const ROUTES = {
19− [ROUTE_NAMES.LANDING]: Landing,
20 [ROUTE_NAMES.DISCLAIMER]: Disclaimer,
18 [ROUTE_NAMES.DISCLAIMER]: Disclaimer,
21 [ROUTE_NAMES.ACTIVATE]: Activate,
19 [ROUTE_NAMES.ACTIVATE]: Activate,
22 [ROUTE_NAMES.VIEW_POINT]: ViewPoint,
20 [ROUTE_NAMES.VIEW_POINT]: ViewPoint,
src/views/Disclaimer.js+3−3
@@ -13,7 +13,7 @@ import WarningBox from 'components/WarningBox';
13const TEXT_STYLE = 'f5';
13const TEXT_STYLE = 'f5';
14
14
15export default function ActivateDisclaimer() {
15export default function ActivateDisclaimer() {
16− const { popAndPush, names } = useHistory();
16+ const { pop } = useHistory();
17 const [understoodInput, { data: isUnderstood }] = useCheckboxInput({
17 const [understoodInput, { data: isUnderstood }] = useCheckboxInput({
18 name: 'checkbox',
18 name: 'checkbox',
19 label: 'I acknowledge and understand these rights',
19 label: 'I acknowledge and understand these rights',
@@ -21,8 +21,8 @@ export default function ActivateDisclaimer() {
21
21
22 const goToPassport = useCallback(() => {
22 const goToPassport = useCallback(() => {
23 setDisclaimerCookie();
23 setDisclaimerCookie();
24− popAndPush(names.LANDING);
24+ pop();
25− }, [popAndPush, names]);
25+ }, [pop]);
26
26
27 return (
27 return (
28 <View>
28 <View>
src/views/Landing.jsdeleted−55
@@ -1,55 +0,0 @@
1−import React from 'react';
2−import { H1, P } from 'indigo-react';
3−
4−import { useHistory } from '../store/history';
5−import useImpliedPoint from 'lib/useImpliedPoint';
6−import useImpliedTicket from 'lib/useImpliedTicket';
7−
8−import View from 'components/View';
9−import { ForwardButton } from 'components/Buttons';
10−
11−function Landing() {
12− const { push, names } = useHistory();
13−
14− const impliedPoint = useImpliedPoint();
15− const impliedTicket = useImpliedTicket();
16− if (impliedPoint) {
17− push(names.LOGIN);
18− } else if (impliedTicket) {
19− push(names.ACTIVATE);
20− }
21−
22− return (
23− <View>
24− <H1>Welcome</H1>
25−
26− <P>
27− Bridge is a tool for managing and viewing assets on Azimuth, the Urbit
28− address space.
29− </P>
30−
31− <ForwardButton
32− className="mt3"
33− detail="If you were sent an Azimuth invite code."
34− onClick={() => push(names.ACTIVATE)}>
35− Activate a Point
36− </ForwardButton>
37−
38− <ForwardButton
39− className="mt3"
40− detail="Login to an activated point."
41− onClick={() => push(names.LOGIN)}>
42− Login
43− </ForwardButton>
44−
45− <ForwardButton
46− className="mt3"
47− detail="View an Azimuth point without signing into a wallet."
48− onClick={() => push(names.VIEW_POINT)}>
49− View a Point
50− </ForwardButton>
51− </View>
52− );
53−}
54−
55−export default Landing;