From 7114e5a1ef9ad2332296cc6557bdd8f2ca37b8ea Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 2 Dec 2020 13:00:26 +0100 Subject: [PATCH] show member count and topic for room preview --- src/preview/PreviewView.js | 2 ++ src/preview/PreviewViewModel.js | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/preview/PreviewView.js b/src/preview/PreviewView.js index ffa0996..81e55ec 100644 --- a/src/preview/PreviewView.js +++ b/src/preview/PreviewView.js @@ -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", diff --git a/src/preview/PreviewViewModel.js b/src/preview/PreviewViewModel.js index cf024df..b282642 100644 --- a/src/preview/PreviewViewModel.js +++ b/src/preview/PreviewViewModel.js @@ -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() {