From ef2acf81efe4c4f8f6da8c16f0735f88abcb7487 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 12 Apr 2021 15:10:02 +0200 Subject: [PATCH] use map rather than mapView where it makes sense --- src/open/ClientListView.js | 10 ++++------ src/preview/PreviewView.js | 6 +++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/open/ClientListView.js b/src/open/ClientListView.js index 3fc43ab..8834cdf 100644 --- a/src/open/ClientListView.js +++ b/src/open/ClientListView.js @@ -33,12 +33,10 @@ class AllClientsView extends TemplateView { render(t, vm) { return t.div({className: "ClientListView"}, [ t.h2("Choose an app to continue"), - t.mapView(vm => vm.clientList, () => { - return new TemplateView(vm, t => { - return t.div({className: "list"}, vm.clientList.map(clientViewModel => { - return t.view(new ClientView(clientViewModel)); - })); - }); + t.map(vm => vm.clientList, (clientList, t) => { + return t.div({className: "list"}, clientList.map(clientViewModel => { + return t.view(new ClientView(clientViewModel)); + })); }), t.div(t.label([ t.input({ diff --git a/src/preview/PreviewView.js b/src/preview/PreviewView.js index 4d16075..0fedfb6 100644 --- a/src/preview/PreviewView.js +++ b/src/preview/PreviewView.js @@ -44,11 +44,11 @@ class LoadingPreviewView extends TemplateView { class LoadedPreviewView extends TemplateView { render(t, vm) { - const avatar = t.mapView(vm => vm.avatarUrl, avatarUrl => { + const avatar = t.map(vm => vm.avatarUrl, (avatarUrl, t) => { if (avatarUrl) { - return new TemplateView(avatarUrl, (t, src) => t.img({className: "avatar", src})); + return t.img({className: "avatar", src: avatarUrl}); } else { - return new TemplateView(null, t => t.div({className: "defaultAvatar"})); + return t.div({className: "defaultAvatar"}); } }); return t.div([