Create UI to open memberlist from details panel

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
RMidhunSuresh 2021-07-14 20:53:45 +05:30
parent 72f79e8bef
commit 8e55967db3
2 changed files with 17 additions and 1 deletions

View file

@ -62,4 +62,11 @@ export class RoomDetailsViewModel extends ViewModel {
super.dispose(); super.dispose();
this._room.off("change", this._onRoomChange); this._room.off("change", this._onRoomChange);
} }
openPanel(segment) {
let path = this.navigation.path.until("room");
path = path.with(this.navigation.segment("right-panel", true));
path = path.with(this.navigation.segment(segment, true));
this.navigation.applyPath(path);
}
} }

View file

@ -16,7 +16,8 @@ export class RoomDetailsView extends TemplateView {
this._createRoomAliasDisplay(vm), this._createRoomAliasDisplay(vm),
t.div({className: "RoomDetailsView_rows"}, t.div({className: "RoomDetailsView_rows"},
[ [
this._createRightPanelRow(t, vm.i18n`People`, {MemberCount: true}, vm => vm.memberCount), this._createRightPanelButtonRow(t, vm.i18n`People`, { MemberCount: true }, vm => vm.memberCount,
() => vm.openPanel("members")),
this._createRightPanelRow(t, vm.i18n`Encryption`, {EncryptionStatus: true}, encryptionString) this._createRightPanelRow(t, vm.i18n`Encryption`, {EncryptionStatus: true}, encryptionString)
]) ])
]); ]);
@ -35,6 +36,14 @@ export class RoomDetailsView extends TemplateView {
]); ]);
} }
_createRightPanelButtonRow(t, label, labelClass, value, onClick) {
const labelClassString = classNames({RoomDetailsView_label: true, ...labelClass});
return t.button({className: "RoomDetailsView_row", onClick}, [
t.div({className: labelClassString}, [label]),
t.div({className: "RoomDetailsView_value"}, value)
]);
}
_createButton(t, vm) { _createButton(t, vm) {
return t.div({className: "RoomDetailsView_buttons"}, return t.div({className: "RoomDetailsView_buttons"},
[ [