Rearrange MatrixChat.render for sanity

no-op to make it into a nice simple switch-like arrangement
pull/21833/head
Richard van der Hoff 2017-06-15 17:36:57 +01:00
parent 90213ce72e
commit 7b526308fd
1 changed files with 45 additions and 34 deletions

View File

@ -1381,10 +1381,11 @@ module.exports = React.createClass({
); );
} }
if (this.state.view === VIEWS.LOGGED_IN) {
// `ready` and `view==LOGGED_IN` may be set before `page_type` (because the // `ready` and `view==LOGGED_IN` may be set before `page_type` (because the
// latter is set via the dispatcher). If we don't yet have a `page_type`, // latter is set via the dispatcher). If we don't yet have a `page_type`,
// keep showing the spinner for now. // keep showing the spinner for now.
if (this.state.view === VIEWS.LOGGED_IN && this.state.ready && this.state.page_type) { if (this.state.ready && this.state.page_type) {
/* for now, we stuff the entirety of our props and state into the LoggedInView. /* for now, we stuff the entirety of our props and state into the LoggedInView.
* we should go through and figure out what we actually need to pass down, as well * we should go through and figure out what we actually need to pass down, as well
* as using something like redux to avoid having a billion bits of state kicking around. * as using something like redux to avoid having a billion bits of state kicking around.
@ -1401,7 +1402,7 @@ module.exports = React.createClass({
{...this.state} {...this.state}
/> />
); );
} else if (this.state.view === VIEWS.LOGGED_IN) { } else {
// we think we are logged in, but are still waiting for the /sync to complete // we think we are logged in, but are still waiting for the /sync to complete
const Spinner = sdk.getComponent('elements.Spinner'); const Spinner = sdk.getComponent('elements.Spinner');
return ( return (
@ -1412,7 +1413,10 @@ module.exports = React.createClass({
</a> </a>
</div> </div>
); );
} else if (this.state.view == VIEWS.REGISTER) { }
}
if (this.state.view === VIEWS.REGISTER) {
const Registration = sdk.getComponent('structures.login.Registration'); const Registration = sdk.getComponent('structures.login.Registration');
return ( return (
<Registration <Registration
@ -1435,7 +1439,10 @@ module.exports = React.createClass({
onCancelClick={this.state.guestCreds ? this.onReturnToGuestClick : null} onCancelClick={this.state.guestCreds ? this.onReturnToGuestClick : null}
/> />
); );
} else if (this.state.view == VIEWS.FORGOT_PASSWORD) { }
if (this.state.view === VIEWS.FORGOT_PASSWORD) {
const ForgotPassword = sdk.getComponent('structures.login.ForgotPassword'); const ForgotPassword = sdk.getComponent('structures.login.ForgotPassword');
return ( return (
<ForgotPassword <ForgotPassword
@ -1447,7 +1454,9 @@ module.exports = React.createClass({
onRegisterClick={this.onRegisterClick} onRegisterClick={this.onRegisterClick}
onLoginClick={this.onLoginClick} /> onLoginClick={this.onLoginClick} />
); );
} else { }
if (this.state.view === VIEWS.LOGIN) {
const Login = sdk.getComponent('structures.login.Login'); const Login = sdk.getComponent('structures.login.Login');
return ( return (
<Login <Login
@ -1465,5 +1474,7 @@ module.exports = React.createClass({
/> />
); );
} }
throw new Error(`Unknown view ${this.state.view}`);
}, },
}); });