import React, { Component } from 'react' 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' import styles from './Network.scss' class Network extends Component { componentWillMount() { const { fetchDescribeNetwork, fetchPeers, fetchChannels } = this.props fetchPeers() fetchChannels() fetchDescribeNetwork() } componentDidUpdate(prevProps) { const { payReqIsLn, network: { pay_req }, fetchInvoiceAndQueryRoutes, clearQueryRoutes } = this.props // If LN go retrieve invoice details if ((prevProps.network.pay_req !== pay_req) && payReqIsLn) { fetchInvoiceAndQueryRoutes(pay_req) } if (prevProps.payReqIsLn && !payReqIsLn) { clearQueryRoutes() } } componentWillUnmount() { const { clearQueryRoutes, resetPayReq } = this.props clearQueryRoutes() resetPayReq() } render() { const { setCurrentTab, updateSelectedPeers, setCurrentRoute, network, selectedPeerPubkeys, currentRouteChanIds, peers: { peers }, activeChannels, selectedChannelIds, updateSelectedChannels, updatePayReq, identity_pubkey } = this.props const renderContent = () => { switch(network.currentTab) { case 1: return break case 2: return break case 3: return ( ) break } } return (
  • setCurrentTab(1)} > Peers
  • setCurrentTab(2)} > Channels
  • setCurrentTab(3)} > Transactions
{renderContent()}
) } } Network.propTypes = { fetchDescribeNetwork: PropTypes.func.isRequired, fetchPeers: PropTypes.func.isRequired, setCurrentTab: PropTypes.func.isRequired, network: PropTypes.object.isRequired, peers: PropTypes.object.isRequired, identity_pubkey: PropTypes.string.isRequired } export default Network