import { findDOMNode } from 'react-dom'
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { ForceGraph, ForceGraphNode, ForceGraphLink } from 'react-vis-force'
import { FaCircle } from 'react-icons/lib/fa'
import Isvg from 'react-inlinesvg'
import LoadingBolt from 'components/LoadingBolt'
import bitcoinIcon from 'icons/skinny_bitcoin.svg'
import styles from './NetworkGraph.scss'
class NetworkGraph extends Component {
constructor(props) {
super(props)
this.state = {
ready: false
}
}
componentWillMount() {
setTimeout(() => {
this.setState({ ready: true })
}, 10000)
}
render() {
const { ready } = this.state
const {
network: { nodes, edges, selectedChannel, networkLoading },
selectedPeerPubkeys,
selectedChannelIds,
currentRouteChanIds,
identity_pubkey
} = this.props
if ((!nodes.length || !edges.length) || networkLoading) {
return (
)
}
return (
{
console.log('el: ', el)
this.fg = el
}}
>
{
nodes.map(node =>
)
}
{
edges.map(edge => {
return (
)
})
}
{
currentRouteChanIds.map((chan_id) => {
const line = document.getElementById(chan_id)
if (!line) { return }
const x1 = line.x1.baseVal.value
const x2 = line.x2.baseVal.value
const y1 = line.y1.baseVal.value
const y2 = line.y2.baseVal.value
return (
)
})
}
{
currentRouteChanIds.map((chan_id) => {
const line = document.getElementById(chan_id)
if (!line) { return }
const x1 = line.x1.baseVal.value
const x2 = line.x2.baseVal.value
const y1 = line.y1.baseVal.value
const y2 = line.y2.baseVal.value
return (
)
})
}
{
currentRouteChanIds.map((chan_id) => {
const line = document.getElementById(chan_id)
if (!line) { return }
const x1 = line.x1.baseVal.value
const x2 = line.x2.baseVal.value
const y1 = line.y1.baseVal.value
const y2 = line.y2.baseVal.value
return (
)
})
}
)
}
}
NetworkGraph.propTypes = {
network: PropTypes.object.isRequired,
identity_pubkey: PropTypes.string.isRequired
}
export default NetworkGraph