cleanup spinner props and use always preview bar when room operation is in progress

pull/21833/head
Bruno Windels 2019-04-15 18:49:00 +02:00
parent 7459e19f06
commit 36951dd7b7
3 changed files with 36 additions and 25 deletions

View File

@ -1496,16 +1496,21 @@ module.exports = React.createClass({
const ScrollPanel = sdk.getComponent("structures.ScrollPanel"); const ScrollPanel = sdk.getComponent("structures.ScrollPanel");
const TintableSvg = sdk.getComponent("elements.TintableSvg"); const TintableSvg = sdk.getComponent("elements.TintableSvg");
const RoomPreviewBar = sdk.getComponent("rooms.RoomPreviewBar"); const RoomPreviewBar = sdk.getComponent("rooms.RoomPreviewBar");
const Loader = sdk.getComponent("elements.Spinner");
const TimelinePanel = sdk.getComponent("structures.TimelinePanel"); const TimelinePanel = sdk.getComponent("structures.TimelinePanel");
const RoomUpgradeWarningBar = sdk.getComponent("rooms.RoomUpgradeWarningBar"); const RoomUpgradeWarningBar = sdk.getComponent("rooms.RoomUpgradeWarningBar");
const RoomRecoveryReminder = sdk.getComponent("rooms.RoomRecoveryReminder"); const RoomRecoveryReminder = sdk.getComponent("rooms.RoomRecoveryReminder");
if (!this.state.room) { if (!this.state.room) {
if (this.state.roomLoading || this.state.peekLoading) { const loading = this.state.roomLoading || this.state.peekLoading;
if (loading) {
return ( return (
<div className="mx_RoomView"> <div className="mx_RoomView">
<Loader /> <RoomPreviewBar
canPreview={false}
error={this.state.roomLoadError}
loading={loading}
joining={this.state.joining}
/>
</div> </div>
); );
} else { } else {
@ -1528,8 +1533,7 @@ module.exports = React.createClass({
onRejectClick={this.onRejectThreepidInviteButtonClicked} onRejectClick={this.onRejectThreepidInviteButtonClicked}
canPreview={false} error={this.state.roomLoadError} canPreview={false} error={this.state.roomLoadError}
roomAlias={roomAlias} roomAlias={roomAlias}
spinner={this.state.joining} joining={this.state.joining}
spinnerState="joining"
inviterName={inviterName} inviterName={inviterName}
invitedEmail={invitedEmail} invitedEmail={invitedEmail}
room={this.state.room} room={this.state.room}
@ -1543,9 +1547,12 @@ module.exports = React.createClass({
if (myMembership == 'invite') { if (myMembership == 'invite') {
if (this.state.joining || this.state.rejecting) { if (this.state.joining || this.state.rejecting) {
return ( return (
<div className="mx_RoomView"> <RoomPreviewBar
<Loader /> canPreview={false}
</div> error={this.state.roomLoadError}
joining={this.state.joining}
rejecting={this.state.rejecting}
/>
); );
} else { } else {
const myUserId = MatrixClientPeg.get().credentials.userId; const myUserId = MatrixClientPeg.get().credentials.userId;
@ -1565,8 +1572,7 @@ module.exports = React.createClass({
onRejectClick={this.onRejectButtonClicked} onRejectClick={this.onRejectButtonClicked}
inviterName={inviterName} inviterName={inviterName}
canPreview={false} canPreview={false}
spinner={this.state.joining} joining={this.state.joining}
spinnerState="joining"
room={this.state.room} room={this.state.room}
/> />
</div> </div>
@ -1656,8 +1662,7 @@ module.exports = React.createClass({
<RoomPreviewBar onJoinClick={this.onJoinButtonClicked} <RoomPreviewBar onJoinClick={this.onJoinButtonClicked}
onForgetClick={this.onForgetClick} onForgetClick={this.onForgetClick}
onRejectClick={this.onRejectThreepidInviteButtonClicked} onRejectClick={this.onRejectThreepidInviteButtonClicked}
spinner={this.state.joining} joining={this.state.joining}
spinnerState="joining"
inviterName={inviterName} inviterName={inviterName}
invitedEmail={invitedEmail} invitedEmail={invitedEmail}
canPreview={this.state.canPeek} canPreview={this.state.canPeek}

View File

@ -28,7 +28,8 @@ import { _t } from '../../../languageHandler';
const MessageCase = Object.freeze({ const MessageCase = Object.freeze({
NotLoggedIn: "NotLoggedIn", NotLoggedIn: "NotLoggedIn",
Joining: "Joining", Joining: "Joining",
Busy: "Busy", Loading: "Loading",
Rejecting: "Rejecting",
Kicked: "Kicked", Kicked: "Kicked",
Banned: "Banned", Banned: "Banned",
OtherThreePIDError: "OtherThreePIDError", OtherThreePIDError: "OtherThreePIDError",
@ -105,12 +106,12 @@ module.exports = React.createClass({
}, },
_getMessageCase() { _getMessageCase() {
if (this.props.spinner || this.state.busy) { if (this.props.joining) {
if (this.props.spinnerState === "joining") {
return MessageCase.Joining; return MessageCase.Joining;
} else { } else if (this.props.rejecting) {
return MessageCase.Busy; return MessageCase.Rejecting;
} } else if (this.props.loading) {
return MessageCase.Loading;
} }
const isGuest = MatrixClientPeg.get().isGuest(); const isGuest = MatrixClientPeg.get().isGuest();
const myMember = !isGuest && this.props.room ? const myMember = !isGuest && this.props.room ?
@ -193,12 +194,17 @@ module.exports = React.createClass({
switch (this._getMessageCase()) { switch (this._getMessageCase()) {
case MessageCase.Joining: { case MessageCase.Joining: {
title = _t("Joining room..."); title = _t("Joining room");
showSpinner = true; showSpinner = true;
break; break;
} }
case MessageCase.Busy: { case MessageCase.Loading: {
title = _t("In progress ..."); title = _t("Loading …");
showSpinner = true;
break;
}
case MessageCase.Rejecting: {
title = _t("Rejecting invite …");
showSpinner = true; showSpinner = true;
break; break;
} }

View File

@ -790,8 +790,9 @@
"Historical": "Historical", "Historical": "Historical",
"System Alerts": "System Alerts", "System Alerts": "System Alerts",
"This room": "This room", "This room": "This room",
"Joining room...": "Joining room...", "Joining room …": "Joining room …",
"In progress ...": "In progress ...", "Loading …": "Loading …",
"Rejecting invite …": "Rejecting invite …",
"Join the conversation with an account": "Join the conversation with an account", "Join the conversation with an account": "Join the conversation with an account",
"Sign Up": "Sign Up", "Sign Up": "Sign Up",
"Sign In": "Sign In", "Sign In": "Sign In",
@ -1286,7 +1287,6 @@
"Hide": "Hide", "Hide": "Hide",
"Home": "Home", "Home": "Home",
"Sign in": "Sign in", "Sign in": "Sign in",
"Login": "Login",
"powered by Matrix": "powered by Matrix", "powered by Matrix": "powered by Matrix",
"This homeserver would like to make sure you are not a robot.": "This homeserver would like to make sure you are not a robot.", "This homeserver would like to make sure you are not a robot.": "This homeserver would like to make sure you are not a robot.",
"Custom Server Options": "Custom Server Options", "Custom Server Options": "Custom Server Options",