Skip to content
Snippets Groups Projects
Unverified Commit f92e07a3 authored by R Midhun Suresh's avatar R Midhun Suresh Committed by GitHub
Browse files

Merge pull request #57 from vector-im/button-spinner

Show a spinner within the button when waiting
parents 68385c1a 09f6aa7b
No related branches found
No related tags found
No related merge requests found
...@@ -204,3 +204,9 @@ body { ...@@ -204,3 +204,9 @@ body {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.PolicyAgreementView_next .loader {
width: 15px;
height: 15px;
font-size: 3px;
}
...@@ -35,7 +35,9 @@ class PolicyAgreementView extends TemplateView<AccountSetupViewModel> { ...@@ -35,7 +35,9 @@ class PolicyAgreementView extends TemplateView<AccountSetupViewModel> {
]), ]),
t.div({ className: "PolicyAgreementView_btn-collection" }, t.div({ className: "PolicyAgreementView_btn-collection" },
[ [
t.button({ onClick: () => vm.completeRegistration(), className: "PolicyAgreementView_next", }, "Accept and continue to chat"), t.button({ onClick: () => vm.completeRegistration(), className: "PolicyAgreementView_next", },
t.map(vm => vm.showButtonSpinner, (showButtonSpinner, t) => showButtonSpinner? t.div({ className: "loader" }): t.span("Accept and continue to chat"))
),
t.button({ onClick: () => vm.minimize(), className: "button-action PolicyAgreementView_cancel", }, "Cancel"), t.button({ onClick: () => vm.minimize(), className: "button-action PolicyAgreementView_cancel", }, "Cancel"),
]), ]),
]); ]);
......
...@@ -11,6 +11,7 @@ export class AccountSetupViewModel extends ViewModel { ...@@ -11,6 +11,7 @@ export class AccountSetupViewModel extends ViewModel {
private _password: string; private _password: string;
private _registration: any; private _registration: any;
private _privacyPolicyLink: string; private _privacyPolicyLink: string;
private _showButtonSpinner: boolean = false;
constructor(options) { constructor(options) {
super(options); super(options);
...@@ -66,6 +67,8 @@ export class AccountSetupViewModel extends ViewModel { ...@@ -66,6 +67,8 @@ export class AccountSetupViewModel extends ViewModel {
} }
async completeRegistration() { async completeRegistration() {
this._showButtonSpinner = true;
this.emitChange("showButtonSpinner");
let stage = this._startStage; let stage = this._startStage;
while (stage) { while (stage) {
if ( if (
...@@ -113,4 +116,8 @@ export class AccountSetupViewModel extends ViewModel { ...@@ -113,4 +116,8 @@ export class AccountSetupViewModel extends ViewModel {
get footerViewModel() { get footerViewModel() {
return this.options.footerVM; return this.options.footerVM;
} }
get showButtonSpinner(): boolean {
return this._showButtonSpinner;
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment