From e13c943d3f0ac802974a87c6ff7e2dcf6dcc9d9c Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 7 Dec 2020 14:18:19 +0100 Subject: [PATCH] show back button also in install client screen --- src/open/ClientView.js | 20 ++++++++++---------- src/open/ClientViewModel.js | 1 + 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/open/ClientView.js b/src/open/ClientView.js index 8859f4b..7bc9868 100644 --- a/src/open/ClientView.js +++ b/src/open/ClientView.js @@ -57,11 +57,7 @@ class OpenClientView extends TemplateView { rel: "noopener noreferrer", onClick: () => vm.deepLinkActivated(), }, "Continue"), - t.p({className: {previewSource: true, hidden: vm => !vm.showBack}}, [ - `Continue with ${vm.name}.`, - " ", - t.button({className: "text", onClick: () => vm.back()}, "Change"), - ]), + showBack(t, vm), ]); } } @@ -117,12 +113,16 @@ class InstallClientView extends TemplateView { children.push(t.p([`If you already have ${vm.name} installed, you can `, deepLink, "."])) } - children.push(t.p({className: {previewSource: true, hidden: vm => !vm.showBack}}, [ - `Continue with ${vm.name}.`, - " ", - t.button({className: "text", onClick: () => vm.back()}, "Change"), - ])); + children.push(showBack(t, vm)); return t.div({className: "InstallClientView"}, children); } } + +function showBack(t, vm) { + return t.p({className: {previewSource: true, hidden: vm => !vm.showBack}}, [ + `Continue with ${vm.name}.`, + " ", + t.button({className: "text", onClick: () => vm.back()}, "Change"), + ]); +} diff --git a/src/open/ClientViewModel.js b/src/open/ClientViewModel.js index 7c26324..dd2fb43 100644 --- a/src/open/ClientViewModel.js +++ b/src/open/ClientViewModel.js @@ -163,6 +163,7 @@ export class ClientViewModel extends ViewModel { } get showBack() { + // if we're not only showing this client, don't show back (see pick()) return !!this._clientListViewModel; }