on master help sign in
Merge pull request #207 from urbit/mino-no-landing

Remove the landing page

commit56fd4723964e08220371a0748e78df9d454e754f authorFang <Fang-@users.noreply.github.com> dateTue 23 Jul 2019, 21:24 (7 years ago) parenta77fa978057f71
4 files changed+18−71
src/Bridge.js+15−11 src/lib/router.js−2 src/views/Disclaimer.js+3−3 src/views/Landing.js−55
src/Bridge.js+15−11
@@ -13,6 +13,7 @@ import { NETWORK_TYPES } from 'lib/network';
1313import { walletFromMnemonic } from 'lib/wallet';
1414import { isDevelopment } from 'lib/flags';
1515import { hasDisclaimed } from 'lib/disclaimerCookie';
16+import useImpliedTicket from 'lib/useImpliedTicket';
1617
1718import 'style/index.scss';
1819
@@ -23,16 +24,6 @@ const INITIAL_NETWORK_TYPE = isDevelopment
2324// NB(shrugs): modify these variables to change the default local state.
2425const SHOULD_STUB_LOCAL = process.env.REACT_APP_STUB_LOCAL === 'true';
2526const 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 }];
3627
3728const INITIAL_WALLET = IS_STUBBED
3829 ? walletFromMnemonic(
@@ -46,11 +37,24 @@ const INITIAL_MNEMONIC = IS_STUBBED
4637const INITIAL_POINT_CURSOR = IS_STUBBED ? Just(65792) : Nothing();
4738
4839function 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+
4953 return (
5054 <Provider
5155 views={ROUTES}
5256 names={ROUTE_NAMES}
53− initialRoutes={INITIAL_ROUTES}
57+ initialRoutes={initialRoutes}
5458 initialNetworkType={INITIAL_NETWORK_TYPE}
5559 initialWallet={INITIAL_WALLET}
5660 initialMnemonic={INITIAL_MNEMONIC}
src/lib/router.js−2
@@ -1,4 +1,3 @@
1−import Landing from 'views/Landing';
21import Disclaimer from 'views/Disclaimer';
32import Login from 'views/Login.js';
43import Admin from 'views/Admin';
@@ -16,7 +15,6 @@ import PartySetPoolSize from 'views/Party/PartySetPoolSize';
1615import { ROUTE_NAMES } from './routeNames';
1716
1817export const ROUTES = {
19− [ROUTE_NAMES.LANDING]: Landing,
2018 [ROUTE_NAMES.DISCLAIMER]: Disclaimer,
2119 [ROUTE_NAMES.ACTIVATE]: Activate,
2220 [ROUTE_NAMES.VIEW_POINT]: ViewPoint,
src/views/Disclaimer.js+3−3
@@ -13,7 +13,7 @@ import WarningBox from 'components/WarningBox';
1313const TEXT_STYLE = 'f5';
1414
1515export default function ActivateDisclaimer() {
16− const { popAndPush, names } = useHistory();
16+ const { pop } = useHistory();
1717 const [understoodInput, { data: isUnderstood }] = useCheckboxInput({
1818 name: 'checkbox',
1919 label: 'I acknowledge and understand these rights',
@@ -21,8 +21,8 @@ export default function ActivateDisclaimer() {
2121
2222 const goToPassport = useCallback(() => {
2323 setDisclaimerCookie();
24− popAndPush(names.LANDING);
25− }, [popAndPush, names]);
24+ pop();
25+ }, [pop]);
2626
2727 return (
2828 <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;