on master help sign in
Remove the landing page

Displays login or activate directly, depending on context. Simplifies the Disclaimer routing logic so it doesn't need to know what page to send the user to.

commita15dd230bd01a013d3d15e0fa788e936e843978f authorFang <git@fang.io> dateTue 23 Jul 2019, 20:38 (7 years ago) parentcd95105
4 files changed+9−63
src/Bridge.js+6−3 src/lib/router.js−2 src/views/Disclaimer.js+3−3 src/views/Landing.js−55
src/Bridge.js+6−3
@@ -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,18 @@ 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;
27+const LANDING_PAGE = !!useImpliedTicket()
28+ ? ROUTE_NAMES.ACTIVATE
29+ : ROUTE_NAMES.LOGIN;
2630const INITIAL_ROUTES = IS_STUBBED
2731 ? [
28− { key: ROUTE_NAMES.LANDING },
2932 { key: ROUTE_NAMES.LOGIN },
3033 { key: ROUTE_NAMES.POINTS },
3134 { key: ROUTE_NAMES.POINT },
3235 ]
3336 : hasDisclaimed()
34− ? [{ key: ROUTE_NAMES.LANDING }]
35− : [{ key: ROUTE_NAMES.DISCLAIMER }];
37+ ? [{ key: LANDING_PAGE }]
38+ : [{ key: LANDING_PAGE }, { key: ROUTE_NAMES.DISCLAIMER }];
3639
3740const INITIAL_WALLET = IS_STUBBED
3841 ? walletFromMnemonic(
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;