1import Maybe from 'folktale/maybe'
2import React from 'react'
3import { pour } from 'sigil-js'
4import * as ob from 'urbit-ob'
5import * as azimuth from 'azimuth-js'
7import PointList from '../components/PointList'
8import ReactSVGComponents from '../components/ReactSVGComponents'
9import KeysAndMetadata from './Point/KeysAndMetadata'
10import Actions from './Point/Actions'
11import { BRIDGE_ERROR } from '../lib/error'
12import { Row, Col, H1, H3 } from '../components/Base'
15class Point extends React.Component {
29 componentDidUpdate(prevProps) {
33 // When a link in the 'issued points' component is clicked, we don't
34 // actually leave the Point component, and componentDidMount will not fire
35 // again. But, we can force a call to cachePoints here.
37 const oldCursor = prevProps.pointCursor.getOrElse(true)
38 const newCursor = this.props.pointCursor.getOrElse(true)
40 if (oldCursor !== newCursor) {
46 const { web3, contracts, pointCursor, addToPointCache } = this.props
49 contracts.chain(ctrcs =>
50 pointCursor.chain(point => {
51 azimuth.azimuth.getPoint(ctrcs, point)
52 .then(details => addToPointCache({ [point]: details }))
53 this.updateSpawned(ctrcs, point)
57 updateSpawned = contracts => {
58 const { pointCursor } = this.props
60 pointCursor.matchWith({
63 azimuth.azimuth.getSpawned(contracts, point.value)
64 .then(spawned => this.setState({ spawned }))
72 const { web3, popRoute, pushRoute, wallet } = this.props
73 const { setPointCursor } = this.props
74 const { pointCursor, pointCache } = this.props
76 const { spawned } = this.state
79 const point = pointCursor.matchWith({
80 Just: (cursor) => cursor.value,
82 throw BRIDGE_ERROR.MISSING_POINT
88 ? Maybe.Just(pointCache[point])
91 const name = ob.patp(point)
95 renderer: ReactSVGComponents,
99 const online = Maybe.Just.hasInstance(web3)
101 const authenticated = Maybe.Just.hasInstance(wallet)
103 const routeHandler = route => {
108 const issuedPointList =
112 <H3>{ 'Issued Points' }</H3>
115 setPointCursor={ setPointCursor }
116 routeHandler={ routeHandler }
126 <div className={'mt-12 pt-6'}>
129 <H1><code>{ name }</code></H1>
132 ? <Actions pushRoute={ pushRoute } online={ online } point={ point } pointDetails={ pointDetails } wallet={ wallet }/>
138 ? <KeysAndMetadata pointDetails={ pointDetails } />
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