1import React, { useCallback, useState } from 'react';
2import cn from 'classnames';
3import { Just } from 'folktale/maybe';
4import { Grid, Flex, Button } from 'indigo-react';
5import { azimuth } from 'azimuth-js';
7import { usePointCursor } from 'store/pointCursor';
8import { useWallet } from 'store/wallet';
10import View from 'components/View';
11import Greeting from 'components/Greeting';
12import Passport from 'components/Passport';
13import { ForwardButton } from 'components/Buttons';
14import Blinky from 'components/Blinky';
15import BarGraph from 'components/BarGraph';
16import Chip from 'components/Chip';
17import InviteSigilList from 'components/InviteSigilList';
19import * as need from 'lib/need';
20import useInvites from 'lib/useInvites';
21import { useSyncOwnedPoints } from 'lib/useSyncPoints';
22import useCurrentPermissions from 'lib/useCurrentPermissions';
23import { useLocalRouter } from 'lib/LocalRouter';
25import Inviter from 'views/Invite/Inviter';
27export default function Point() {
28 const { pop, push, names } = useLocalRouter();
29 const { pointCursor } = usePointCursor();
31 const { wallet } = useWallet();
32 const point = need.point(pointCursor);
40 } = useCurrentPermissions();
42 // fetch the invites for the current cursor
43 const invites = useInvites(point);
52 const showInvites = !(
53 acceptedInvites.getOrElse(0) === 0 && sentInvites.getOrElse(0) === 0
56 const hasInvites = showInvites || availableInvites.getOrElse(0) !== 0;
59 sentInvites.getOrElse(0) + availableInvites.getOrElse(0);
60 const _pendingInvites = pendingPoints.getOrElse([]).length;
62 const loadedInvites = Just.hasInstance(availableInvites);
64 // availableInvites.getOrElse(0) === 0
66 const goAdmin = useCallback(() => push(names.ADMIN), [push, names]);
68 const goSenate = useCallback(() => push(names.SENATE), [push, names]);
70 const goSigil = useCallback(() => push(names.SIGIL_GENERATOR), [push, names]);
72 const goCohort = useCallback(() => push(names.INVITE_COHORT), [push, names]);
74 const goUrbitOS = useCallback(() => push(names.URBIT_OS), [push, names]);
76 const goPartiesSetPoolSize = useCallback(
77 () => push(names.PARTY_SET_POOL_SIZE),
81 const goIssuePoint = useCallback(() => push(names.ISSUE_CHILD), [
86 const isPlanet = azimuth.getPointSize(point) === azimuth.PointSize.Planet;
88 const [showInviteForm, setShowInviteForm] = useState(false);
90 const inviteButton = (() => {
91 if (azimuth.getPointSize(point) === azimuth.PointSize.Star) {
97 disabled={!isActiveOwner}
98 onClick={goPartiesSetPoolSize}>
109 const senateButton = (() => {
110 if (azimuth.getPointSize(point) !== azimuth.PointSize.Galaxy) {
127 // sync the current cursor
128 useSyncOwnedPoints([point]);
130 const address = need.addressFromWallet(wallet);
133 <View pop={pop} inset>
134 <Greeting point={point} />
137 address={Just(address)}
138 animationMode={'slide'}
141 {isPlanet && hasInvites && (
143 <Grid.Item cols={[1, 11]}>
149 className={cn('t-right underline pointer-hover', {
150 gray4: sentInvites.getOrElse(0) === 0,
157 <Flex align="center">
159 {acceptedInvites.getOrElse(0)} / {_totalInvites}
161 {_pendingInvites > 0 && (
162 <Flex.Item as={Chip} className="bg-yellow1 yellow4">
163 {_pendingInvites} pending
174 available={availableInvites}
176 accepted={acceptedInvites}
181 pendingPoints={pendingPoints}
182 acceptedPoints={acceptedPoints}
188 <Grid.Item full className="b-gray4 b-dotted b1 self-center">
189 <div className="p4 pv8 t-center gray4">
190 Start your invite group by adding members
195 {!showInviteForm && availableInvites.getOrElse(0) > 0 && (
201 onClick={() => setShowInviteForm(true)}>
205 {showInviteForm && <Inviter />}
206 <Grid.Item full className="mb2" />
209 {!loadedInvites && isPlanet && (
210 <Grid.Item className="mv2" full>
211 Invite Group <Blinky />
215 <Grid className="pt2">
217 <Grid.Item full as={ForwardButton} onClick={goSigil}>
224 disabled={!canManage}
232 disabled={!canManage}
244 onClick={goIssuePoint}>
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