on 04765bb help sign in
bridge/src/views/Point.js
61 lines 1.7 kB history raw
1import React, { useCallback } from 'react';
2import * as need from 'lib/need';
3import { Grid } from 'indigo-react';
5import { usePointCursor } from 'store/pointCursor';
6import { useHistory } from 'store/history';
8import View from 'components/View';
9import Passport from 'components/Passport';
10import { ForwardButton } from 'components/Buttons';
11import FooterButton from 'components/FooterButton';
12import { matchBlinky } from 'components/Blinky';
14import useInvites from 'lib/useInvites';
15import { useSyncOwnedPoints } from 'lib/useSyncPoints';
16import { ROUTE_NAMES } from 'lib/routeNames';
18import Actions from './Point/Actions';
20export default function Point() {
21 const history = useHistory();
22 const { pointCursor } = usePointCursor();
23 // const { pointCache } = usePointCache();
25 const point = need.pointCursor(pointCursor);
27 // fetch the invites for the current cursor
28 const { availableInvites } = useInvites(point);
29 const availableInvitesText = matchBlinky(availableInvites);
31 const goInvite = useCallback(() => history.push(ROUTE_NAMES.INVITE), [
32 history,
33 ]);
35 // sync the current cursor
36 useSyncOwnedPoints([point]);
38 return (
39 <View>
40 <Passport point={point} />
41 <Grid className="pt2">
42 <Grid.Item full>
43 <ForwardButton disabled>Admin</ForwardButton>
44 </Grid.Item>
45 <Grid.Divider />
46 <Grid.Item full>
47 <ForwardButton detail="Boot your computer" disabled>
48 Boot Arvo
49 </ForwardButton>
50 </Grid.Item>
51 <Grid.Item full>
52 <Actions />
53 </Grid.Item>
54 </Grid>
56 <FooterButton onClick={goInvite}>
57 Invite <sup>{availableInvitesText}</sup>
58 </FooterButton>
59 </View>
60 );