Make less assumptions about auto redirect etc. in View code

This commit is contained in:
Danila Fedorin 2021-08-27 10:08:54 -07:00
parent 64129caaff
commit bc9e091d8b

View file

@ -38,9 +38,8 @@ export class OpenLinkView extends TemplateView {
class TryingLinkView extends TemplateView { class TryingLinkView extends TemplateView {
render (t, vm) { render (t, vm) {
const explanation = vm.autoRedirect ? const explanation = vm.name ? t.span(["Click ", t.strong(`"Open ${vm.name}"`), " to launch the desktop app."]) : [];
"If this doesn't work, you will be redirected shortly." : const redirectNotice = vm.autoRedirect ? "If this doesn't work, you will be redirected shortly." : [];
t.span(["Click ", t.strong(`"Open ${vm.name}"`), " to launch the desktop app."]);
const webLink = vm.webDeepLink ? const webLink = vm.webDeepLink ?
t.span(["You can also ", t.a({ t.span(["You can also ", t.a({
href: vm.webDeepLink, href: vm.webDeepLink,
@ -59,6 +58,7 @@ class TryingLinkView extends TemplateView {
vm.iconUrl ? t.img({ className: "clientIcon", src: vm.iconUrl }) : t.div({className: "defaultAvatar"}), vm.iconUrl ? t.img({ className: "clientIcon", src: vm.iconUrl }) : t.div({className: "defaultAvatar"}),
t.h1(vm.name ? `Opening ${vm.name}` : "Trying to open your default client..."), t.h1(vm.name ? `Opening ${vm.name}` : "Trying to open your default client..."),
explanation, explanation,
redirectNotice,
webLink, webLink,
t.map(vm => vm.trying, trying => trying ? t.map(vm => vm.trying, trying => trying ?
t.div({className: "spinner"}) : t.div({className: "spinner"}) :