From 0e70215c404565e30c78e7d61f6ba0a86159a5eb Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 7 Dec 2022 00:25:40 +0100 Subject: [PATCH] =?UTF-8?q?[Glitch]=20Fix=20=E2=80=9CSign=20up=E2=80=9D=20?= =?UTF-8?q?button=20with=20closed=20registrations=20not=20opening=20modal?= =?UTF-8?q?=20on=20mobile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Port 51098035ed2f42d949d6ec3f8ecdd5e68e73874d to glitch-soc Signed-off-by: Claire --- .../glitch/features/ui/components/header.js | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/app/javascript/flavours/glitch/features/ui/components/header.js b/app/javascript/flavours/glitch/features/ui/components/header.js index 891f7fc078..d9ad949611 100644 --- a/app/javascript/flavours/glitch/features/ui/components/header.js +++ b/app/javascript/flavours/glitch/features/ui/components/header.js @@ -7,6 +7,7 @@ import Avatar from 'flavours/glitch/components/avatar'; import Permalink from 'flavours/glitch/components/permalink'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; +import { openModal } from 'flavours/glitch/actions/modal'; const Account = connect(state => ({ account: state.getIn(['accounts', me]), @@ -16,7 +17,14 @@ const Account = connect(state => ({ )); -export default @withRouter +const mapDispatchToProps = (dispatch) => ({ + openClosedRegistrationsModal() { + dispatch(openModal('CLOSED_REGISTRATIONS')); + }, +}); + +export default @connect(null, mapDispatchToProps) +@withRouter class Header extends React.PureComponent { static contextTypes = { @@ -24,12 +32,13 @@ class Header extends React.PureComponent { }; static propTypes = { + openClosedRegistrationsModal: PropTypes.func, location: PropTypes.object, }; render () { const { signedIn } = this.context.identity; - const { location } = this.props; + const { location, openClosedRegistrationsModal } = this.props; let content; @@ -41,10 +50,26 @@ class Header extends React.PureComponent { ); } else { + let signupButton; + + if (registrationsOpen) { + signupButton = ( + + + + ); + } else { + signupButton = ( + + ); + } + content = ( <> - + {signupButton} ); }