diff --git a/app/components/Network/CanvasNetworkGraph.js b/app/components/Network/CanvasNetworkGraph.js index 10372c44..407fe635 100644 --- a/app/components/Network/CanvasNetworkGraph.js +++ b/app/components/Network/CanvasNetworkGraph.js @@ -44,7 +44,7 @@ class CanvasNetworkGraph extends Component { const simulationDataEmpty = !nodes.length && !links.length const networkDataLoaded = network.nodes.length || network.edges.length - // if the simulationData is empty and we have data + // if the simulationData is empty and we have network data if (simulationDataEmpty && networkDataLoaded) { this.setState({ simulationData: generateSimulationData(network.nodes, network.edges) @@ -53,7 +53,7 @@ class CanvasNetworkGraph extends Component { } componentDidMount() { - // wait for the svg to me in the DOM before we start the simulation + // wait for the svg to be in the DOM before we start the simulation const svgInterval = setInterval(() => { if (document.getElementById('mapContainer')) { d3.select('#mapContainer') @@ -227,10 +227,7 @@ class CanvasNetworkGraph extends Component { _restart() { const { identity_pubkey } = this.props - const { - simulation, - simulationData: { nodes, links } - } = this.state + const { simulationData: { nodes, links } } = this.state // Apply the general update pattern to the nodes. this.node = this.node.data(nodes, d => d.pub_key) @@ -286,4 +283,4 @@ CanvasNetworkGraph.propTypes = { network: PropTypes.object.isRequired } -export default CanvasNetworkGraph \ No newline at end of file +export default CanvasNetworkGraph diff --git a/app/components/Network/NetworkGraph.js b/app/components/Network/NetworkGraph.js deleted file mode 100644 index 6546af10..00000000 --- a/app/components/Network/NetworkGraph.js +++ /dev/null @@ -1,169 +0,0 @@ -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 ( -
-
-

loading network graph

-
-
- ) - } - - 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 \ No newline at end of file diff --git a/app/components/Network/NetworkGraph.scss b/app/components/Network/NetworkGraph.scss deleted file mode 100644 index b57d5f98..00000000 --- a/app/components/Network/NetworkGraph.scss +++ /dev/null @@ -1,75 +0,0 @@ -@import '../../variables.scss'; - -@keyframes dash { - to { - stroke-dashoffset: 1000; - } -} - -@keyframes fadein { - 0% { background: $white; } - 50% { background: lighten($secondary, 50%); } - 100% { background: $secondary; animation-fill-mode:forwards; } -} - -.networkLoading { - position: absolute; - top: 0; - left: 0; - width: 70%; - height: 100vh; - animation: fadein 0.5s; - animation-timing-function:linear; - animation-fill-mode: forwards; - animation-iteration-count: infinite; - // visibility: hidden; - - &.active { - // visibility: visible; - } - - h1 { - font-size: 22px; - text-align: center; - margin-top: calc(50% - 22px); - animation: color-change 1s infinite; - } -} - -.network { - width: 100%; - height: 100vh; - animation: fadein 0.5s; - animation-timing-function:linear; - animation-fill-mode: forwards; - animation-iteration-count: 1; -} - -.node { - stroke-width: 2 !important; - animation: color-change 1s infinite; - fill: #353535; - - &.owner { - fill: #FFFFFF; - } - - &.peer { - fill: #5589F3; - } -} - -.activeEdge { - opacity: 1; - stroke: #88D4A2; - stroke-width: 5; - stroke-dasharray: 100; - animation: dash 2.5s infinite linear; -} - -.network { - display: inline-block; - vertical-align: top; - height: 100vh; - width: 70%; -} diff --git a/app/routes/network/components/Network.js b/app/routes/network/components/Network.js index 921315cf..b8c97816 100644 --- a/app/routes/network/components/Network.js +++ b/app/routes/network/components/Network.js @@ -4,7 +4,6 @@ import PropTypes from 'prop-types' import { InteractiveForceGraph, ForceGraphNode, ForceGraphLink } from 'react-vis-force' import CanvasNetworkGraph from 'components/Network/CanvasNetworkGraph' -import NetworkGraph from 'components/Network/NetworkGraph' import PeersList from 'components/Network/PeersList' import ChannelsList from 'components/Network/ChannelsList' import TransactionForm from 'components/Network/TransactionForm'