use map rather than mapView where it makes sense

This commit is contained in:
Bruno Windels 2021-04-12 15:10:02 +02:00
parent d8f1371b60
commit ef2acf81ef
2 changed files with 7 additions and 9 deletions

View File

@ -33,12 +33,10 @@ class AllClientsView extends TemplateView {
render(t, vm) { render(t, vm) {
return t.div({className: "ClientListView"}, [ return t.div({className: "ClientListView"}, [
t.h2("Choose an app to continue"), t.h2("Choose an app to continue"),
t.mapView(vm => vm.clientList, () => { t.map(vm => vm.clientList, (clientList, t) => {
return new TemplateView(vm, t => { return t.div({className: "list"}, clientList.map(clientViewModel => {
return t.div({className: "list"}, vm.clientList.map(clientViewModel => { return t.view(new ClientView(clientViewModel));
return t.view(new ClientView(clientViewModel)); }));
}));
});
}), }),
t.div(t.label([ t.div(t.label([
t.input({ t.input({

View File

@ -44,11 +44,11 @@ class LoadingPreviewView extends TemplateView {
class LoadedPreviewView extends TemplateView { class LoadedPreviewView extends TemplateView {
render(t, vm) { render(t, vm) {
const avatar = t.mapView(vm => vm.avatarUrl, avatarUrl => { const avatar = t.map(vm => vm.avatarUrl, (avatarUrl, t) => {
if (avatarUrl) { if (avatarUrl) {
return new TemplateView(avatarUrl, (t, src) => t.img({className: "avatar", src})); return t.img({className: "avatar", src: avatarUrl});
} else { } else {
return new TemplateView(null, t => t.div({className: "defaultAvatar"})); return t.div({className: "defaultAvatar"});
} }
}); });
return t.div([ return t.div([