on master help sign in
Completely strip down PointHome
8f263ecFang
src/bridge/views/PointHome.js+8−45
@@ -1,20 +1,12 @@
1import { Just, Nothing } from 'folktale/maybe';
1import { Just, Nothing } from 'folktale/maybe';
2import React from 'react';
2import React from 'react';
3−import { pour } from 'sigil-js';
4−import * as ob from 'urbit-ob';
5import * as azimuth from 'azimuth-js';
3import * as azimuth from 'azimuth-js';
6import * as need from '../lib/need';
4import * as need from '../lib/need';
7
5
8−import PointList from '../components/PointList';
9−import ReactSVGComponents from '../components/ReactSVGComponents';
10−import KeysAndMetadata from './Point/KeysAndMetadata';
11−import Actions from './Point/Actions';
12−import { Row, Col, H1, H3 } from '../components/Base';
6+import { Row, Col, P } from '../components/Base';
13
7
14import { compose } from '../lib/lib';
8import { compose } from '../lib/lib';
15−import { ROUTE_NAMES } from '../lib/routeNames';
16
9
17−import { withHistory } from '../store/history';
18import { withNetwork } from '../store/network';
10import { withNetwork } from '../store/network';
19import { withPointCursor } from '../store/pointCursor';
11import { withPointCursor } from '../store/pointCursor';
20import { withPointCache } from '../store/pointCache';
12import { withPointCache } from '../store/pointCache';
@@ -70,7 +62,7 @@ class PointHome extends React.Component {
70 );
62 );
71 }
63 }
72
64
73− async updateBirthday(blockNumber) {
65+ async updateBirthday() {
74 const birthBlock = await azimuth.azimuth.getActivationBlock(
66 const birthBlock = await azimuth.azimuth.getActivationBlock(
75 need.contracts(this.props),
67 need.contracts(this.props),
76 need.pointCursor(this.props)
68 need.pointCursor(this.props)
@@ -79,6 +71,7 @@ class PointHome extends React.Component {
79 this.setState({ birthday: Nothing() });
71 this.setState({ birthday: Nothing() });
80 } else {
72 } else {
81 const block = await need.web3(this.props).eth.getBlock(birthBlock);
73 const block = await need.web3(this.props).eth.getBlock(birthBlock);
74+ //TODO add to point cache
82 this.setState({ birthday: Just(new Date(block.timestamp * 1000)) });
75 this.setState({ birthday: Just(new Date(block.timestamp * 1000)) });
83 }
76 }
84 }
77 }
@@ -97,43 +90,14 @@ class PointHome extends React.Component {
97 };
90 };
98
91
99 render() {
92 render() {
100− const { web3, history, wallet, setPointCursor, pointCache } = this.props;
101−
102− const point = need.pointCursor(this.props);
103−
104− const pointDetails =
105− point in pointCache ? Just(pointCache[point]) : Nothing();
106−
107− const name = ob.patp(point);
108−
109− const sigil = pour({
110− patp: name,
111− renderer: ReactSVGComponents,
112− size: 256,
113− });
114−
115− const online = Just.hasInstance(web3);
116−
117− const authenticated = Just.hasInstance(wallet);
118−
119 return (
93 return (
120 <Row>
94 <Row>
121 <Col>
95 <Col>
122− <div className={'mt-12 pt-6'}>{sigil}</div>
96+ <P>Admin</P>
123− <H1>
97+
124− <code>{name}</code>
98+ <P>Boot Arvo</P>
125− </H1>
99+
126− {authenticated ? (
100+ <P>Invite</P>
127− <Actions
128− online={online}
129− wallet={wallet}
130− point={point}
131− pointDetails={pointDetails}
132− invites={this.state.invites}
133− />
134− ) : null}
135−
136− {online ? <KeysAndMetadata pointDetails={pointDetails} /> : <div />}
137 </Col>
101 </Col>
138 </Row>
102 </Row>
139 );
103 );
@@ -142,7 +106,6 @@ class PointHome extends React.Component {
142
106
143export default compose(
107export default compose(
144 withNetwork,
108 withNetwork,
145− withHistory,
146 withPointCursor,
109 withPointCursor,
147 withPointCache
110 withPointCache
148)(PointHome);
111)(PointHome);