Add a very basic, unstyled view of the message to the composer.

This commit is contained in:
Danila Fedorin 2021-07-22 12:28:24 -07:00
parent 94ae5faa3c
commit 66f686210f

View File

@ -17,6 +17,7 @@ limitations under the License.
import {TemplateView} from "../../general/TemplateView.js"; import {TemplateView} from "../../general/TemplateView.js";
import {Popup} from "../../general/Popup.js"; import {Popup} from "../../general/Popup.js";
import {Menu} from "../../general/Menu.js"; import {Menu} from "../../general/Menu.js";
import {TextMessageView} from "./timeline/TextMessageView.js";
export class MessageComposer extends TemplateView { export class MessageComposer extends TemplateView {
constructor(viewModel) { constructor(viewModel) {
@ -33,6 +34,16 @@ export class MessageComposer extends TemplateView {
onInput: () => vm.setInput(this._input.value), onInput: () => vm.setInput(this._input.value),
}); });
return t.div({className: "MessageComposer"}, [ return t.div({className: "MessageComposer"}, [
t.map(vm => vm.replyViewModel, (rvm, t) => !rvm ? null :
t.div({
className: "replyBox"
}, [
t.span('Replying'),
t.span({onClick: () => this._clearReplyingTo()}, 'Close'),
// TODO need proper view, not just assumed TextMessageView
t.view(new TextMessageView(vm.replyViewModel, true))
])
),
this._input, this._input,
t.button({ t.button({
className: "sendFile", className: "sendFile",
@ -48,6 +59,10 @@ export class MessageComposer extends TemplateView {
]); ]);
} }
_clearReplyingTo() {
this.value.clearReplyingTo();
}
_trySend() { _trySend() {
this._input.focus(); this._input.focus();
if (this.value.sendMessage(this._input.value)) { if (this.value.sendMessage(this._input.value)) {