1import React, { useCallback, useMemo } 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 } from 'components/Buttons';
13import FooterButton from 'components/FooterButton';
14import { matchBlinky } from 'components/Blinky';
16import useInvites from 'lib/useInvites';
17import { useSyncOwnedPoints } from 'lib/useSyncPoints';
18import { ROUTE_NAMES } from 'lib/routeNames';
20import Actions from './Point/Actions';
21import { useWallet } from 'store/wallet';
22import usePermissionsForPoint from 'lib/usePermissionsForPoint';
24const isPlanet = point =>
25 azimuth.getPointSize(point) === azimuth.PointSize.Planet;
27export default function Point() {
28 const { push, names } = useHistory();
29 const { pointCursor } = usePointCursor();
30 const { wallet } = useWallet();
32 const point = need.point(pointCursor);
34 const { isActiveOwner, canManage } = usePermissionsForPoint(
35 // using empty string should be ok here
38 Just: p => p.value.address,
43 // fetch the invites for the current cursor
44 const { availableInvites } = useInvites(point);
46 const showActions = Just.hasInstance(wallet);
48 const goAdmin = useCallback(() => push(names.ADMIN), [push, names]);
50 const goInvite = useCallback(() => push(names.INVITE), [push, names]);
52 const goParties = useCallback(() => push(names.INVITES_MANAGE), [
57 const inviteButton = (() => {
58 switch (azimuth.getPointSize(point)) {
59 case azimuth.PointSize.Planet:
60 const availableInvitesText = matchBlinky(availableInvites);
62 <FooterButton disabled={!isActiveOwner} onClick={goInvite}>
63 Invite <sup>{availableInvitesText} available</sup>
67 case azimuth.PointSize.Star:
69 <FooterButton disabled={!isActiveOwner} onClick={goParties}>
79 // sync the current cursor
80 useSyncOwnedPoints([point]);
84 <Passport point={Just(point)} />
85 <Grid className="pt2">
94 <Grid.Item full as={ForwardButton} detail="Boot your computer" 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