1import { Just, Nothing } from 'folktale/maybe';
2import React from 'react';
3import * as azimuth from 'azimuth-js';
4import * as need from '../lib/need';
6import { Row, Col, P } from '../components/old/Base';
8import { compose } from '../lib/lib';
10import { withNetwork } from '../store/network';
11import { withPointCursor } from '../store/pointCursor';
12import { withPointCache } from '../store/pointCache';
14class PointHome extends React.Component {
27 this.updateBirthday();
30 //TODO can probably re-use this to implement point switching
31 componentDidUpdate(prevProps) {
35 // When a link in the 'issued points' component is clicked, we don't
36 // actually leave the Point component, and componentDidMount will not fire
37 // again. But, we can force a call to cachePoints here.
39 const oldCursor = prevProps.pointCursor.getOrElse(true);
40 const newCursor = this.props.pointCursor.getOrElse(true);
42 if (oldCursor !== newCursor) {
48 const { web3, contracts, pointCursor, addToPointCache } = this.props;
51 contracts.chain(ctrcs =>
52 pointCursor.chain(point => {
54 .getPoint(ctrcs, point)
55 .then(details => addToPointCache({ [point]: details }));
56 azimuth.delegatedSending
57 .getTotalUsableInvites(ctrcs, point)
58 .then(count => this.setState({ invites: Just(count) }));
59 this.updateSpawned(ctrcs, point);
65 async updateBirthday() {
66 const birthBlock = await azimuth.azimuth.getActivationBlock(
67 need.contracts(this.props),
68 need.pointCursor(this.props)
70 if (birthBlock === 0) {
71 this.setState({ birthday: Nothing() });
73 const block = await need.web3(this.props).eth.getBlock(birthBlock);
74 //TODO add to point cache
75 this.setState({ birthday: Just(new Date(block.timestamp * 1000)) });
79 updateSpawned = contracts => {
80 const { pointCursor } = this.props;
82 pointCursor.matchWith({
86 .getSpawned(contracts, point.value)
87 .then(spawned => this.setState({ spawned }));
107export 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