forked from mystiq/hydrogen-web
render avatar in room header
This commit is contained in:
parent
00718c582a
commit
4fefe94302
2 changed files with 14 additions and 2 deletions
|
@ -87,13 +87,24 @@ export class RoomViewModel extends ViewModel {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
get avatarInitials() {
|
get avatarLetter() {
|
||||||
return avatarInitials(this._room.name);
|
return avatarInitials(this._room.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
get avatarColorNumber() {
|
get avatarColorNumber() {
|
||||||
return getIdentifierColorNumber(this._room.id)
|
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) {
|
async _sendMessage(message) {
|
||||||
if (message) {
|
if (message) {
|
||||||
|
|
|
@ -19,6 +19,7 @@ import {TemplateView} from "../../general/TemplateView.js";
|
||||||
import {TimelineList} from "./TimelineList.js";
|
import {TimelineList} from "./TimelineList.js";
|
||||||
import {TimelineLoadingView} from "./TimelineLoadingView.js";
|
import {TimelineLoadingView} from "./TimelineLoadingView.js";
|
||||||
import {MessageComposer} from "./MessageComposer.js";
|
import {MessageComposer} from "./MessageComposer.js";
|
||||||
|
import {renderAvatar} from "../../common.js";
|
||||||
|
|
||||||
export class RoomView extends TemplateView {
|
export class RoomView extends TemplateView {
|
||||||
render(t, vm) {
|
render(t, vm) {
|
||||||
|
@ -26,7 +27,7 @@ export class RoomView extends TemplateView {
|
||||||
t.div({className: "TimelinePanel"}, [
|
t.div({className: "TimelinePanel"}, [
|
||||||
t.div({className: "RoomHeader"}, [
|
t.div({className: "RoomHeader"}, [
|
||||||
t.button({className: "back", onClick: () => vm.close()}),
|
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.div({className: "room-description"}, [
|
||||||
t.h2(vm => vm.name),
|
t.h2(vm => vm.name),
|
||||||
]),
|
]),
|
||||||
|
|
Loading…
Reference in a new issue