import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import { Link } from 'react-router-dom'; import { FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; import SiteWallet from './site_wallet'; import { List as ImmutableList } from 'immutable'; import classNames from 'classnames'; const mapStateToProps = state => { const addresses = state.getIn(['soapbox', 'cryptoAddresses'], ImmutableList()); return { total: addresses.size, siteTitle: state.getIn(['instance', 'title']), }; }; export default @connect(mapStateToProps) class CryptoDonatePanel extends ImmutablePureComponent { static propTypes = { limit: PropTypes.number, total: PropTypes.number, } static defaultProps = { limit: 3, } shouldDisplay = () => { const { limit, total } = this.props; if (limit === 0 || total === 0) return false; return true; } render() { const { limit, total, siteTitle } = this.props; const more = total - limit; const hasMore = more > 0; if (!this.shouldDisplay()) return null; return (
{hasMore && }
); } };