mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-10 06:01:28 +08:00
fix(alerts): not being able to claim rewards
This commit is contained in:
parent
03311d8d6f
commit
d0fe0f536f
2 changed files with 41 additions and 22 deletions
|
|
@ -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();
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue