import React, { Component } from 'react' import PropTypes from 'prop-types' import { FaAlignJustify, FaGlobe, FaAngleDown, FaRepeat } from 'react-icons/lib/fa' import { MdSearch } from 'react-icons/lib/md' import OpenPendingChannel from 'components/Channels/OpenPendingChannel' import ClosedPendingChannel from 'components/Channels/ClosedPendingChannel' import Channel from 'components/Channels/Channel' import NetworkChannels from 'components/Channels/NetworkChannels' import ChannelForm from 'components/ChannelForm' import styles from './Channels.scss' class Channels extends Component { componentWillMount() { const { fetchChannels, fetchPeers, fetchDescribeNetwork } = this.props fetchChannels() fetchPeers() fetchDescribeNetwork() } render() { const { fetchChannels, closeChannel, channels: { searchQuery, filterPulldown, filter, viewType }, nonActiveFilters, toggleFilterPulldown, changeFilter, currentChannels, openChannels, updateChannelSearchQuery, setViewType, openChannelForm, ticker, currentTicker, channelFormProps, network, identity_pubkey, setCurrentChannel } = this.props const refreshClicked = (event) => { // store event in icon so we dont get an error when react clears it const icon = event.currentTarget // fetch peers fetchChannels() // clear animation after the second so we can reuse it setTimeout(() => { icon.style.animation = '' }, 1000) // spin icon for 1 sec icon.style.animation = 'spin 1000ms linear 1' } return (
updateChannelSearchQuery(event.target.value)} className={`${styles.text} ${styles.input}`} placeholder='Search channels by funding transaction or remote public key' type='text' id='channelSearch' />
setViewType(0)}> setViewType(1)}>
Create new channel

{filter.name}

    { nonActiveFilters.map(f => (
  • changeFilter(f)}> {f.name}
  • )) }
{ viewType === 0 &&
    { currentChannels.map((channel, index) => { if (Object.prototype.hasOwnProperty.call(channel, 'blocks_till_open')) { return ( ) } else if (Object.prototype.hasOwnProperty.call(channel, 'closing_txid')) { return ( ) } return ( ) }) }
} { viewType === 1 && }
) } } Channels.propTypes = { fetchChannels: PropTypes.func.isRequired, fetchPeers: PropTypes.func.isRequired, channels: PropTypes.object.isRequired, currentChannels: PropTypes.array.isRequired, openChannels: PropTypes.array.isRequired, updateChannelSearchQuery: PropTypes.func.isRequired, setViewType: PropTypes.func.isRequired, setCurrentChannel: PropTypes.func.isRequired, openChannelForm: PropTypes.func.isRequired, closeChannel: PropTypes.func.isRequired, toggleFilterPulldown: PropTypes.func.isRequired, changeFilter: PropTypes.func.isRequired, ticker: PropTypes.object.isRequired, currentTicker: PropTypes.object.isRequired, channelFormProps: PropTypes.object.isRequired, nonActiveFilters: PropTypes.object.isRequired, network: PropTypes.object.isRequired, fetchDescribeNetwork: PropTypes.func.isRequired, identity_pubkey: PropTypes.string.isRequired } export default Channels