import React, { useCallback, useState } from 'react'; import { Grid, Text, Button, Flex, LinkButton } from 'indigo-react'; import { version } from '../../package.json'; import { useHistory } from 'store/history'; import { COMMANDS, useFlowCommand } from 'lib/flowCommand'; import View from 'components/View'; import Footer from 'components/Footer'; import Ticket from './Login/Ticket'; import Other from './Login/Other'; export default function Login() { // globals const { push, names } = useHistory(); const flow = useFlowCommand(); // inputs const [isOther, setisOther] = useState(false); const goToActivate = useCallback(() => push(names.ACTIVATE), [ push, names.ACTIVATE, ]); const goHome = useCallback(() => { if (!flow) { push(names.POINTS); } else { switch (flow.kind) { case COMMANDS.TAKE_LOCKUP: push(names.ACCEPT_LOCKUP); break; // case COMMANDS.BITCOIN: push(names.BITCOIN_SIGN_TRANSACTION); break; // case COMMANDS.XPUB: push(names.BITCOIN_XPUB); break; // default: throw new Error('unimplemented flow ' + flow.kind); } } }, [flow, push, names]); const flowDescription = command => { switch (command.kind) { case COMMANDS.TAKE_LOCKUP: //TODO kind of want "sign in as 0xabc.." here... return <>To accept a star lockup batch, please sign in.; // case COMMANDS.BITCOIN: return <>To sign a Bitcoin transaction, please sign in.; // case COMMANDS.XPUB: return <>To view your Bitcoin extended public key, please sign in.; // default: return <>Flow: {command.kind}; } }; return ( Urbit ID /  Login {flow && ( {flowDescription(flow)} )} {!isOther && ( <> or setisOther(true)}> Metamask, Mnemonic, Hardware Wallet... {!flow && ( New Urbit ID? Activate )} )} {isOther && ( setisOther(false)} full className="t-center underline f6 mt8"> Back )} ); }