1import { Just, Nothing } from 'folktale/maybe';
2import React from 'react';
3import { pour } from 'sigil-js';
4import * as ob from 'urbit-ob';
5import * as azimuth from 'azimuth-js';
6import * as need from '../lib/need';
8import PointList from '../components/old/PointList';
9import ReactSVGComponents from '../components/ReactSVGComponents';
10import KeysAndMetadata from './Point/KeysAndMetadata';
11import Actions from './Point/Actions';
12import { H1, H3 } from '../components/old/Base';
13import { withHistory } from '../store/history';
14import { withNetwork } from '../store/network';
15import { compose } from '../lib/lib';
16import { withWallet } from '../store/wallet';
17import { withPointCursor } from '../store/pointCursor';
18import { withPointCache } from '../store/pointCache';
19import View from 'components/View';
21class Point extends React.Component {
35 componentDidUpdate(prevProps) {
39 // When a link in the 'issued points' component is clicked, we don't
40 // actually leave the Point component, and componentDidMount will not fire
41 // again. But, we can force a call to cachePoints here.
43 const oldCursor = prevProps.pointCursor.getOrElse(true);
44 const newCursor = this.props.pointCursor.getOrElse(true);
46 if (oldCursor !== newCursor) {
52 const { web3, contracts, pointCursor, addToPointCache } = this.props;
55 contracts.chain(ctrcs =>
56 pointCursor.chain(point => {
58 .getPoint(ctrcs, point)
59 .then(details => addToPointCache({ [point]: details }));
60 azimuth.delegatedSending
61 .getTotalUsableInvites(ctrcs, point)
62 .then(count => this.setState({ invites: Just(count) }));
63 this.updateSpawned(ctrcs, point);
69 updateSpawned = contracts => {
70 const { pointCursor } = this.props;
72 pointCursor.matchWith({
76 .getSpawned(contracts, point.value)
77 .then(spawned => this.setState({ spawned }));
83 const { web3, history, wallet, pointCache } = this.props;
85 const { spawned } = this.state;
87 const point = need.pointCursor(this.props.pointCursor);
90 point in pointCache ? Just(pointCache[point]) : Nothing();
92 const name = ob.patp(point);
96 renderer: ReactSVGComponents,
100 const online = Just.hasInstance(web3);
102 const authenticated = Just.hasInstance(wallet);
104 const issuedPointList =
105 spawned.length === 0 ? (
109 <H3>{'Issued Points'}</H3>
111 <PointList routeHandler={history.popAndPush} points={spawned} />
117 <div className={'mt-12 pt-6'}>{sigil}</div>
125 pointDetails={pointDetails}
126 invites={this.state.invites}
130 {online ? <KeysAndMetadata pointDetails={pointDetails} /> : <div />}
137export default compose(
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