on e7c1371 help sign in
bridge/src/components/DownloadKeyfileButton.js
54 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 const showHelp = !generating && !available;
26 return (
27 <DownloadButton
28 as="span"
29 className={className}
30 disabled={downloaded || !available}
31 disabledDetail={
32 // TODO: make this a toggle-able 'help' or something — too much space
33 showHelp && (
34 <Flex col>
35 <Flex.Item as={B} className="wrap ws-normal">
36 · You are using nondeterministic networking keys. To download your
37 Arvo keyfile, either:
38 </Flex.Item>
39 <Flex.Item as={B} className="wrap ws-normal">
40 a) Reset your networking keys, or
41 </Flex.Item>
42 <Flex.Item as={B} className="wrap ws-normal">
43 b) Reticket to get deterministic networking keys.
44 </Flex.Item>
45 </Flex>
46 )
47 }
48 loading={generating}
49 onClick={download}
50 {...rest}>
51 Download Arvo Keyfile
52 </DownloadButton>
53 );