mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-11-10 17:04:49 +08:00
moved issubmiossionenabled check before opening the popup
This commit is contained in:
parent
ad357d3948
commit
a828fcfb01
2 changed files with 22 additions and 16 deletions
|
@ -319,10 +319,28 @@ $("#quoteSearchPopupWrapper").on("mousedown", (e) => {
|
|||
}
|
||||
});
|
||||
|
||||
$("#popups").on("click", "#quoteSearchPopup #gotoSubmitQuoteButton", () => {
|
||||
hide();
|
||||
QuoteSubmitPopup.show(true);
|
||||
});
|
||||
$("#popups").on(
|
||||
"click",
|
||||
"#quoteSearchPopup #gotoSubmitQuoteButton",
|
||||
async () => {
|
||||
Loader.show();
|
||||
const isSubmissionEnabled = (await Ape.quotes.isSubmissionEnabled()).data
|
||||
.isEnabled;
|
||||
Loader.hide();
|
||||
if (!isSubmissionEnabled) {
|
||||
Notifications.add(
|
||||
"Quote submission is disabled temporarily due to a large submission queue.",
|
||||
0,
|
||||
{
|
||||
duration: 5,
|
||||
}
|
||||
);
|
||||
return;
|
||||
}
|
||||
hide();
|
||||
QuoteSubmitPopup.show(true);
|
||||
}
|
||||
);
|
||||
|
||||
$("#popups").on("click", "#quoteSearchPopup #goToApproveQuotes", () => {
|
||||
hide();
|
||||
|
|
|
@ -49,18 +49,6 @@ async function submitQuote(): Promise<void> {
|
|||
}
|
||||
|
||||
export async function show(noAnim = false): Promise<void> {
|
||||
const isSubmissionEnabled = (await Ape.quotes.isSubmissionEnabled()).data
|
||||
.isEnabled;
|
||||
if (!isSubmissionEnabled) {
|
||||
Notifications.add(
|
||||
"Quote submission is disabled temporarily due to a large submission queue.",
|
||||
0,
|
||||
{
|
||||
duration: 5,
|
||||
}
|
||||
);
|
||||
return;
|
||||
}
|
||||
Skeleton.append(wrapperId);
|
||||
|
||||
if (!Misc.isPopupVisible(wrapperId)) {
|
||||
|
|
Loading…
Reference in a new issue