mirror of
https://github.com/element-hq/element-web
synced 2024-11-28 04:21:57 +03:00
RoomDirectory: show spinner if loading more results
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
81ea230a35
commit
0d28cd5840
1 changed files with 14 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2015, 2016 OpenMarket Ltd
|
Copyright 2015, 2016 OpenMarket Ltd
|
||||||
Copyright 2019 Michael Telatynski <7t3chguy@gmail.com>
|
Copyright 2019 Michael Telatynski <7t3chguy@gmail.com>
|
||||||
|
Copyright 2019 New Vector Ltd
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
@ -140,6 +141,10 @@ module.exports = createReactClass({
|
||||||
getMoreRooms: function() {
|
getMoreRooms: function() {
|
||||||
if (!MatrixClientPeg.get()) return Promise.resolve();
|
if (!MatrixClientPeg.get()) return Promise.resolve();
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
loading: true,
|
||||||
|
});
|
||||||
|
|
||||||
const my_filter_string = this.state.filterString;
|
const my_filter_string = this.state.filterString;
|
||||||
const my_server = this.state.roomServer;
|
const my_server = this.state.roomServer;
|
||||||
// remember the next batch token when we sent the request
|
// remember the next batch token when we sent the request
|
||||||
|
@ -554,15 +559,21 @@ module.exports = createReactClass({
|
||||||
let content;
|
let content;
|
||||||
if (this.state.error) {
|
if (this.state.error) {
|
||||||
content = this.state.error;
|
content = this.state.error;
|
||||||
} else if (this.state.protocolsLoading || this.state.loading) {
|
} else if (this.state.protocolsLoading) {
|
||||||
content = <Loader />;
|
content = <Loader />;
|
||||||
} else {
|
} else {
|
||||||
const rows = (this.state.publicRooms || []).map(room => this.getRow(room));
|
const rows = (this.state.publicRooms || []).map(room => this.getRow(room));
|
||||||
// we still show the scrollpanel, at least for now, because
|
// we still show the scrollpanel, at least for now, because
|
||||||
// otherwise we don't fetch more because we don't get a fill
|
// otherwise we don't fetch more because we don't get a fill
|
||||||
// request from the scrollpanel because there isn't one
|
// request from the scrollpanel because there isn't one
|
||||||
|
|
||||||
|
let spinner;
|
||||||
|
if (this.state.loading) {
|
||||||
|
spinner = <Loader />;
|
||||||
|
}
|
||||||
|
|
||||||
let scrollpanel_content;
|
let scrollpanel_content;
|
||||||
if (rows.length == 0) {
|
if (rows.length === 0 && !this.state.loading) {
|
||||||
scrollpanel_content = <i>{ _t('No rooms to show') }</i>;
|
scrollpanel_content = <i>{ _t('No rooms to show') }</i>;
|
||||||
} else {
|
} else {
|
||||||
scrollpanel_content = <table ref="directory_table" className="mx_RoomDirectory_table">
|
scrollpanel_content = <table ref="directory_table" className="mx_RoomDirectory_table">
|
||||||
|
@ -579,6 +590,7 @@ module.exports = createReactClass({
|
||||||
startAtBottom={false}
|
startAtBottom={false}
|
||||||
>
|
>
|
||||||
{ scrollpanel_content }
|
{ scrollpanel_content }
|
||||||
|
{ spinner }
|
||||||
</ScrollPanel>;
|
</ScrollPanel>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue