on c17dcfd help sign in
bridge/src/views/Admin.js
65 lines 1.8 kB history raw
1import React, { useCallback } from 'react';
2import { Just } from 'folktale/maybe';
3import { Grid } from 'indigo-react';
5import View from 'components/View';
6import { ForwardButton } from 'components/Buttons';
8import { ROUTE_NAMES } from 'lib/routeNames';
10import { useHistory } from 'store/history';
11import { useWallet } from 'store/wallet';
12import FooterButton from 'components/FooterButton';
14export default function Admin() {
15 const history = useHistory();
16 const { urbitWallet } = useWallet();
18 const goRedownload = useCallback(() => history.push(ROUTE_NAMES.REDOWNLOAD), [
19 history,
20 ]);
22 const goReticket = useCallback(() => history.push(ROUTE_NAMES.RETICKET), [
23 history,
24 ]);
26 const goEditPerms = useCallback(() => history.push(ROUTE_NAMES.PERMISSIONS), [
27 history,
28 ]);
30 const canDownloadPassport = Just.hasInstance(urbitWallet);
32 return (
33 <View>
34 <Grid className="pt3">
35 <Grid.Item full>
36 <ForwardButton
37 disabled={!canDownloadPassport}
38 onClick={goRedownload}
39 detail="Re-download your paper wallet">
40 Download Passport
41 </ForwardButton>
42 </Grid.Item>
43 <Grid.Divider />
44 <Grid.Item full>
45 <ForwardButton
46 onClick={goReticket}
47 detail="//TODO disable if not logged in as owner">
48 Reticket
49 </ForwardButton>
50 </Grid.Item>
51 <Grid.Item full>
52 <ForwardButton
53 onClick={goEditPerms}
54 detail="Management, networking keys, etc.">
55 Edit permissions
56 </ForwardButton>
57 </Grid.Item>
58 </Grid>
60 <FooterButton detail="Transfer this identity to a new owner" disabled>
61 Transfer
62 </FooterButton>
63 </View>
64 );