on e7ae14d help sign in
bridge/src/components/DownloadKeyfileButton.js
53 lines 1.5 kB history raw
1import React from 'react';
2import { Flex, B } from 'indigo-react';
4import { usePointCursor } from 'store/pointCursor';
6import useKeyfileGenerator from 'lib/useKeyfileGenerator';
7import * as need from 'lib/need';
9import { DownloadButton } from 'components/Buttons';
11export default function DownloadKeyfileButton({
12 networkSeed,
13 className,
14 ...rest
15}) {
16 const { pointCursor } = usePointCursor();
17 const _point = need.point(pointCursor);
19 const { generating, available, downloaded, download } = useKeyfileGenerator(
20 _point,
21 networkSeed
22 );
24 return (
25 <DownloadButton
26 as="span"
27 className={className}
28 disabled={downloaded || !available}
29 disabledDetail={
30 !generating &&
31 !available && (
32 // TODO: make this a toggle-able 'help' or something
33 <Flex col>
34 <Flex.Item as={B} className="wrap ws-normal">
35 · You are using nondeterministic networking keys. To download your
36 Arvo keyfile, either:
37 </Flex.Item>
38 <Flex.Item as={B} className="wrap ws-normal">
39 a) Reset your networking keys, or
40 </Flex.Item>
41 <Flex.Item as={B} className="wrap ws-normal">
42 b) Reticket to get deterministic networking keys.
43 </Flex.Item>
44 </Flex>
45 )
46 }
47 loading={generating}
48 onClick={download}
49 {...rest}>
50 Download Arvo Keyfile
51 </DownloadButton>
52 );