diff --git a/app/soapbox/actions/soapbox.js b/app/soapbox/actions/soapbox.js
index 7e03a1e52..29a1ebf19 100644
--- a/app/soapbox/actions/soapbox.js
+++ b/app/soapbox/actions/soapbox.js
@@ -43,6 +43,7 @@ export const defaultConfig = ImmutableMap({
allowedEmoji: allowedEmoji,
verifiedCanEditName: false,
displayFqn: true,
+ cryptoAddresses: ImmutableList(),
cryptoDonatePanel: ImmutableMap({
limit: 3,
}),
diff --git a/app/soapbox/features/crypto_donate/components/crypto_donate_panel.js b/app/soapbox/features/crypto_donate/components/crypto_donate_panel.js
index 68005fac4..7a8ac0fd2 100644
--- a/app/soapbox/features/crypto_donate/components/crypto_donate_panel.js
+++ b/app/soapbox/features/crypto_donate/components/crypto_donate_panel.js
@@ -28,11 +28,19 @@ class CryptoDonatePanel extends ImmutablePureComponent {
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 (
diff --git a/app/soapbox/features/soapbox_config/index.js b/app/soapbox/features/soapbox_config/index.js
index cf97f73d3..dfcfffc32 100644
--- a/app/soapbox/features/soapbox_config/index.js
+++ b/app/soapbox/features/soapbox_config/index.js
@@ -9,6 +9,7 @@ import {
SimpleForm,
FieldsGroup,
TextInput,
+ SimpleInput,
SimpleTextarea,
FileChooserLogo,
FormPropTypes,
@@ -28,15 +29,21 @@ import SitePreview from './components/site_preview';
import ThemeToggle from 'soapbox/features/ui/components/theme_toggle';
import { defaultSettings } from 'soapbox/actions/settings';
import IconPickerDropdown from './components/icon_picker_dropdown';
+import snackbar from 'soapbox/actions/snackbar';
const messages = defineMessages({
heading: { id: 'column.soapbox_config', defaultMessage: 'Soapbox config' },
+ saved: { id: 'soapbox_config.saved', defaultMessage: 'Soapbox config saved!' },
copyrightFooterLabel: { id: 'soapbox_config.copyright_footer.meta_fields.label_placeholder', defaultMessage: 'Copyright footer' },
promoItemIcon: { id: 'soapbox_config.promo_panel.meta_fields.icon_placeholder', defaultMessage: 'Icon' },
promoItemLabel: { id: 'soapbox_config.promo_panel.meta_fields.label_placeholder', defaultMessage: 'Label' },
promoItemURL: { id: 'soapbox_config.promo_panel.meta_fields.url_placeholder', defaultMessage: 'URL' },
homeFooterItemLabel: { id: 'soapbox_config.home_footer.meta_fields.label_placeholder', defaultMessage: 'Label' },
homeFooterItemURL: { id: 'soapbox_config.home_footer.meta_fields.url_placeholder', defaultMessage: 'URL' },
+ cryptoAdressItemTicker: { id: 'soapbox_config.crypto_address.meta_fields.ticker_placeholder', defaultMessage: 'Ticker' },
+ cryptoAdressItemAddress: { id: 'soapbox_config.crypto_address.meta_fields.address_placeholder', defaultMessage: 'Address' },
+ cryptoAdressItemNote: { id: 'soapbox_config.crypto_address.meta_fields.note_placeholder', defaultMessage: 'Note (optional)' },
+ cryptoDonatePanelLimitLabel: { id: 'soapbox_config.crypto_donate_panel_limit.meta_fields.limit_placeholder', defaultMessage: 'Number of items to display in the crypto homepage widget' },
customCssLabel: { id: 'soapbox_config.custom_css.meta_fields.url_placeholder', defaultMessage: 'URL' },
rawJSONLabel: { id: 'soapbox_config.raw_json_label', defaultMessage: 'Advanced: Edit raw JSON data' },
rawJSONHint: { id: 'soapbox_config.raw_json_hint', defaultMessage: 'Edit the settings data directly. Changes made directly to the JSON file will override the form fields above. Click "Save" to apply your changes.' },
@@ -49,6 +56,7 @@ const listenerOptions = supportsPassiveEvents ? { passive: true } : false;
const templates = {
promoPanelItem: ImmutableMap({ icon: '', text: '', url: '' }),
footerItem: ImmutableMap({ title: '', url: '' }),
+ cryptoAddress: ImmutableMap({ ticker: '', address: '', note: '' }),
};
const mapStateToProps = state => ({
@@ -95,9 +103,10 @@ class SoapboxConfig extends ImmutablePureComponent {
}
handleSubmit = (event) => {
- const { dispatch } = this.props;
+ const { dispatch, intl } = this.props;
dispatch(updateConfig(this.getParams())).then(() => {
this.setState({ isLoading: false });
+ dispatch(snackbar.success(intl.formatMessage(messages.saved)));
}).catch((error) => {
this.setState({ isLoading: false });
});
@@ -158,6 +167,12 @@ class SoapboxConfig extends ImmutablePureComponent {
);
};
+ handleCryptoAdressItemChange = (index, key, field, getValue) => {
+ return this.handleItemChange(
+ ['cryptoAddresses', index], key, field, templates.cryptoAddress, getValue,
+ );
+ };
+
handleEditJSON = e => {
this.setState({ rawJSON: e.target.value });
}
@@ -323,6 +338,57 @@ class SoapboxConfig extends ImmutablePureComponent {
+