import React from 'react' import PropTypes from 'prop-types' import { FormattedMessage } from 'react-intl' import messages from './messages' 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 (
{suggestedNodes.length > 0 ? (
    {suggestedNodes.map(node => (
  • {node.nickname} {`${node.pubkey.substring(0, 30)}...`}
    nodeClicked(node)}>
  • ))}
) : (
)}
) } SuggestedNodes.propTypes = { suggestedNodesLoading: PropTypes.bool.isRequired, suggestedNodes: PropTypes.array.isRequired, setNode: PropTypes.func.isRequired, openSubmitChannelForm: PropTypes.func.isRequired } export default SuggestedNodes