2020-04-21 00:56:39 +05:30
|
|
|
import {TemplateView} from "../../general/TemplateView.js";
|
|
|
|
import {TimelineList} from "./TimelineList.js";
|
|
|
|
import {MessageComposer} from "./MessageComposer.js";
|
2019-02-28 03:20:08 +05:30
|
|
|
|
2020-04-21 00:56:39 +05:30
|
|
|
export class RoomView extends TemplateView {
|
2019-02-28 03:20:08 +05:30
|
|
|
constructor(viewModel) {
|
2019-06-16 18:51:20 +05:30
|
|
|
super(viewModel, true);
|
2019-02-28 03:20:08 +05:30
|
|
|
this._timelineList = null;
|
|
|
|
}
|
|
|
|
|
2019-06-27 02:44:39 +05:30
|
|
|
render(t, vm) {
|
2019-06-16 18:51:20 +05:30
|
|
|
return t.div({className: "RoomView"}, [
|
|
|
|
t.div({className: "TimelinePanel"}, [
|
|
|
|
t.div({className: "RoomHeader"}, [
|
2019-06-27 02:44:39 +05:30
|
|
|
t.button({className: "back", onClick: () => vm.close()}),
|
2019-06-16 18:51:20 +05:30
|
|
|
t.div({className: "avatar large"}, vm => vm.avatarInitials),
|
|
|
|
t.div({className: "room-description"}, [
|
|
|
|
t.h2(vm => vm.name),
|
|
|
|
]),
|
|
|
|
]),
|
|
|
|
t.div({className: "RoomView_error"}, vm => vm.error),
|
2019-07-27 14:10:56 +05:30
|
|
|
this._timelineList.mount(),
|
|
|
|
this._composer.mount(),
|
2019-06-16 18:51:20 +05:30
|
|
|
])
|
2019-02-28 03:20:08 +05:30
|
|
|
]);
|
2019-06-16 18:51:20 +05:30
|
|
|
}
|
2019-02-28 03:20:08 +05:30
|
|
|
|
2019-06-16 18:51:20 +05:30
|
|
|
mount() {
|
2019-07-27 14:10:56 +05:30
|
|
|
this._composer = new MessageComposer(this.viewModel);
|
2019-06-16 18:51:20 +05:30
|
|
|
this._timelineList = new TimelineList();
|
|
|
|
return super.mount();
|
2019-02-28 03:20:08 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
unmount() {
|
2019-07-27 14:10:56 +05:30
|
|
|
this._composer.unmount();
|
2019-02-28 03:20:08 +05:30
|
|
|
this._timelineList.unmount();
|
2019-06-16 18:51:20 +05:30
|
|
|
super.unmount();
|
2019-02-28 03:20:08 +05:30
|
|
|
}
|
|
|
|
|
2019-06-16 18:51:20 +05:30
|
|
|
update(value, prop) {
|
|
|
|
super.update(value, prop);
|
|
|
|
if (prop === "timelineViewModel") {
|
2019-06-16 20:59:33 +05:30
|
|
|
this._timelineList.update({viewModel: this.viewModel.timelineViewModel});
|
2019-02-28 03:20:08 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|