render avatar in room header

This commit is contained in:
Bruno Windels 2020-08-20 17:33:08 +02:00
parent 00718c582a
commit 4fefe94302
2 changed files with 14 additions and 2 deletions

View File

@ -87,7 +87,7 @@ export class RoomViewModel extends ViewModel {
return "";
}
get avatarInitials() {
get avatarLetter() {
return avatarInitials(this._room.name);
}
@ -95,6 +95,17 @@ export class RoomViewModel extends ViewModel {
return getIdentifierColorNumber(this._room.id)
}
get avatarUrl() {
if (this._room.avatarUrl) {
return this._room.mediaRepository.mxcUrlThumbnail(this._room.avatarUrl, 32, 32, "crop");
}
return null;
}
get avatarTitle() {
return this.name;
}
async _sendMessage(message) {
if (message) {
try {

View File

@ -19,6 +19,7 @@ import {TemplateView} from "../../general/TemplateView.js";
import {TimelineList} from "./TimelineList.js";
import {TimelineLoadingView} from "./TimelineLoadingView.js";
import {MessageComposer} from "./MessageComposer.js";
import {renderAvatar} from "../../common.js";
export class RoomView extends TemplateView {
render(t, vm) {
@ -26,7 +27,7 @@ export class RoomView extends TemplateView {
t.div({className: "TimelinePanel"}, [
t.div({className: "RoomHeader"}, [
t.button({className: "back", onClick: () => vm.close()}),
t.div({className: `avatar usercolor${vm.avatarColorNumber}`}, vm => vm.avatarInitials),
renderAvatar(t, vm, 32),
t.div({className: "room-description"}, [
t.h2(vm => vm.name),
]),