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 Blinky, { matchBlinky } from 'components/Blinky';
14import BarGraph from 'components/BarGraph';
15import Chip from 'components/Chip';
16import InviteSigilList from 'components/InviteSigilList';
17import { ForwardButton } from 'components/Buttons';
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';
26import { usePointCache } from 'store/pointCache';
40 sentInvites.getOrElse(0) + availableInvites.getOrElse(0);
41 const _pendingInvites = pendingPoints.getOrElse([]).length;
45 <Grid.Item cols={[1, 11]}>
51 className={cn('t-right underline pointer-hover', {
52 gray4: sentInvites.getOrElse(0) === 0,
61 {acceptedInvites.getOrElse(0)} / {_totalInvites}
63 {_pendingInvites > 0 && (
64 <Flex.Item as={Chip} className="bg-yellow1 yellow4">
65 {_pendingInvites} pending
76 available={availableInvites}
78 accepted={acceptedInvites}
83 pendingPoints={pendingPoints}
84 acceptedPoints={acceptedPoints}
90 <Grid.Item full className="b-gray4 b-dotted b1 self-center">
91 <div className="p4 pv8 t-center gray4">
92 Start your invite group by adding members
97 {!showInviteForm && availableInvites.getOrElse(0) > 0 && (
103 onClick={() => setShowInviteForm(true)}>
107 {showInviteForm && <Inviter />}
108 <Grid.Item full className="mb2" />
113export default function Point() {
114 const { pop, push, names } = useLocalRouter();
115 const { pointCursor } = usePointCursor();
117 const { wallet } = useWallet();
118 const point = need.point(pointCursor);
120 const { getResidents } = usePointCache();
122 const { residentCount, requestCount } = getResidents(point);
131 } = useCurrentPermissions();
133 // fetch the invites for the current cursor
134 const invites = useInvites(point);
143 const showInvites = !(
144 acceptedInvites.getOrElse(0) === 0 && sentInvites.getOrElse(0) === 0
147 const hasInvites = showInvites || availableInvites.getOrElse(0) !== 0;
149 const loadedInvites = Just.hasInstance(availableInvites);
151 // availableInvites.getOrElse(0) === 0
153 const goSenate = useCallback(() => push(names.SENATE), [push, names]);
155 const goCohort = useCallback(() => push(names.INVITE_COHORT), [push, names]);
157 const goUrbitOS = useCallback(() => push(names.URBIT_OS), [push, names]);
159 const goUrbitID = useCallback(() => push(names.URBIT_ID), [push, names]);
161 const goResidents = useCallback(() => push(names.RESIDENTS), [push, names]);
163 const goPartiesSetPoolSize = useCallback(
164 () => push(names.PARTY_SET_POOL_SIZE),
168 const goIssuePoint = useCallback(() => push(names.ISSUE_CHILD), [
173 const isPlanet = azimuth.getPointSize(point) === azimuth.PointSize.Planet;
175 const [showInviteForm, setShowInviteForm] = useState(false);
177 const inviteButton = (() => {
178 if (azimuth.getPointSize(point) === azimuth.PointSize.Star) {
184 disabled={!isActiveOwner}
185 onClick={goPartiesSetPoolSize}>
196 const senateButton = (() => {
197 if (azimuth.getPointSize(point) !== azimuth.PointSize.Galaxy) {
214 // sync the current cursor
215 useSyncOwnedPoints([point]);
217 const address = need.addressFromWallet(wallet);
219 const _requestCount = requestCount.getOrElse(0);
222 <View pop={pop} inset>
223 <Greeting point={point} />
226 address={Just(address)}
227 animationMode={'slide'}
235 onClick={goResidents}
236 className="mv1 pointer">
239 <span className="gray3">{matchBlinky(residentCount)}</span>
241 {_requestCount !== 0 && (
242 <Flex.Item className="f7 bg-gray2 h3 pv1 ph2 br-full r-full text-center">
243 {_requestCount} PENDING
248 {isPlanet && hasInvites && (
250 showInviteForm={showInviteForm}
251 setShowInviteForm={setShowInviteForm}
252 acceptedInvites={acceptedInvites}
253 acceptedPoints={acceptedPoints}
254 availableInvites={availableInvites}
256 pendingPoints={pendingPoints}
257 sentInvites={sentInvites}
258 showInvites={showInvites}
261 {!loadedInvites && isPlanet && (
262 <Grid.Item className="mv2" full>
263 Invite Group <Blinky />
267 <Grid className="pt2">
273 disabled={!canManage}
276 detail="Identity and security settings">
283 disabled={!canManage}
285 detail="Urbit OS Settings"
296 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