diff --git a/app/components/Network/NetworkGraph.js b/app/components/Network/NetworkGraph.js
new file mode 100644
index 00000000..6b99b9d9
--- /dev/null
+++ b/app/components/Network/NetworkGraph.js
@@ -0,0 +1,93 @@
+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 styles from './NetworkGraph.scss'
+
+class NetworkGraph extends Component {
+ constructor(props) {
+ super(props)
+ this.state = {
+ ready: false
+ }
+ }
+
+ componentWillMount() {
+ setTimeout(() => {
+ this.setState({ ready: true })
+ }, 1000)
+ }
+
+ render() {
+ const { ready } = this.state
+ const {
+ network: { nodes, edges, selectedChannel, networkLoading },
+ identity_pubkey,
+ } = this.props
+
+ if (!ready || networkLoading) {
+ return (
+
+
+
loading network graph
+
+
+ )
+ }
+
+ return (
+
+
+
+ {
+ nodes.map(node => {
+ return (
+
+ )
+ })
+ }
+ {
+ edges.map(edge => {
+ 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
new file mode 100644
index 00000000..8613aa44
--- /dev/null
+++ b/app/components/Network/NetworkGraph.scss
@@ -0,0 +1,55 @@
+@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;
+
+ h1 {
+ font-size: 22px;
+ text-align: center;
+ margin-top: calc(50% - 22px);
+ }
+}
+
+.container {
+ width: 100%;
+ height: 100vh;
+ animation: fadein 0.5s;
+ animation-timing-function:linear;
+ animation-fill-mode:forwards;
+ animation-iteration-count: 1;
+
+ line.active {
+ opacity: 1;
+ stroke: green;
+ stroke-width: 5;
+ stroke-dasharray: 100;
+ animation: dash 2.5s infinite linear;
+ }
+
+ circle {
+ cursor: pointer;
+ }
+}
+
+.network {
+ display: inline-block;
+ vertical-align: top;
+ height: 100vh;
+ width: 70%;
+}
diff --git a/app/components/Network/PeersList.js b/app/components/Network/PeersList.js
index 1d5eb289..d74bf804 100644
--- a/app/components/Network/PeersList.js
+++ b/app/components/Network/PeersList.js
@@ -5,16 +5,13 @@ import styles from './PeersList.scss'
const PeersList = ({ peers }) => (
{
- peers.map(peer => {
- console.log('peer: ', peer)
- return (
- -
-
-
{peer.address}
- {peer.pub_key}
-
- )
- })
+ peers.map(peer =>
+ -
+
+
{peer.address}
+ {peer.pub_key}
+
+ )
}
)
diff --git a/app/routes/network/components/Network.js b/app/routes/network/components/Network.js
index 712f8953..85f8384f 100644
--- a/app/routes/network/components/Network.js
+++ b/app/routes/network/components/Network.js
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
import { InteractiveForceGraph, ForceGraphNode, ForceGraphLink } from 'react-vis-force'
-import LoadingBolt from 'components/LoadingBolt'
+import NetworkGraph from 'components/Network/NetworkGraph'
import PeersList from 'components/Network/PeersList'
import styles from './Network.scss'
@@ -20,13 +20,13 @@ class Network extends Component {
const {
setCurrentTab,
- network: { nodes, edges, networkLoading, currentTab },
+ network,
peers: { peers },
identity_pubkey
} = this.props
const renderContent = () => {
- switch(currentTab) {
+ switch(network.currentTab) {
case 1:
return
break
@@ -39,73 +39,26 @@ class Network extends Component {
}
}
- if (!nodes.length || !edges.length) { return }
- if (networkLoading) return
-
return (
-
- console.log('node: ', node)}
- opacityFactor={1}
- highlightDependencies
- zoomOptions={{ minScale: 0.1, maxScale: 5, scale: 0.2 }}
- zoom
- >
-
- {
- nodes.map(node => {
- return (
-
- )
- })
- }
- {
- edges.map(edge => {
- return (
-
- )
- })
- }
-
-
+
+
- setCurrentTab(1)}
>
Peers
- setCurrentTab(2)}
>
Channels
- setCurrentTab(3)}
>
Transactions