1import React, { useCallback, useState } from 'react';
2import { P, H4, H5, Grid, Text, Button, Flex, LinkButton } from 'indigo-react';
3import { Just } from 'folktale/maybe';
4import ob from 'urbit-ob';
6import { version } from '../../package.json';
8import { useHistory } from 'store/history';
9import { useWallet } from 'store/wallet';
10import { usePointCursor } from 'store/pointCursor';
12import { WALLET_TYPES } from 'lib/wallet';
13import { COMMANDS, useFlowCommand } from 'lib/flowCommand';
15import View from 'components/View';
16import Tabs from 'components/Tabs';
17import Crumbs from 'components/Crumbs';
18import Footer from 'components/Footer';
19import { ForwardButton, OfflineButton } from 'components/Buttons';
21import Ticket from './Login/Ticket';
22import Other from './Login/Other';
30 [NAMES.TICKET]: Ticket,
35 { text: 'Master Ticket', value: NAMES.TICKET },
36 { text: 'Other', value: NAMES.OTHER },
39const walletTypeToViewName = walletType => {
40 if (walletType === WALLET_TYPES.TICKET || !walletType) {
46export default function Login() {
48 const { pop, push, names } = useHistory();
49 const { walletType } = useWallet();
50 const { setPointCursor } = usePointCursor();
51 const flow = useFlowCommand();
54 const [isOther, setisOther] = useState(false);
56 const goToActivate = useCallback(() => push(names.ACTIVATE), [
61 const goHome = useCallback(() => {
67 setPointCursor(Just(ob.patp2dec(flow.as)));
68 push(names.JUST_INVITE);
72 throw new Error('unimplemented flow ' + flow.kind);
76 }, [flow, push, names]);
78 const flowDescription = command => {
79 switch (command.kind) {
83 To send an invite, please sign in as <b>{command.as}</b>.
93 <Grid.Item full as={Text} className="flex justify-center mt9 mb7">
94 <Grid.Item as={Text} className="gray3">
97 <Grid.Item as={Text}>Login</Grid.Item>
100 <Grid.Item full as={Text} className="t-center mb4">
101 {flowDescription(flow)}
104 <Grid.Item full as={isOther ? Other : Ticket} goHome={goHome} />
107 <Grid.Item full className="t-center mv4 gray4">
113 className="b-solid b1 b-black"
115 onClick={() => setisOther(true)}>
116 Metamask, Mnemonic, Hardware Wallet...
121 onClick={goToActivate}
122 className="mv10 t-center f6">
123 <span className="gray4">New Urbit ID? </span>
124 <LinkButton>Activate</LinkButton>
132 onClick={() => setisOther(false)}
134 className="t-center underline f6 mt8">
141 <Flex className="mb8 f6" justify="between">
144 href="https://github.com/urbit/bridge/releases"
145 className="us-none pointer">
146 <span className="underline">Offline</span> ↗
148 <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