import React from 'react'
import PropTypes from 'prop-types'
import { TiPlus } from 'react-icons/lib/ti'
import ChannelModal from './ChannelModal'
import ChannelForm from './ChannelForm'
import Channel from './Channel'
import OpenPendingChannel from './OpenPendingChannel'
import ClosedPendingChannel from './ClosedPendingChannel'
import styles from './Channels.scss'
const Channels = ({
ticker,
peers,
channelsLoading,
modalChannel,
setChannel,
channelModalOpen,
channelForm,
setChannelForm,
allChannels,
openChannel,
closeChannel,
currentTicker,
explorerLinkBase
}) => (
Channels
setChannelForm({ isOpen: true })}
>
{
!channelsLoading ?
allChannels.map((channel, index) => {
if (Object.prototype.hasOwnProperty.call(channel, 'blocks_till_open')) {
return (
)
} else if (Object.prototype.hasOwnProperty.call(channel, 'closing_txid')) {
return (
)
}
return (
)
})
:
'Loading...'
}
)
Channels.propTypes = {
ticker: PropTypes.object.isRequired,
peers: PropTypes.array.isRequired,
channelsLoading: PropTypes.bool.isRequired,
modalChannel: PropTypes.object,
setChannel: PropTypes.func.isRequired,
channelModalOpen: PropTypes.bool.isRequired,
channelForm: PropTypes.object.isRequired,
setChannelForm: PropTypes.func.isRequired,
allChannels: PropTypes.array.isRequired,
openChannel: PropTypes.func.isRequired,
closeChannel: PropTypes.func.isRequired,
currentTicker: PropTypes.object.isRequired,
explorerLinkBase: PropTypes.string.isRequired
}
export default Channels