forked from mystiq/hydrogen-web
Add room avatar to RoomInfoView
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
parent
0ea2843454
commit
6f1b77b6fa
2 changed files with 19 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
import { ViewModel } from "../../ViewModel.js";
|
||||
import { avatarInitials, getIdentifierColorNumber, getAvatarHttpUrl } from "../../avatar.js";
|
||||
|
||||
export class RoomInfoViewModel extends ViewModel {
|
||||
constructor(options) {
|
||||
|
@ -22,4 +23,20 @@ export class RoomInfoViewModel extends ViewModel {
|
|||
get memberCount() {
|
||||
return this._roomSummary.joinCount;
|
||||
}
|
||||
|
||||
get avatarLetter() {
|
||||
return avatarInitials(this.name);
|
||||
}
|
||||
|
||||
get avatarColorNumber() {
|
||||
return getIdentifierColorNumber(this.roomId)
|
||||
}
|
||||
|
||||
avatarUrl(size) {
|
||||
return getAvatarHttpUrl(this._room.avatarUrl, size, this.platform, this._room.mediaRepository);
|
||||
}
|
||||
|
||||
get avatarTitle() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import { TemplateView } from "../../general/TemplateView.js";
|
||||
import { text } from "../../general/html.js";
|
||||
import { AvatarView } from "../../avatar.js";
|
||||
|
||||
export class RoomInfoView extends TemplateView {
|
||||
render(t, vm) {
|
||||
return t.div({ className: "RoomInfo" }, [
|
||||
t.div({ className: "RoomAvatar" }, [t.view(new AvatarView(vm, 50))]),
|
||||
t.div({ className: "RoomName" }, [text(vm.name)]),
|
||||
t.div({ className: "RoomId" }, [text(vm.roomId)]),
|
||||
t.div({ className: "RoomMemberCount" }, [text(vm.memberCount)]),
|
||||
|
|
Loading…
Reference in a new issue