From bba2d9f0a9314d0172f4d7202798502a5573b99f Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Fri, 26 Aug 2022 14:55:01 +0530 Subject: [PATCH] Use t.map --- src/platform/web/ui/ForcedLogoutView.js | 45 +++++++++++++------------ 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/src/platform/web/ui/ForcedLogoutView.js b/src/platform/web/ui/ForcedLogoutView.js index 9add5504..2c2aab97 100644 --- a/src/platform/web/ui/ForcedLogoutView.js +++ b/src/platform/web/ui/ForcedLogoutView.js @@ -14,31 +14,32 @@ See the License for the specific language governing permissions and limitations under the License. */ -import {TemplateView, InlineTemplateView} from "./general/TemplateView"; +import {TemplateView} from "./general/TemplateView"; import {spinner} from "./common.js"; export class ForcedLogoutView extends TemplateView { - render(t, vm) { - const proceedView = new InlineTemplateView(vm, t => { - return t.div([ - t.p("Your access token is no longer valid! You can reauthenticate in the next screen."), - t.div({ className: "button-row" }, [ - t.button({ - className: "button-action primary", - type: "submit", - onClick: () => vm.proceed(), - }, vm.i18n`Proceed`) - ]), - ]); - }); - const progressView = new InlineTemplateView(vm, t => { - return t.p({className: "status"}, [spinner(t, {hidden: vm => !vm.showSpinner}), t.span(vm => vm.status)]); - }); - - return t.div({className: "LogoutScreen"}, [ - t.div({className: "content"}, - t.mapView(vm => vm.showStatus, showStatus => { - return showStatus? progressView: proceedView; + render(t) { + return t.div({ className: "LogoutScreen" }, [ + t.div({ className: "content" }, + t.map(vm => vm.showStatus, (showStatus, t, vm) => { + if (showStatus) { + return t.p({ className: "status" }, [ + spinner(t, { hidden: vm => !vm.showSpinner }), + t.span(vm => vm.status) + ]); + } + else { + return t.div([ + t.p("Your access token is no longer valid! You can reauthenticate in the next screen."), + t.div({ className: "button-row" }, [ + t.button({ + className: "button-action primary", + type: "submit", + onClick: () => vm.proceed(), + }, vm.i18n`Proceed`) + ]), + ]); + } }) ), ]);