diff --git a/app/soapbox/features/crypto_donate/components/crypto_donate_panel.js b/app/soapbox/features/crypto_donate/components/crypto_donate_panel.js
deleted file mode 100644
index 23b401c7f..000000000
--- a/app/soapbox/features/crypto_donate/components/crypto_donate_panel.js
+++ /dev/null
@@ -1,76 +0,0 @@
-import classNames from 'classnames';
-import { List as ImmutableList } from 'immutable';
-import PropTypes from 'prop-types';
-import React from 'react';
-import ImmutablePureComponent from 'react-immutable-pure-component';
-import { FormattedMessage } from 'react-intl';
-import { connect } from 'react-redux';
-import { Link } from 'react-router-dom';
-
-import Icon from 'soapbox/components/icon';
-
-import SiteWallet from './site_wallet';
-
-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 &&
-
- }
-
- );
- }
-
-}
diff --git a/app/soapbox/features/crypto_donate/components/crypto_donate_panel.tsx b/app/soapbox/features/crypto_donate/components/crypto_donate_panel.tsx
new file mode 100644
index 000000000..9ec9e97e0
--- /dev/null
+++ b/app/soapbox/features/crypto_donate/components/crypto_donate_panel.tsx
@@ -0,0 +1,55 @@
+import classNames from 'classnames';
+import React from 'react';
+import { FormattedMessage } from 'react-intl';
+import { Link } from 'react-router-dom';
+
+import Icon from 'soapbox/components/icon';
+import { useAppSelector, useSoapboxConfig } from 'soapbox/hooks';
+
+import SiteWallet from './site_wallet';
+
+interface ICryptoDonatePanel {
+ limit: number,
+}
+
+const CryptoDonatePanel: React.FC = ({ limit = 3 }): JSX.Element | null => {
+ const addresses = useSoapboxConfig().get('cryptoAddresses');
+ const siteTitle = useAppSelector((state) => state.instance.title);
+
+ if (limit === 0 || addresses.size === 0) {
+ return null;
+ }
+
+ const more = addresses.size - limit;
+ const hasMore = more > 0;
+
+ return (
+
+
+
+
+
+
+
+
+ {hasMore &&
+
+ }
+
+ );
+};
+
+export default CryptoDonatePanel;
diff --git a/app/soapbox/pages/home_page.js b/app/soapbox/pages/home_page.js
index 65d581d28..e8a12a5d8 100644
--- a/app/soapbox/pages/home_page.js
+++ b/app/soapbox/pages/home_page.js
@@ -10,6 +10,7 @@ import {
WhoToFollowPanel,
TrendsPanel,
SignUpPanel,
+ CryptoDonatePanel,
} from 'soapbox/features/ui/util/async-components';
// import GroupSidebarPanel from '../features/groups/sidebar_panel';
import { getFeatures } from 'soapbox/utils/features';
@@ -31,10 +32,9 @@ const mapStateToProps = state => {
me,
account: state.getIn(['accounts', me]),
showFundingPanel: hasPatron,
- showCryptoDonatePanel: hasCrypto && cryptoLimit > 0,
+ hasCrypto,
cryptoLimit,
- showTrendsPanel: features.trends,
- showWhoToFollowPanel: features.suggestions,
+ features,
};
};
@@ -47,7 +47,7 @@ class HomePage extends ImmutablePureComponent {
}
render() {
- const { me, children, account, showTrendsPanel, showWhoToFollowPanel } = this.props;
+ const { me, children, account, features, hasCrypto, cryptoLimit } = this.props;
const acct = account ? account.get('acct') : '';
@@ -80,17 +80,22 @@ class HomePage extends ImmutablePureComponent {
{!me && (
- {Component => }
+ {Component => }
)}
- {showTrendsPanel && (
+ {features.trends && (
- {Component => }
+ {Component => }
)}
- {showWhoToFollowPanel && (
+ {hasCrypto && cryptoLimit > 0 && (
+
+ {Component => }
+
+ )}
+ {features.suggestions && (
- {Component => }
+ {Component => }
)}