2020-08-05 22:08:55 +05:30
|
|
|
/*
|
|
|
|
Copyright 2020 Bruno Windels <bruno@windels.cloud>
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
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) {
|
2020-04-30 21:57:21 +05:30
|
|
|
super(viewModel);
|
2019-02-28 03:20:08 +05:30
|
|
|
this._timelineList = null;
|
|
|
|
}
|
|
|
|
|
2019-06-27 02:44:39 +05:30
|
|
|
render(t, vm) {
|
2020-05-05 01:53:43 +05:30
|
|
|
this._timelineList = new TimelineList();
|
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()}),
|
2020-08-13 16:11:00 +05:30
|
|
|
t.div({className: `avatar large usercolor${vm.avatarColorNumber}`}, vm => vm.avatarInitials),
|
2019-06-16 18:51:20 +05:30
|
|
|
t.div({className: "room-description"}, [
|
|
|
|
t.h2(vm => vm.name),
|
|
|
|
]),
|
|
|
|
]),
|
|
|
|
t.div({className: "RoomView_error"}, vm => vm.error),
|
2020-05-05 01:53:43 +05:30
|
|
|
t.view(this._timelineList),
|
|
|
|
t.view(new MessageComposer(this.value.composerViewModel)),
|
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
|
|
|
update(value, prop) {
|
|
|
|
super.update(value, prop);
|
|
|
|
if (prop === "timelineViewModel") {
|
2020-04-30 21:57:21 +05:30
|
|
|
this._timelineList.update({viewModel: this.value.timelineViewModel});
|
2019-02-28 03:20:08 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|