Rearrange MatrixChat.render for sanity
no-op to make it into a nice simple switch-like arrangement
This commit is contained in:
parent
90213ce72e
commit
7b526308fd
1 changed files with 45 additions and 34 deletions
|
@ -1381,38 +1381,42 @@ module.exports = React.createClass({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// `ready` and `view==LOGGED_IN` may be set before `page_type` (because the
|
if (this.state.view === VIEWS.LOGGED_IN) {
|
||||||
// latter is set via the dispatcher). If we don't yet have a `page_type`,
|
// `ready` and `view==LOGGED_IN` may be set before `page_type` (because the
|
||||||
// keep showing the spinner for now.
|
// latter is set via the dispatcher). If we don't yet have a `page_type`,
|
||||||
if (this.state.view === VIEWS.LOGGED_IN && this.state.ready && this.state.page_type) {
|
// keep showing the spinner for now.
|
||||||
/* for now, we stuff the entirety of our props and state into the LoggedInView.
|
if (this.state.ready && this.state.page_type) {
|
||||||
* we should go through and figure out what we actually need to pass down, as well
|
/* for now, we stuff the entirety of our props and state into the LoggedInView.
|
||||||
* as using something like redux to avoid having a billion bits of state kicking around.
|
* 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.
|
||||||
const LoggedInView = sdk.getComponent('structures.LoggedInView');
|
*/
|
||||||
return (
|
const LoggedInView = sdk.getComponent('structures.LoggedInView');
|
||||||
<LoggedInView ref="loggedInView" matrixClient={MatrixClientPeg.get()}
|
return (
|
||||||
onRoomCreated={this.onRoomCreated}
|
<LoggedInView ref="loggedInView" matrixClient={MatrixClientPeg.get()}
|
||||||
onUserSettingsClose={this.onUserSettingsClose}
|
onRoomCreated={this.onRoomCreated}
|
||||||
onRegistered={this.onRegistered}
|
onUserSettingsClose={this.onUserSettingsClose}
|
||||||
currentRoomId={this.state.currentRoomId}
|
onRegistered={this.onRegistered}
|
||||||
teamToken={this._teamToken}
|
currentRoomId={this.state.currentRoomId}
|
||||||
{...this.props}
|
teamToken={this._teamToken}
|
||||||
{...this.state}
|
{...this.props}
|
||||||
/>
|
{...this.state}
|
||||||
);
|
/>
|
||||||
} else if (this.state.view === VIEWS.LOGGED_IN) {
|
);
|
||||||
// we think we are logged in, but are still waiting for the /sync to complete
|
} else {
|
||||||
const Spinner = sdk.getComponent('elements.Spinner');
|
// we think we are logged in, but are still waiting for the /sync to complete
|
||||||
return (
|
const Spinner = sdk.getComponent('elements.Spinner');
|
||||||
<div className="mx_MatrixChat_splash">
|
return (
|
||||||
<Spinner />
|
<div className="mx_MatrixChat_splash">
|
||||||
<a href="#" className="mx_MatrixChat_splashButtons" onClick={ this.onLogoutClick }>
|
<Spinner />
|
||||||
{ _t('Logout') }
|
<a href="#" className="mx_MatrixChat_splashButtons" onClick={ this.onLogoutClick }>
|
||||||
</a>
|
{ _t('Logout') }
|
||||||
</div>
|
</a>
|
||||||
);
|
</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}`);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue