Skip to content

Commit

Permalink
feat(leaderboard): show daily leaderboard on daily leaderboard rank c…
Browse files Browse the repository at this point in the history
…lick
  • Loading branch information
theiereman committed Dec 24, 2024
1 parent 799656d commit fc6c5f4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
9 changes: 8 additions & 1 deletion frontend/src/html/pages/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,14 @@

<div class="group dailyLeaderboard hidden">
<div class="top">daily leaderboard</div>
<div class="bottom">-</div>
<div
id="dailyLeaderboardRank"
aria-label="Show daily leaderboard"
data-balloon-pos="up"
class="bottom"
>
-
</div>
</div>

<div class="group source hidden">
Expand Down
1 change: 0 additions & 1 deletion frontend/src/styles/test.scss
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,6 @@

&.dailyLeaderboard {
max-width: 13rem;
overflow: hidden;
white-space: nowrap;
}

Expand Down
12 changes: 12 additions & 0 deletions frontend/src/ts/elements/leaderboards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
LeaderboardRank,
} from "@monkeytype/contracts/schemas/leaderboards";
import { Mode } from "@monkeytype/contracts/schemas/shared";
import * as TestStats from "../test/test-stats";

const wrapperId = "leaderboardsWrapper";

Expand Down Expand Up @@ -973,4 +974,15 @@ $("header nav").on("click", ".textButton", (e) => {
}
});

$(".pageTest").on("click", "#dailyLeaderboardRank", () => {
currentTimeRange = "daily";
updateYesterdayButton();
languageSelector?.enable();

currentLanguage = TestStats.lastResult.language;
languageSelector?.setSelected(currentLanguage);
void update();
show();
});

Skeleton.save(wrapperId);

0 comments on commit fc6c5f4

Please sign in to comment.