diff --git a/app/routes/network/components/Network.js b/app/routes/network/components/Network.js index 3f79e996..7e623287 100644 --- a/app/routes/network/components/Network.js +++ b/app/routes/network/components/Network.js @@ -1,14 +1,82 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' +import { InteractiveForceGraph, ForceGraphNode, ForceGraphLink } from 'react-vis-force' +import LoadingBolt from '../../../components/LoadingBolt' + import styles from './Network.scss' class Network extends Component { + componentWillMount() { + const { fetchDescribeNetwork } = this.props + + fetchDescribeNetwork() + } + render() { - const {} = this.props + const { + network: { nodes, edges, selectedNode, networkLoading }, + identity_pubkey + } = this.props + + console.log('props: ', this.props) + + if (networkLoading) return return ( -

network

+
+
+ console.log('node: ', node)} + opacityFactor={1} + zoomOptions={{ minScale: 0.1, maxScale: 5 }} + zoom + highlightDependencies + > + + { + nodes.map(node => { + return ( + + ) + }) + } + { + edges.map(edge => { + return ( + this[edge.channel_id] = line} + /> + ) + }) + } + +
+
) } } diff --git a/app/routes/network/components/Network.scss b/app/routes/network/components/Network.scss index e69de29b..2bfd4972 100644 --- a/app/routes/network/components/Network.scss +++ b/app/routes/network/components/Network.scss @@ -0,0 +1,85 @@ +@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; } +} + +.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, .data { + display: inline-block; + vertical-align: top; + height: 100vh; +} + +.network { + width: 70%; +} + +.data { + width: 30%; + background: $black; + color: #00FF00; + word-wrap: break-word; + overflow-y: scroll; + + header, .routes { + padding: 10px; + } + + header { + margin-top: 50px; + + h1 span { + display: block; + margin: 5px 0; + + &:nth-child(2) { + font-size: 12px; + } + } + } + + .routes { + .route { + cursor: pointer; + margin: 20px 0; + + &.active { + background: #00FF00; + color: black; + } + + &:hover { + opacity: 0.5; + } + } + } +} \ No newline at end of file diff --git a/app/routes/network/containers/NetworkContainer.js b/app/routes/network/containers/NetworkContainer.js index 75b894df..c90d53e2 100644 --- a/app/routes/network/containers/NetworkContainer.js +++ b/app/routes/network/containers/NetworkContainer.js @@ -1,10 +1,17 @@ import { withRouter } from 'react-router' import { connect } from 'react-redux' +import { fetchDescribeNetwork } from 'reducers/network' + import Network from '../components/Network' -const mapDispatchToProps = {} +const mapDispatchToProps = { + fetchDescribeNetwork +} -const mapStateToProps = state => ({}) +const mapStateToProps = state => ({ + network: state.network, + identity_pubkey: state.info.data.identity_pubkey +}) export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Network))