1import React, { useCallback, useState } from 'react';
2import { Grid, Text, Button, Flex, LinkButton } from 'indigo-react';
4import { version } from '../../package.json';
6import { useHistory } from 'store/history';
8import { COMMANDS, useFlowCommand } from 'lib/flowCommand';
10import View from 'components/View';
11import Footer from 'components/Footer';
13import Ticket from './Login/Ticket';
14import Other from './Login/Other';
16export default function Login() {
18 const { push, names } = useHistory();
19 const flow = useFlowCommand();
22 const [isOther, setisOther] = useState(false);
24 const goToActivate = useCallback(() => push(names.ACTIVATE), [
29 const goHome = useCallback(() => {
34 case COMMANDS.TAKE_LOCKUP:
35 push(names.ACCEPT_LOCKUP);
38 case COMMANDS.BITCOIN:
39 push(names.BITCOIN_SIGN_TRANSACTION);
43 push(names.BITCOIN_XPUB);
47 throw new Error('unimplemented flow ' + flow.kind);
50 }, [flow, push, names]);
52 const flowDescription = command => {
53 switch (command.kind) {
54 case COMMANDS.TAKE_LOCKUP:
55 //TODO kind of want "sign in as 0xabc.." here...
56 return <>To accept a star lockup batch, please sign in.</>;
58 case COMMANDS.BITCOIN:
59 return <>To sign a Bitcoin transaction, please sign in.</>;
62 return <>To view your Bitcoin extended public key, please sign in.</>;
65 return <>Flow: {command.kind}</>;
72 <Grid.Item full as={Text} className="flex justify-center mt9 mb7">
73 <Grid.Item as={Text} className="gray3">
76 <Grid.Item as={Text}>Login</Grid.Item>
79 <Grid.Item full as={Text} className="t-center mb4">
80 {flowDescription(flow)}
83 <Grid.Item full as={isOther ? Other : Ticket} goHome={goHome} />
86 <Grid.Item full className="t-center mv4 gray4">
92 className="b-solid b1 b-black"
94 onClick={() => setisOther(true)}>
95 Metamask, Mnemonic, Hardware Wallet...
100 onClick={goToActivate}
101 className="mv10 t-center f6">
102 <span className="gray4">New Urbit ID? </span>
103 <LinkButton>Activate</LinkButton>
111 onClick={() => setisOther(false)}
113 className="t-center underline f6 mt8">
120 <Flex className="mb8 f6" justify="between">
123 href="https://github.com/urbit/bridge/releases"
124 className="us-none pointer">
125 <span className="underline">Offline</span> ↗
127 <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