1import React, { useCallback } from 'react';
2import { Just } from 'folktale/maybe';
3import * as need from 'lib/need';
4import { Grid } from 'indigo-react';
5import { azimuth } from 'azimuth-js';
7import { usePointCursor } from 'store/pointCursor';
8import { useHistory } from 'store/history';
10import View from 'components/View';
11import Passport from 'components/Passport';
12import { ForwardButton, BootArvoButton } from 'components/Buttons';
13import FooterButton from 'components/FooterButton';
14import { matchBlinky } from 'components/Blinky';
16import useInvites from 'lib/useInvites';
17import { useSyncOwnedPoints } from 'lib/useSyncPoints';
19import Actions from './Point/Actions';
20import { useWallet } from 'store/wallet';
21import usePermissionsForPoint from 'lib/usePermissionsForPoint';
23export default function Point() {
24 const { push, names } = useHistory();
25 const { pointCursor } = usePointCursor();
26 const { wallet } = useWallet();
28 const point = need.point(pointCursor);
30 const { isActiveOwner, canManage } = usePermissionsForPoint(
31 // using empty string should be ok here
34 Just: p => p.value.address,
39 // fetch the invites for the current cursor
40 const { availableInvites } = useInvites(point);
42 const showActions = Just.hasInstance(wallet);
44 const goAdmin = useCallback(() => push(names.ADMIN), [push, names]);
46 const goInvite = useCallback(() => push(names.INVITE), [push, names]);
48 const goParties = useCallback(() => push(names.INVITES_MANAGE), [
53 const inviteButton = (() => {
54 switch (azimuth.getPointSize(point)) {
55 case azimuth.PointSize.Planet:
56 const availableInvitesText = matchBlinky(availableInvites);
58 <FooterButton disabled={!isActiveOwner} onClick={goInvite}>
59 Invite <sup>{availableInvitesText} available</sup>
63 case azimuth.PointSize.Star:
65 <FooterButton disabled={!isActiveOwner} onClick={goParties}>
75 // sync the current cursor
76 useSyncOwnedPoints([point]);
80 <Passport point={Just(point)} />
81 <Grid className="pt2">
90 <Grid.Item full as={BootArvoButton} disabled />
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list