1import React from 'react';
2import { Just, Nothing } from 'folktale/maybe';
3import { H1, H2, P, Grid } from 'indigo-react';
5import { ROUTE_NAMES } from 'lib/routeNames';
6import { isZeroAddress } from 'lib/wallet';
7import useIsEclipticOwner from 'lib/useIsEclipticOwner';
8import { useSyncKnownPoints } from 'lib/useSyncPoints';
10import { useHistory } from 'store/history';
11import { useWallet } from 'store/wallet';
12import { usePointCache } from 'store/pointCache';
14import View from 'components/View';
15import { ForwardButton } from 'components/Buttons';
16import useLifecycle from 'lib/useLifecycle';
19import { usePointCursor } from 'store/pointCursor';
20import * as ob from 'urbit-ob';
21const PointList = function(props) {
22 const { setPointCursor } = usePointCursor();
23 const history = useHistory();
24 const { points, loading } = props;
26 return points.length === 0 ? (
27 <p>{loading ? 'Loading...' : 'No points to display'}</p>
30 {points.map(point => (
34 setPointCursor(Just(point));
35 history.push(ROUTE_NAMES.POINT);
44const matchArray = obj =>
45 obj.matchWith({ Nothing: () => [], Just: p => p.value });
47const hasTransferProxy = (details, point) =>
48 !isZeroAddress(details.transferProxy);
50export default function Points() {
51 const { wallet } = useWallet();
52 const history = useHistory();
64 } = getControlledPoints(wallet);
65 const isEclipticOwner = useIsEclipticOwner();
67 const owned = matchArray(ownedPoints);
68 const incoming = matchArray(incomingPoints);
69 const managing = matchArray(managingPoints);
70 const voting = matchArray(votingPoints);
71 const spawning = matchArray(spawningPoints);
73 // sync controlled points on mount
75 syncControlledPoints();
78 // sync display details for known points
87 const loading = Nothing.hasInstance(ownedPoints);
89 const outgoing = ownedPoints.filter(point =>
90 getDetails(point).matchWith({
92 Just: p => hasTransferProxy(p.value),
101 A point is an identity on the Ethereum blockchain. Points declare keys
102 for ships on the Arvo network.
109 detail="View a point on Azimuth"
110 onClick={() => history.push(ROUTE_NAMES.VIEW_POINT)}>
115 {isEclipticOwner && (
119 detail="You have the authority to create a new Galaxy."
120 onClick={() => history.push(ROUTE_NAMES.CREATE_GALAXY)}>
129 {incoming.length > 0 && (
131 <H2>Incoming Transfers</H2>
133 You do not own these points until you accept the incoming transfer.
134 You may reject any incoming transfers.
136 <PointList routeHandler={history.push} points={incoming} />
140 {outgoing.length > 0 && (
142 <H2>Outgoing Transfers</H2>
144 You own these points until the recipient accepts the incoming
145 transfer. You may cancel the transfer until accepted.
147 <PointList routeHandler={history.push} points={outgoing} />
153 <PointList routeHandler={history.push} points={owned} loading={loading} />
155 {managing.length > 0 && (
157 <H2>You Are a Management Proxy For</H2>
159 You can configure or set network keys and conduct sponsorship
160 related operations for these points.
162 <PointList routeHandler={history.push} points={managing} />
166 {voting.length > 0 && (
168 <H2>You Are a Voting Proxy For</H2>
170 Since you are part of the Galactic Senate, you can cast votes on new
171 Azimuth proposals on behalf of these points.
173 <PointList routeHandler={history.push} points={voting} />
177 {spawning.length > 0 && (
179 <H2>You Are a Spawn Proxy For</H2>
180 <P>You can create new child points under these points.</P>
181 <PointList routeHandler={history.push} points={spawning} />
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