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

View File

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

View File

@ -790,8 +790,9 @@
"Historical": "Historical",
"System Alerts": "System Alerts",
"This room": "This room",
"Joining room...": "Joining room...",
"In progress ...": "In progress ...",
"Joining room …": "Joining room …",
"Loading …": "Loading …",
"Rejecting invite …": "Rejecting invite …",
"Join the conversation with an account": "Join the conversation with an account",
"Sign Up": "Sign Up",
"Sign In": "Sign In",
@ -1286,7 +1287,6 @@
"Hide": "Hide",
"Home": "Home",
"Sign in": "Sign in",
"Login": "Login",
"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.",
"Custom Server Options": "Custom Server Options",