Display a little message while trying to redirect

This commit is contained in:
Danila Fedorin 2021-08-24 13:12:40 -07:00
parent b239f49580
commit c26b8dcec1
3 changed files with 38 additions and 4 deletions

View file

@ -50,3 +50,23 @@ limitations under the License.
border-bottom: 1px solid var(--grey); border-bottom: 1px solid var(--grey);
padding: 4px 0; padding: 4px 0;
} }
.OpeningClientView {
display: flex;
align-items: center;
flex-direction: column;
margin: 0;
}
.OpeningClientView .defaultAvatar {
width: 64px;
height: 64px;
background-image: url('../images/chat-icon.svg');
background-repeat: no-repeat;
background-position: center;
background-size: 85%;
}
.OpeningClientView .spinner {
margin-top: 15px;
}

View file

@ -22,10 +22,24 @@ import {ServerConsentView} from "./ServerConsentView.js";
export class OpenLinkView extends TemplateView { export class OpenLinkView extends TemplateView {
render(t, vm) { render(t, vm) {
return t.div({className: "OpenLinkView card"}, [ return t.div({className: "OpenLinkView card"}, [
t.map(vm => vm.tryingLink, tryingLink => tryingLink ?
t.view(new TryingLinkView(vm)) :
t.mapView(vm => vm.previewViewModel, previewVM => previewVM ? t.mapView(vm => vm.previewViewModel, previewVM => previewVM ?
new ShowLinkView(vm) : new ShowLinkView(vm) :
new ServerConsentView(vm.serverConsentViewModel) new ServerConsentView(vm.serverConsentViewModel)
), ),
),
]);
}
}
class TryingLinkView extends TemplateView {
render (t, vm) {
return t.div({ className: "OpeningClientView" }, [
t.div({className: "defaultAvatar"}),
t.h1("Trying to open your default client..."),
t.span("If this doesn't work, you will be redirected shortly."),
t.div({className: "spinner"}),
]); ]);
} }
} }

View file

@ -48,7 +48,7 @@ export class OpenLinkViewModel extends ViewModel {
setTimeout(() => { setTimeout(() => {
this.tryingLink = false; this.tryingLink = false;
this.emitChange(); this.emitChange();
}, 5000); }, 1000);
this.openLink(matrixUrl); this.openLink(matrixUrl);
} }
} }