@@ -1,19 +1,29 @@
1import React, { useCallback } from 'react';
1import React, { useCallback } from 'react';
2import { Just } from 'folktale/maybe';
2import { Just } from 'folktale/maybe';
3import { Grid } from 'indigo-react';
3import { Grid } from 'indigo-react';
4+import * as need from 'lib/need';
5import View from 'components/View';
6import View from 'components/View';
6import { ForwardButton } from 'components/Buttons';
7import { ForwardButton } from 'components/Buttons';
8import { ROUTE_NAMES } from 'lib/routeNames';
9import { ROUTE_NAMES } from 'lib/routeNames';
10+import { eqAddr } from 'lib/wallet';
10import { useHistory } from 'store/history';
12import { useHistory } from 'store/history';
11import { useWallet } from 'store/wallet';
13import { useWallet } from 'store/wallet';
14+import { usePointCursor } from 'store/pointCursor';
15+import { usePointCache } from 'store/pointCache';
12import FooterButton from 'components/FooterButton';
16import FooterButton from 'components/FooterButton';
14export default function Admin() {
18export default function Admin() {
15 const history = useHistory();
19 const history = useHistory();
16− const { urbitWallet } = useWallet();
20+ const { urbitWallet, wallet } = useWallet();
21+ const { pointCursor } = usePointCursor();
22+ const { pointCache } = usePointCache();
24+ const point = need.point(pointCursor);
25+ const pointDetails = need.fromPointCache(pointCache, point);
26+ const userAddress = need.wallet(wallet).address;
18 const goRedownload = useCallback(() => history.push(ROUTE_NAMES.REDOWNLOAD), [
28 const goRedownload = useCallback(() => history.push(ROUTE_NAMES.REDOWNLOAD), [
@@ -27,7 +37,12 @@ export default function Admin() {
40+ const goTransfer = useCallback(() => history.push(ROUTE_NAMES.TRANSFER), [
30 const canDownloadPassport = Just.hasInstance(urbitWallet);
44 const canDownloadPassport = Just.hasInstance(urbitWallet);
45+ const isOwner = eqAddr(userAddress, pointDetails.owner);
@@ -57,7 +72,10 @@ export default function Admin() {
57 </Grid.Item>
72 </Grid.Item>
60− <FooterButton detail="Transfer this identity to a new owner" disabled>
76+ detail="Transfer this identity to a new owner"
78+ onClick={goTransfer}>
62 </FooterButton>
80 </FooterButton>