showing daily leaderboard in the result, not as a notification

closes #3096
This commit is contained in:
Miodec 2022-09-01 23:31:50 +02:00
parent a0b896eb40
commit 52b6b5429e
3 changed files with 42 additions and 8 deletions

View file

@ -665,6 +665,12 @@
}
}
&.dailyLeaderboard {
max-width: 10rem;
overflow: hidden;
white-space: nowrap;
}
&.source {
#rateQuoteButton,
#reportQuoteButton,

View file

@ -1571,6 +1571,8 @@ export async function finish(difficultyFailed = false): Promise<void> {
$(".pageTest #result #reportQuoteButton").removeClass("hidden");
}
$("#result .stats .dailyLeaderboard").addClass("hidden");
TestStats.setLastResult(completedEvent);
await Result.update(
@ -1684,14 +1686,35 @@ async function saveResult(
);
}
if (response.data.dailyLeaderboardRank) {
Notifications.add(
`New ${completedEvent.language} ${completedEvent.mode} ${completedEvent.mode2} rank: ` +
Misc.getPositionString(response.data.dailyLeaderboardRank),
1,
10,
"Daily Leaderboard",
"list-ol"
// if (response.data.dailyLeaderboardRank) {
// Notifications.add(
// `New ${completedEvent.language} ${completedEvent.mode} ${completedEvent.mode2} rank: ` +
// Misc.getPositionString(response.data.dailyLeaderboardRank),
// 1,
// 10,
// "Daily Leaderboard",
// "list-ol"
// );
// }
if (!response.data.dailyLeaderboardRank) {
$("#result .stats .dailyLeaderboard").addClass("hidden");
} else {
$("#result .stats .dailyLeaderboard")
.css({
maxWidth: "10rem",
opacity: 0,
})
.removeClass("hidden")
.animate(
{
// maxWidth: "10rem",
opacity: 1,
},
500
);
$("#result .stats .dailyLeaderboard .bottom").html(
Misc.getPositionString(response.data.dailyLeaderboardRank)
);
}

View file

@ -140,6 +140,11 @@
</div>
<!-- </div> -->
<div class="group dailyLeaderboard hidden">
<div class="top">daily leaderboard</div>
<div class="bottom">-</div>
</div>
<div class="group source hidden">
<div class="top">
source