on master help sign in
Disable admin page until point in pointCache
2253aefFang
src/views/Point.js+6−1
@@ -4,6 +4,7 @@ import * as need from 'lib/need';
4import { Grid } from 'indigo-react';
4import { Grid } from 'indigo-react';
5
5
6import { usePointCursor } from 'store/pointCursor';
6import { usePointCursor } from 'store/pointCursor';
7+import { usePointCache } from 'store/pointCache';
7import { useHistory } from 'store/history';
8import { useHistory } from 'store/history';
8
9
9import View from 'components/View';
10import View from 'components/View';
@@ -22,9 +23,11 @@ import { useWallet } from 'store/wallet';
22export default function Point() {
23export default function Point() {
23 const history = useHistory();
24 const history = useHistory();
24 const { pointCursor } = usePointCursor();
25 const { pointCursor } = usePointCursor();
26+ const { pointCache } = usePointCache();
25 const { wallet } = useWallet();
27 const { wallet } = useWallet();
26
28
27 const point = need.point(pointCursor);
29 const point = need.point(pointCursor);
30+ const hasInCache = point in pointCache;
28
31
29 // fetch the invites for the current cursor
32 // fetch the invites for the current cursor
30 const { availableInvites } = useInvites(point);
33 const { availableInvites } = useInvites(point);
@@ -46,7 +49,9 @@ export default function Point() {
46 <Passport point={Maybe.Just(point)} />
49 <Passport point={Maybe.Just(point)} />
47 <Grid className="pt2">
50 <Grid className="pt2">
48 <Grid.Item full>
51 <Grid.Item full>
49− <ForwardButton onClick={goAdmin}>Admin</ForwardButton>
52+ <ForwardButton disabled={!hasInCache} onClick={goAdmin}>
53+ Admin
54+ </ForwardButton>
50 </Grid.Item>
55 </Grid.Item>
51 <Grid.Divider />
56 <Grid.Divider />
52 <Grid.Item full>
57 <Grid.Item full>