show member count and topic for room preview

This commit is contained in:
Bruno Windels 2020-12-02 13:00:26 +01:00
parent 173696f46e
commit 7114e5a1ef
2 changed files with 7 additions and 1 deletions

View file

@ -27,6 +27,8 @@ export class PreviewView extends TemplateView {
t.p(t.img({className: "avatar", src: vm => vm.avatarUrl})),
t.h1(vm => vm.name),
t.p(vm => vm.identifier),
t.p({className: {hidden: vm => !vm.memberCount}}, [vm => vm.memberCount, " members"]),
t.p({className: {hidden: vm => !vm.topic}}, [vm => vm.topic]),
]),
t.p({className: {hidden: vm => vm.clientsViewModel}}, t.button({
className: "primary fullwidth",

View file

@ -33,6 +33,8 @@ export class PreviewViewModel extends ViewModel {
this.name = null;
this.avatarUrl = null;
this.identifier = null;
this.memberCount = null;
this.topic = null;
this.previewDomain = null;
this.clientsViewModel = null;
this.acceptInstructions = null;
@ -91,7 +93,9 @@ export class PreviewViewModel extends ViewModel {
this.avatarUrl = publicRoom?.avatar_url ?
homeserver.mxcUrlThumbnail(publicRoom.avatar_url, 64, 64, "crop") :
null;
this.identifier = `${publicRoom?.canonical_alias || link.identifier} | ${publicRoom?.num_joined_members} members`;
this.memberCount = publicRoom?.num_joined_members;
this.topic = publicRoom?.topic;
this.identifier = publicRoom?.canonical_alias || link.identifier;
}
get showClientsLabel() {