mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
dedicated template view for gaps
This commit is contained in:
parent
69be5012e8
commit
f9038e2af9
@ -1,6 +1,7 @@
|
|||||||
import TimelineTile from "./TimelineTile.js";
|
import TimelineTile from "./TimelineTile.js";
|
||||||
import ListView from "./ListView.js";
|
import ListView from "./ListView.js";
|
||||||
import * as html from "./html.js";
|
import * as html from "./html.js";
|
||||||
|
import GapView from "./timeline/GapView.js";
|
||||||
|
|
||||||
export default class RoomView {
|
export default class RoomView {
|
||||||
constructor(viewModel) {
|
constructor(viewModel) {
|
||||||
@ -16,7 +17,9 @@ export default class RoomView {
|
|||||||
this._nameLabel = html.h2(null, this._viewModel.name);
|
this._nameLabel = html.h2(null, this._viewModel.name);
|
||||||
this._errorLabel = html.div({className: "RoomView_error"});
|
this._errorLabel = html.div({className: "RoomView_error"});
|
||||||
|
|
||||||
this._timelineList = new ListView({}, entry => new TimelineTile(entry));
|
this._timelineList = new ListView({}, entry => {
|
||||||
|
return entry.shape === "gap" ? new GapView(entry) : new TimelineTile(entry);
|
||||||
|
});
|
||||||
this._timelineList.mount();
|
this._timelineList.mount();
|
||||||
|
|
||||||
this._root = html.div({className: "RoomView"}, [
|
this._root = html.div({className: "RoomView"}, [
|
||||||
|
15
src/ui/web/timeline/GapView.js
Normal file
15
src/ui/web/timeline/GapView.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import TemplateView from "../TemplateView.js";
|
||||||
|
|
||||||
|
export default class GapView extends TemplateView {
|
||||||
|
render(t, vm) {
|
||||||
|
const className = {
|
||||||
|
gap: true,
|
||||||
|
loading: vm => vm.isLoading
|
||||||
|
};
|
||||||
|
const label = (vm.isUp ? "🠝" : "🠟") + " fill gap"; //no binding
|
||||||
|
return t.li({className}, [
|
||||||
|
t.button({onClick: () => this.viewModel.fill(), disabled: vm => vm.isLoading}, label),
|
||||||
|
t.if(vm => vm.error, t => t.strong(vm => vm.error))
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user