fix(alerts): not being able to claim rewards

This commit is contained in:
Miodec 2024-03-01 18:11:59 +01:00
parent 03311d8d6f
commit d0fe0f536f
2 changed files with 41 additions and 22 deletions

View file

@ -422,27 +422,36 @@ NotificationEvent.subscribe((message, level, customTitle) => {
}
});
const modal = new AnimatedModal("alertsPopup", {
show: {
modal: {
from: {
marginRight: "-10rem",
const modal = new AnimatedModal(
"alertsPopup",
{
show: {
modal: {
from: {
marginRight: "-10rem",
},
to: {
marginRight: "0",
},
easing: "easeOutCirc",
},
to: {
marginRight: "0",
},
hide: {
modal: {
from: {
marginRight: "0",
},
to: {
marginRight: "-10rem",
},
easing: "easeInCirc",
},
easing: "easeOutCirc",
},
},
hide: {
modal: {
from: {
marginRight: "0",
},
to: {
marginRight: "-10rem",
},
easing: "easeInCirc",
},
() => {
hide();
},
});
() => {
hide();
}
);

View file

@ -37,7 +37,9 @@ export default class AnimatedModal {
constructor(
wrapperId: string,
customAnimations?: ConstructorCustomAnimations
customAnimations?: ConstructorCustomAnimations,
customEscapeHandler?: (e: KeyboardEvent) => void,
customWrapperClickHandler?: (e: MouseEvent) => void
) {
if (wrapperId.startsWith("#")) {
wrapperId = wrapperId.slice(1);
@ -74,13 +76,21 @@ export default class AnimatedModal {
this.wrapperEl.addEventListener("keydown", (e) => {
if (e.key === "Escape" && isPopupVisible(this.wrapperId)) {
void this.hide();
if (customEscapeHandler) {
customEscapeHandler(e);
} else {
void this.hide();
}
}
});
this.wrapperEl.addEventListener("mousedown", (e) => {
if (e.target === this.wrapperEl) {
void this.hide();
if (customWrapperClickHandler) {
customWrapperClickHandler(e);
} else {
void this.hide();
}
}
});