1import React, { useCallback } from 'react';
2import { Just } from 'folktale/maybe';
3import { Grid } from 'indigo-react';
4import { azimuth } from 'azimuth-js';
6import { usePointCursor } from 'store/pointCursor';
7import { useWallet } from 'store/wallet';
9import View from 'components/View';
10import Greeting from 'components/Greeting';
11import Passport from 'components/Passport';
12import { ForwardButton, BootUrbitOSButton } from 'components/Buttons';
13import CopyButton from 'components/CopyButton';
14import { matchBlinky } from 'components/Blinky';
15import DownloadSigilButton from 'components/DownloadSigilButton';
17import * as need from 'lib/need';
18import useInvites from 'lib/useInvites';
19import { useSyncOwnedPoints } from 'lib/useSyncPoints';
20import useCurrentPermissions from 'lib/useCurrentPermissions';
21import { useLocalRouter } from 'lib/LocalRouter';
22import useKeyfileGenerator from 'lib/useKeyfileGenerator';
24export default function Point() {
25 const { pop, push, names } = useLocalRouter();
26 const { pointCursor } = usePointCursor();
28 const { wallet } = useWallet();
29 const point = need.point(pointCursor);
31 const { code, notice } = useKeyfileGenerator();
39 } = useCurrentPermissions();
41 // fetch the invites for the current cursor
42 const { availableInvites } = useInvites(point);
44 const goAdmin = useCallback(() => push(names.ADMIN), [push, names]);
46 const goSenate = useCallback(() => push(names.SENATE), [push, names]);
48 const goInvite = useCallback(() => push(names.INVITE), [push, names]);
50 const goPartiesSetPoolSize = useCallback(
51 () => push(names.PARTY_SET_POOL_SIZE),
55 const goIssuePoint = useCallback(() => push(names.ISSUE_CHILD), [
60 const inviteButton = (() => {
61 switch (azimuth.getPointSize(point)) {
62 case azimuth.PointSize.Planet:
63 const availableInvitesText = matchBlinky(availableInvites);
69 disabled={!isActiveOwner}
71 Invite <sup>{availableInvitesText}</sup>
77 case azimuth.PointSize.Star:
83 disabled={!isActiveOwner}
84 onClick={goPartiesSetPoolSize}>
96 const senateButton = (() => {
97 if (azimuth.getPointSize(point) !== azimuth.PointSize.Galaxy) {
114 // sync the current cursor
115 useSyncOwnedPoints([point]);
117 const address = need.addressFromWallet(wallet);
120 <View pop={pop} inset>
121 <Greeting point={point} />
124 address={Just(address)}
125 animationMode={'slide'}
127 <Grid className="pt2">
132 disabled={!canManage}
144 onClick={goIssuePoint}>
151 <Grid.Item full as={BootUrbitOSButton} />
156 accessory={code && <CopyButton text={code} />}
157 detail={code || notice}
159 detailClassName="mono">
163 <Grid.Item full as={DownloadSigilButton} point={point} />
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