From 05c1dd9114c605a535a405d5a232e17a07007c45 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 26 Oct 2022 19:35:55 +0200 Subject: [Glitch] Add closed registrations modal Port 2277913f3f01d3bdb9a1661f019221b1cb185fbb to glitch-soc Signed-off-by: Claire --- .../features/closed_registrations_modal/index.js | 75 ++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 app/javascript/flavours/glitch/features/closed_registrations_modal/index.js (limited to 'app/javascript/flavours/glitch/features/closed_registrations_modal') diff --git a/app/javascript/flavours/glitch/features/closed_registrations_modal/index.js b/app/javascript/flavours/glitch/features/closed_registrations_modal/index.js new file mode 100644 index 000000000..25dc4e20f --- /dev/null +++ b/app/javascript/flavours/glitch/features/closed_registrations_modal/index.js @@ -0,0 +1,75 @@ +import React from 'react'; +import { connect } from 'react-redux'; +import { FormattedMessage } from 'react-intl'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { domain } from 'flavours/glitch/initial_state'; +import { fetchServer } from 'flavours/glitch/actions/server'; + +const mapStateToProps = state => ({ + closed_registrations_message: state.getIn(['server', 'server', 'registrations', 'closed_registrations_message']), +}); + +export default @connect(mapStateToProps) +class ClosedRegistrationsModal extends ImmutablePureComponent { + + componentDidMount () { + const { dispatch } = this.props; + dispatch(fetchServer()); + } + + render () { + let closedRegistrationsMessage; + + if (this.props.closed_registrations_message) { + closedRegistrationsMessage = ( +

+ ); + } else { + closedRegistrationsMessage = ( +

+ {domain} }} + /> +

+ ); + } + + return ( +
+
+

+

+ +

+
+ +
+
+

+ {closedRegistrationsMessage} +
+ +
+

+

+ +

+ +
+
+
+ ); + } + +}; -- cgit From 8814a1b949c18c8908ab29e89799511e13ca7871 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 28 Oct 2022 19:34:22 +0200 Subject: [Glitch] Fix closed registrations message not appearing in web UI Port 5fa340931e2bd39a4bcccc9a97ad58e13a2d56ab to glitch-soc Signed-off-by: Claire --- .../flavours/glitch/features/closed_registrations_modal/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/javascript/flavours/glitch/features/closed_registrations_modal') diff --git a/app/javascript/flavours/glitch/features/closed_registrations_modal/index.js b/app/javascript/flavours/glitch/features/closed_registrations_modal/index.js index 25dc4e20f..cb91636cb 100644 --- a/app/javascript/flavours/glitch/features/closed_registrations_modal/index.js +++ b/app/javascript/flavours/glitch/features/closed_registrations_modal/index.js @@ -6,7 +6,7 @@ import { domain } from 'flavours/glitch/initial_state'; import { fetchServer } from 'flavours/glitch/actions/server'; const mapStateToProps = state => ({ - closed_registrations_message: state.getIn(['server', 'server', 'registrations', 'closed_registrations_message']), + message: state.getIn(['server', 'server', 'registrations', 'message']), }); export default @connect(mapStateToProps) @@ -20,11 +20,11 @@ class ClosedRegistrationsModal extends ImmutablePureComponent { render () { let closedRegistrationsMessage; - if (this.props.closed_registrations_message) { + if (this.props.message) { closedRegistrationsMessage = (

); } else { -- cgit