basic styling

This commit is contained in:
Bruno Windels
2020-11-30 12:49:16 +01:00
parent b14b404534
commit 91b328f540
5 changed files with 323 additions and 5 deletions
+9 -5
View File
@@ -19,11 +19,15 @@ import {TemplateView} from "../utils/TemplateView.js";
export class PreviewView extends TemplateView {
render(t, vm) {
return t.div({className: "PreviewView"}, [
t.p(t.img({src: vm => vm.avatarUrl})),
t.p(vm => vm.name),
t.p(vm => vm.identifier),
t.p(["Can preview from ", vm => vm._consentedServers.join(", ")]),
t.p(["loading: ", vm => vm.loading])
t.h2({className: {hidden: vm => !vm.loading}}, "Loading preview…"),
t.div({className: {preview: true, hidden: vm => vm.loading}}, [
t.p(t.img({className: "avatar", src: vm => vm.avatarUrl})),
t.div({className: "profileInfo"}, [
t.h2(vm => vm.name),
t.p(vm => vm.identifier),
t.p(["Preview from ", vm => vm.previewDomain]),
])
])
]);
}
}
+2
View File
@@ -27,6 +27,7 @@ export class PreviewViewModel extends ViewModel {
this.loading = false;
this.name = null;
this.avatarUrl = null;
this.previewDomain = null;
}
async load() {
@@ -40,6 +41,7 @@ export class PreviewViewModel extends ViewModel {
await this._loadUserPreview(homeserver, this._link.identifier);
}
// assume we're done if nothing threw
this.previewDomain = server;
break;
} catch (err) {
continue;