on 35f671e help sign in
bridge/src/views/Admin.js
69 lines 2.0 kB history raw
1import React, { useCallback } from 'react';
2import { Just } from 'folktale/maybe';
3import * as need from 'lib/need';
4import { Grid } from 'indigo-react';
6import { usePointCursor } from 'store/pointCursor';
7// import { usePointCache } from 'store/pointCache';
9import View from 'components/View';
10import Passport from 'components/Passport';
11import { ForwardButton } from 'components/Buttons';
13import useInvites from 'lib/useInvites';
14import { ROUTE_NAMES } from 'lib/routeNames';
16import { useHistory } from 'store/history';
17import { useWallet } from 'store/wallet';
18import FooterButton from 'components/FooterButton';
20export default function Admin() {
21 const history = useHistory();
22 const { urbitWallet } = useWallet();
23 const { pointCursor } = usePointCursor();
24 // const { pointCache } = usePointCache();
26 const point = need.point(pointCursor);
28 // fetch the invites for the current cursor
29 const { availableInvites } = useInvites(point);
31 const goRedownload = useCallback(() => history.push(ROUTE_NAMES.REDOWNLOAD), [
32 history,
33 ]);
35 const goReticket = useCallback(() => history.push(ROUTE_NAMES.RETICKET), [
36 history,
37 ]);
39 // const pointDetails = need.fromPointCache(pointCache, point);
41 const canDownloadPassport = Just.hasInstance(urbitWallet);
43 return (
44 <View>
45 <Grid className="pt2">
46 <Grid.Item full>
47 <ForwardButton
48 disabled={!canDownloadPassport}
49 onClick={goRedownload}
50 detail="Re-download your paper wallet">
51 Download Passport
52 </ForwardButton>
53 </Grid.Item>
54 <Grid.Divider />
55 <Grid.Item full>
56 <ForwardButton
57 onClick={goReticket}
58 detail="//TODO disable if not logged in as owner">
59 Reticket
60 </ForwardButton>
61 </Grid.Item>
62 </Grid>
64 <FooterButton detail="Transfer this identity to a new owner" disabled>
65 Transfer
66 </FooterButton>
67 </View>
68 );