on d760cbf help sign in
bridge/src/views/Reticket/Download.js
35 lines 972 B history raw
1import React, { useState, useCallback } from 'react';
2import { Nothing } from 'folktale/maybe';
4import View from 'components/View';
5import { ForwardButton, DownloadButton } from 'components/Buttons';
7import { useLocalRouter } from 'lib/LocalRouter';
8import { downloadWallet } from 'lib/invite';
10export default function Download({ newWallet }) {
11 const { push, names } = useLocalRouter();
13 const [hasDownloaded, setHasDownloaded] = useState(false);
15 const doDownload = () => {
16 downloadWallet(newWallet.value.paper);
17 setHasDownloaded(true);
18 };
20 const next = useCallback(() => push(names.VERIFY), [push, names]);
22 return (
23 <View>
24 Download the thing, and keep it somewhere safe!
25 <DownloadButton
26 disabled={Nothing.hasInstance(newWallet)}
27 onClick={doDownload}>
28 Download
29 </DownloadButton>
30 <ForwardButton disabled={!hasDownloaded} onClick={next}>
31 Continue
32 </ForwardButton>
33 </View>
34 );