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 { useSyncExtras } 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, urbitWallet } = useWallet();
118 const point = need.point(pointCursor);
120 const { getResidents } = usePointCache();
122 const { residentCount, requestCount } = getResidents(point);
131 } = useCurrentPermissions();
133 const canBitcoin = Just.hasInstance(urbitWallet);
135 // fetch the invites for the current cursor
136 const invites = useInvites(point);
145 const showInvites = !(
146 acceptedInvites.getOrElse(0) === 0 && sentInvites.getOrElse(0) === 0
149 const hasInvites = showInvites || availableInvites.getOrElse(0) !== 0;
151 const loadedInvites = Just.hasInstance(availableInvites);
153 // availableInvites.getOrElse(0) === 0
155 const goSenate = useCallback(() => push(names.SENATE), [push, names]);
157 const goCohort = useCallback(() => push(names.INVITE_COHORT), [push, names]);
159 const goUrbitOS = useCallback(() => push(names.URBIT_OS), [push, names]);
161 const goBitcoin = useCallback(() => push(names.BITCOIN), [push, names]);
163 const goUrbitID = useCallback(() => push(names.URBIT_ID), [push, names]);
165 const goResidents = useCallback(() => push(names.RESIDENTS), [push, names]);
167 const goPartiesSetPoolSize = useCallback(
168 () => push(names.PARTY_SET_POOL_SIZE),
172 const goIssuePoint = useCallback(() => push(names.ISSUE_CHILD), [
177 const isPlanet = azimuth.getPointSize(point) === azimuth.PointSize.Planet;
179 const [showInviteForm, setShowInviteForm] = useState(false);
181 const inviteButton = (() => {
182 if (azimuth.getPointSize(point) === azimuth.PointSize.Star) {
188 disabled={!isActiveOwner}
189 onClick={goPartiesSetPoolSize}>
200 const senateButton = (() => {
201 if (azimuth.getPointSize(point) !== azimuth.PointSize.Galaxy) {
218 // sync the current cursor
219 useSyncExtras([point]);
221 const address = need.addressFromWallet(wallet);
223 const _requestCount = requestCount.getOrElse(0);
226 <View pop={pop} inset>
227 <Greeting point={point} />
230 address={Just(address)}
231 animationMode={'slide'}
239 onClick={goResidents}
240 className="mv1 pointer">
243 <span className="gray3">{matchBlinky(residentCount)}</span>
245 {_requestCount !== 0 && (
246 <Flex.Item className="f7 bg-gray2 h3 pv1 ph2 br-full r-full text-center">
247 {_requestCount} PENDING
252 {isPlanet && hasInvites && (
254 showInviteForm={showInviteForm}
255 setShowInviteForm={setShowInviteForm}
256 acceptedInvites={acceptedInvites}
257 acceptedPoints={acceptedPoints}
258 availableInvites={availableInvites}
260 pendingPoints={pendingPoints}
261 sentInvites={sentInvites}
262 showInvites={showInvites}
265 {!loadedInvites && isPlanet && (
266 <Grid.Item className="mv2" full>
267 Invite Group <Blinky />
271 <Grid className="pt2">
277 disabled={!canManage}
280 detail="Identity and security settings">
287 disabled={!canManage}
289 detail="Urbit OS Settings"
297 disabled={!canBitcoin}
299 detail="Bitcoin management"
310 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