import React from 'react'
import PropTypes from 'prop-types'
import styles from './SuggestedNodes.scss'
const SuggestedNodes = ({
suggestedNodesLoading,
suggestedNodes,
setNode,
openSubmitChannelForm
}) => {
const nodeClicked = (n) => {
// set the node public key for the submit form
setNode({ pub_key: n.pubkey, addresses: [{ addr: n.host }] })
// open the submit form
openSubmitChannelForm()
}
if (suggestedNodesLoading) {
return (
)
}
return (
{'Hmmm, looks like you don\'t have any channels yet. Here are some suggested nodes to open a channel with to get started'}
{
suggestedNodes.map(node => (
-
{node.nickname}
{`${node.pubkey.substring(0, 30)}...`}
nodeClicked(node)}>Connect
))
}
)
}
SuggestedNodes.propTypes = {
suggestedNodesLoading: PropTypes.bool.isRequired,
suggestedNodes: PropTypes.array.isRequired,
setNode: PropTypes.func.isRequired,
openSubmitChannelForm: PropTypes.func.isRequired
}
export default SuggestedNodes