From b17ce2ee13dbac5fea33a60fd8f0040e2b046131 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Tue, 24 Aug 2021 12:24:09 -0700 Subject: [PATCH] Take the hiding code out of the root view model --- src/RootView.js | 28 +++++++++++++--------------- src/RootViewModel.js | 10 ---------- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/src/RootView.js b/src/RootView.js index c076ac7..315fbd9 100644 --- a/src/RootView.js +++ b/src/RootView.js @@ -21,23 +21,21 @@ import {LoadServerPolicyView} from "./policy/LoadServerPolicyView.js"; export class RootView extends TemplateView { render(t, vm) { - return t.if(vm => !vm.hidden, - vm => t.div({className: "RootView"}, [ - t.mapView(vm => vm.openLinkViewModel, vm => vm ? new OpenLinkView(vm) : null), - t.mapView(vm => vm.createLinkViewModel, vm => vm ? new CreateLinkView(vm) : null), - t.mapView(vm => vm.loadServerPolicyViewModel, vm => vm ? new LoadServerPolicyView(vm) : null), - t.div({className: "footer"}, [ - t.p(t.img({src: "images/matrix-logo.svg"})), - t.p(["This invite uses ", externalLink(t, "https://matrix.org", "Matrix"), ", an open network for secure, decentralized communication."]), - t.ul({className: "links"}, [ - t.li(externalLink(t, "https://github.com/matrix-org/matrix.to", "GitHub project")), - t.li(externalLink(t, "https://github.com/matrix-org/matrix.to/tree/main/src/open/clients", "Add your app")), - t.li({className: {hidden: vm => !vm.hasPreferences}}, - t.button({className: "text", onClick: () => vm.clearPreferences()}, "Clear preferences")), - ]) + return t.div({className: "RootView"}, [ + t.mapView(vm => vm.openLinkViewModel, vm => vm ? new OpenLinkView(vm) : null), + t.mapView(vm => vm.createLinkViewModel, vm => vm ? new CreateLinkView(vm) : null), + t.mapView(vm => vm.loadServerPolicyViewModel, vm => vm ? new LoadServerPolicyView(vm) : null), + t.div({className: "footer"}, [ + t.p(t.img({src: "images/matrix-logo.svg"})), + t.p(["This invite uses ", externalLink(t, "https://matrix.org", "Matrix"), ", an open network for secure, decentralized communication."]), + t.ul({className: "links"}, [ + t.li(externalLink(t, "https://github.com/matrix-org/matrix.to", "GitHub project")), + t.li(externalLink(t, "https://github.com/matrix-org/matrix.to/tree/main/src/open/clients", "Add your app")), + t.li({className: {hidden: vm => !vm.hasPreferences}}, + t.button({className: "text", onClick: () => vm.clearPreferences()}, "Clear preferences")), ]) ]) - ); + ]); } } diff --git a/src/RootViewModel.js b/src/RootViewModel.js index c725c91..6c05cc9 100644 --- a/src/RootViewModel.js +++ b/src/RootViewModel.js @@ -25,7 +25,6 @@ import {Platform} from "./Platform.js"; export class RootViewModel extends ViewModel { constructor(options) { super(options); - this.hidden = false; this.link = null; this.openLinkViewModel = null; this.createLinkViewModel = null; @@ -59,15 +58,6 @@ export class RootViewModel extends ViewModel { } else { const oldLink = this.link; this.link = Link.parse(hash); - const matrixUrl = this.link.toMatrixUrl() - if (matrixUrl) { - this.hidden = true; - setTimeout(() => { - this.hidden = false; - this.emitChange(); - }, 1000); - this.openLink(this.link.toMatrixUrl()); - } this._updateChildVMs(oldLink); } }