Show a loading state for slow peeks
This commit is contained in:
parent
9771ce1e04
commit
ca6ddf324f
4 changed files with 27 additions and 1 deletions
|
@ -39,6 +39,16 @@ limitations under the License.
|
||||||
margin: 10px 10px 10px 0;
|
margin: 10px 10px 10px 0;
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mx_RoomPreviewBar_footer {
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 20px;
|
||||||
|
|
||||||
|
.mx_Spinner {
|
||||||
|
vertical-align: middle;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_RoomPreviewBar_dark {
|
.mx_RoomPreviewBar_dark {
|
||||||
|
|
|
@ -1523,6 +1523,7 @@ module.exports = React.createClass({
|
||||||
<div className="mx_RoomView">
|
<div className="mx_RoomView">
|
||||||
<RoomPreviewBar
|
<RoomPreviewBar
|
||||||
canPreview={false}
|
canPreview={false}
|
||||||
|
previewLoading={this.state.peekLoading}
|
||||||
error={this.state.roomLoadError}
|
error={this.state.roomLoadError}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
joining={this.state.joining}
|
joining={this.state.joining}
|
||||||
|
|
|
@ -66,6 +66,7 @@ module.exports = React.createClass({
|
||||||
error: PropTypes.object,
|
error: PropTypes.object,
|
||||||
|
|
||||||
canPreview: PropTypes.bool,
|
canPreview: PropTypes.bool,
|
||||||
|
previewLoading: PropTypes.bool,
|
||||||
room: PropTypes.object,
|
room: PropTypes.object,
|
||||||
|
|
||||||
// When a spinner is present, a spinnerState can be specified to indicate the
|
// When a spinner is present, a spinnerState can be specified to indicate the
|
||||||
|
@ -254,6 +255,8 @@ module.exports = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
|
const Spinner = sdk.getComponent('elements.Spinner');
|
||||||
|
|
||||||
let showSpinner = false;
|
let showSpinner = false;
|
||||||
let darkStyle = false;
|
let darkStyle = false;
|
||||||
let title;
|
let title;
|
||||||
|
@ -262,6 +265,7 @@ module.exports = React.createClass({
|
||||||
let primaryActionLabel;
|
let primaryActionLabel;
|
||||||
let secondaryActionHandler;
|
let secondaryActionHandler;
|
||||||
let secondaryActionLabel;
|
let secondaryActionLabel;
|
||||||
|
let footer;
|
||||||
|
|
||||||
const messageCase = this._getMessageCase();
|
const messageCase = this._getMessageCase();
|
||||||
switch (messageCase) {
|
switch (messageCase) {
|
||||||
|
@ -287,6 +291,14 @@ module.exports = React.createClass({
|
||||||
primaryActionHandler = this.onRegisterClick;
|
primaryActionHandler = this.onRegisterClick;
|
||||||
secondaryActionLabel = _t("Sign In");
|
secondaryActionLabel = _t("Sign In");
|
||||||
secondaryActionHandler = this.onLoginClick;
|
secondaryActionHandler = this.onLoginClick;
|
||||||
|
if (this.props.previewLoading) {
|
||||||
|
footer = (
|
||||||
|
<div>
|
||||||
|
<Spinner w={20} h={20}/>
|
||||||
|
{_t("Loading room preview")}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MessageCase.Kicked: {
|
case MessageCase.Kicked: {
|
||||||
|
@ -433,7 +445,6 @@ module.exports = React.createClass({
|
||||||
}
|
}
|
||||||
|
|
||||||
const AccessibleButton = sdk.getComponent('elements.AccessibleButton');
|
const AccessibleButton = sdk.getComponent('elements.AccessibleButton');
|
||||||
const Spinner = sdk.getComponent('elements.Spinner');
|
|
||||||
|
|
||||||
let subTitleElements;
|
let subTitleElements;
|
||||||
if (subTitle) {
|
if (subTitle) {
|
||||||
|
@ -484,6 +495,9 @@ module.exports = React.createClass({
|
||||||
{ secondaryButton }
|
{ secondaryButton }
|
||||||
{ primaryButton }
|
{ primaryButton }
|
||||||
</div>
|
</div>
|
||||||
|
<div className="mx_RoomPreviewBar_footer">
|
||||||
|
{ footer }
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -835,6 +835,7 @@
|
||||||
"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",
|
||||||
|
"Loading room preview": "Loading room preview",
|
||||||
"You were kicked from %(roomName)s by %(memberName)s": "You were kicked from %(roomName)s by %(memberName)s",
|
"You were kicked from %(roomName)s by %(memberName)s": "You were kicked from %(roomName)s by %(memberName)s",
|
||||||
"Reason: %(reason)s": "Reason: %(reason)s",
|
"Reason: %(reason)s": "Reason: %(reason)s",
|
||||||
"Forget this room": "Forget this room",
|
"Forget this room": "Forget this room",
|
||||||
|
|
Loading…
Reference in a new issue