Calculate path when button is clicked

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
RMidhunSuresh 2021-06-04 13:21:49 +05:30
parent 37e052c061
commit b2448e1207
2 changed files with 9 additions and 6 deletions

View file

@ -44,7 +44,8 @@ export class RoomInfoViewModel extends ViewModel {
return this.name; return this.name;
} }
get closeLink() { closePanel() {
return this.urlCreator.urlUntilSegment("room"); const path = this.navigation.path.until("room");
this.navigation.applyPath(path);
} }
} }

View file

@ -8,7 +8,7 @@ export class RoomInfoView extends TemplateView {
const encryptionString = vm.isEncrypted ? vm.i18n`On` : vm.i18n`Off`; const encryptionString = vm.isEncrypted ? vm.i18n`On` : vm.i18n`Off`;
return t.div({ className: "RoomInfo" }, [ return t.div({ className: "RoomInfo" }, [
this._createButton(vm), this._createButton(t, vm),
t.div({ className: "RoomAvatar" }, t.div({ className: "RoomAvatar" },
[t.view(new AvatarView(vm, 52)), this._createEncryptionIcon(vm.isEncrypted)]), [t.view(new AvatarView(vm, 52)), this._createEncryptionIcon(vm.isEncrypted)]),
t.div({ className: "RoomName" }, [t.h2(vm.name)]), t.div({ className: "RoomName" }, [t.h2(vm.name)]),
@ -40,8 +40,10 @@ export class RoomInfoView extends TemplateView {
[tag.div({ className: isEncrypted ? "encrypted" : "unencrypted" })]) [tag.div({ className: isEncrypted ? "encrypted" : "unencrypted" })])
} }
_createButton(vm) { _createButton(t, vm) {
return tag.div({ className: "buttons" }, return t.div({ className: "buttons" },
[tag.a({ className: "close button-utility", href: vm.closeLink })]); [
t.button({ className: "close button-utility", onClick: () => vm.closePanel() })
]);
} }
} }