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) {
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({

View File

@ -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([