on c19b2a8 help sign in
bridge/src/views/Admin/Reticket/ReticketDownload.js
39 lines 1.1 kB history raw
1import React, { useState, useCallback } from 'react';
2import { Nothing } from 'folktale/maybe';
3import { Grid, Text } from 'indigo-react';
5import { useLocalRouter } from 'lib/LocalRouter';
6import { downloadWallet } from 'lib/invite';
8import { ForwardButton, DownloadButton } from 'components/Buttons';
10export default function ReticketDownload({ newWallet }) {
11 const { push, names } = useLocalRouter();
13 const [downloaded, setDownloaded] = useState(false);
15 const download = () => {
16 downloadWallet(newWallet.value.paper);
17 setDownloaded(true);
18 };
20 const goVerify = useCallback(() => push(names.VERIFY), [push, names]);
22 return (
23 <Grid className="mt4">
24 <Grid.Item full as={Text}>
25 Download the new passport, and keep it somewhere safe!
26 </Grid.Item>
27 <Grid.Item
28 full
29 as={!downloaded ? DownloadButton : ForwardButton}
30 className="mt4"
31 disabled={Nothing.hasInstance(newWallet)}
32 onClick={!downloaded ? download : goVerify}
33 success={downloaded}
34 solid>
35 {!downloaded ? 'Download Passport' : 'Continue'}
36 </Grid.Item>
37 </Grid>
38 );