mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
fill gap tiles when they become visible
This commit is contained in:
parent
7578bfa3d9
commit
e89f60bac0
@ -22,6 +22,7 @@ export class GapTile extends SimpleTile {
|
|||||||
super(options);
|
super(options);
|
||||||
this._loading = false;
|
this._loading = false;
|
||||||
this._error = null;
|
this._error = null;
|
||||||
|
this._visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
async fill() {
|
async fill() {
|
||||||
@ -47,6 +48,13 @@ export class GapTile extends SimpleTile {
|
|||||||
return this._entry.edgeReached;
|
return this._entry.edgeReached;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setVisible(isVisible) {
|
||||||
|
this._visible = isVisible;
|
||||||
|
if (this._visible && !this.isLoading) {
|
||||||
|
this.fill();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
updateEntry(entry, params) {
|
updateEntry(entry, params) {
|
||||||
super.updateEntry(entry, params);
|
super.updateEntry(entry, params);
|
||||||
if (!entry.isGap) {
|
if (!entry.isGap) {
|
||||||
|
@ -54,15 +54,10 @@ limitations under the License.
|
|||||||
}
|
}
|
||||||
|
|
||||||
.GapView {
|
.GapView {
|
||||||
visibility: hidden;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
padding: 10px 20px;
|
padding: 10px 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.GapView.isLoading {
|
|
||||||
visibility: visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
.GapView > :nth-child(2) {
|
.GapView > :nth-child(2) {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ export class GapView extends TemplateView {
|
|||||||
};
|
};
|
||||||
return t.li({className}, [
|
return t.li({className}, [
|
||||||
spinner(t),
|
spinner(t),
|
||||||
t.div(vm.i18n`Loading more messages …`),
|
t.div(vm => vm.isLoading ? vm.i18n`Loading more messages …` : vm.i18n`Not loading!`),
|
||||||
t.if(vm => vm.error, t => t.strong(vm => vm.error))
|
t.if(vm => vm.error, t => t.strong(vm => vm.error))
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user