mirror of
https://github.com/FJurmanovic/wallet-web.git
synced 2026-02-06 06:08:10 +00:00
added subscription modal
This commit is contained in:
@@ -144,6 +144,8 @@ class AppDropdownElement extends BaseComponentElement {
|
||||
setOpen = (isOpen) => {
|
||||
this.isOpen = isOpen;
|
||||
if (!isOpen) {
|
||||
const active = this.appMain.activeElement;
|
||||
if (active.closest('app-link') || active.closest('a') || active.closest('button')) return;
|
||||
this.validate();
|
||||
this.update();
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ class AppMainElement extends HTMLElement {
|
||||
walletupdate: new Event('walletupdate'),
|
||||
transactionupdate: new Event('transactionupdate'),
|
||||
};
|
||||
activeElement: HTMLElement = this;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
@@ -105,8 +106,25 @@ class AppMainElement extends HTMLElement {
|
||||
},
|
||||
]);
|
||||
this.routerService.init();
|
||||
this.addEventListener('mousedown', this.setActiveElement, false);
|
||||
this.addEventListener('tokenchange', this.closeOffToken);
|
||||
}
|
||||
|
||||
closeOffToken = () => {
|
||||
if (!this.isAuth) {
|
||||
this.closeModal();
|
||||
}
|
||||
};
|
||||
|
||||
disconnectedCallback = () => {
|
||||
this.removeEventListener('mousedown', this.setActiveElement);
|
||||
this.removeEventListener('tokenchange', this.closeOffToken);
|
||||
};
|
||||
|
||||
setActiveElement = (e) => {
|
||||
this.activeElement = e?.target || this;
|
||||
};
|
||||
|
||||
middleAuth = () => {
|
||||
if (!this.isAuth) {
|
||||
this.routerService.goTo('/unauthorized');
|
||||
|
||||
@@ -58,6 +58,8 @@ class InputFieldElement extends BaseComponentElement {
|
||||
};
|
||||
|
||||
validateDisplay = () => {
|
||||
const active = this.appMain.activeElement;
|
||||
if (active.closest('app-link') || active.closest('a') || active.closest('button')) return;
|
||||
if (!this.validate()) {
|
||||
this.displayError = true;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user