From 4599d9e39ff074a2b2bbf105d41c181a76228ee2 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 25 Jul 2021 16:16:37 -0500 Subject: [PATCH] FederationRestrictions: add explanation box --- .../features/federation_restrictions/index.js | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/app/soapbox/features/federation_restrictions/index.js b/app/soapbox/features/federation_restrictions/index.js index 13cbfdaaa..fa1987b1e 100644 --- a/app/soapbox/features/federation_restrictions/index.js +++ b/app/soapbox/features/federation_restrictions/index.js @@ -7,6 +7,7 @@ import Column from '../ui/components/column'; import { createSelector } from 'reselect'; import { Map as ImmutableMap, OrderedSet as ImmutableOrderedSet } from 'immutable'; import RestrictedInstance from './components/restricted_instance'; +import Accordion from 'soapbox/features/ui/components/accordion'; const getHosts = createSelector([ state => state.getIn(['instance', 'pleroma', 'metadata', 'federation', 'mrf_simple'], ImmutableMap()), @@ -19,6 +20,8 @@ const getHosts = createSelector([ const messages = defineMessages({ heading: { id: 'column.federation_restrictions', defaultMessage: 'Federation Restrictions' }, + boxTitle: { id: 'federation_restrictions.explanation_box.title', defaultMessage: 'Instance-specific policies' }, + boxMessage: { id: 'federation_restrictions.explanation_box.message', defaultMessage: 'Normally servers on the Fediverse can communicate freely. {siteTitle} has imposed restrictions on the following servers.' }, }); const mapStateToProps = state => ({ @@ -34,11 +37,31 @@ class FederationRestrictions extends ImmutablePureComponent { intl: PropTypes.object.isRequired, }; + state = { + explanationBoxExpanded: true, + } + + toggleExplanationBox = setting => { + this.setState({ explanationBoxExpanded: setting }); + } + render() { - const { intl, hosts } = this.props; + const { intl, hosts, siteTitle } = this.props; + const { explanationBoxExpanded } = this.state; return ( +
+ + {intl.formatMessage(messages.boxMessage, { siteTitle })} + + +
+
{hosts.map(host => )}