1import React, { useCallback, useState } from 'react';
2import { P, H4, H5, Grid, Text, Button, Flex, LinkButton } from 'indigo-react';
4import { version } from '../../package.json';
6import { useHistory } from 'store/history';
7import { useWallet } from 'store/wallet';
8import { usePointCursor } from 'store/pointCursor';
10import { WALLET_TYPES } from 'lib/wallet';
11import { COMMANDS, useFlowCommand } from 'lib/flowCommand';
13import View from 'components/View';
14import Tabs from 'components/Tabs';
15import Crumbs from 'components/Crumbs';
16import Footer from 'components/Footer';
17import { ForwardButton, OfflineButton } from 'components/Buttons';
19import Ticket from './Login/Ticket';
20import Other from './Login/Other';
28 [NAMES.TICKET]: Ticket,
33 { text: 'Master Ticket', value: NAMES.TICKET },
34 { text: 'Other', value: NAMES.OTHER },
37const walletTypeToViewName = walletType => {
38 if (walletType === WALLET_TYPES.TICKET || !walletType) {
44export default function Login() {
46 const { pop, push, names } = useHistory();
47 const { walletType } = useWallet();
48 const { setPointCursor } = usePointCursor();
49 const flow = useFlowCommand();
52 const [isOther, setisOther] = useState(false);
54 const goToActivate = useCallback(() => push(names.ACTIVATE), [
59 const goHome = useCallback(() => {
64 case COMMANDS.TAKE_LOCKUP:
65 push(names.ACCEPT_LOCKUP);
69 throw new Error('unimplemented flow ' + flow.kind);
72 }, [flow, push, names]);
74 const flowDescription = command => {
75 switch (command.kind) {
76 case COMMANDS.TAKE_LOCKUP:
77 //TODO kind of want "sign in as 0xabc.." here...
78 return <>To accept a star lockup batch, please sign in.</>;
80 return <>Flow: {command.kind}</>;
87 <Grid.Item full as={Text} className="flex justify-center mt9 mb7">
88 <Grid.Item as={Text} className="gray3">
91 <Grid.Item as={Text}>Login</Grid.Item>
94 <Grid.Item full as={Text} className="t-center mb4">
95 {flowDescription(flow)}
98 <Grid.Item full as={isOther ? Other : Ticket} goHome={goHome} />
101 <Grid.Item full className="t-center mv4 gray4">
107 className="b-solid b1 b-black"
109 onClick={() => setisOther(true)}>
110 Metamask, Mnemonic, Hardware Wallet...
115 onClick={goToActivate}
116 className="mv10 t-center f6">
117 <span className="gray4">New Urbit ID? </span>
118 <LinkButton>Activate</LinkButton>
126 onClick={() => setisOther(false)}
128 className="t-center underline f6 mt8">
135 <Flex className="mb8 f6" justify="between">
138 href="https://github.com/urbit/bridge/releases"
139 className="us-none pointer">
140 <span className="underline">Offline</span> ↗
142 <Flex.Item className="gray4">v{version}</Flex.Item>
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