Skip to content

Commit 201545f

Browse files
authored
Merge branch 'master' into feature/language-integrity
2 parents 96a433d + bf37029 commit 201545f

File tree

5 files changed

+55
-23
lines changed

5 files changed

+55
-23
lines changed

frontend/src/html/pages/leaderboards.html

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,21 @@
4949
<table>
5050
<thead class="allTimeAndDaily">
5151
<tr>
52-
<td><i class="fas fa-users"></i></td>
53-
<td>#</td>
52+
<td>
53+
<span aria-label="Friends rank" data-balloon-pos="down">
54+
<i class="fas fa-user-friends"></i>
55+
</span>
56+
</td>
57+
<td>
58+
<span
59+
class="globalRank"
60+
aria-label="Global rank"
61+
data-balloon-pos="down"
62+
>
63+
<span>#</span>
64+
<i class="fas fa-users"></i>
65+
</span>
66+
</td>
5467
<td>name</td>
5568
<td class="stat narrow speedUnit">
5669
<span>wpm</span>

frontend/src/security-policy.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ <h1 id="Vulnerability_Disclosure">How to Disclose a Vulnerability</h1>
137137
<a href="mailto:contact@monkeytype.com" rel="noopener">email</a>
138138
.
139139
</span>
140-
For non-security related platform bugs, follow the bug submission
140+
&nbsp;For non-security related platform bugs, follow the bug
141+
submission
141142
<span style="display: inline-flex">
142143
<a
143144
href="https://github.com/monkeytypegame/monkeytype#bug-report-or-feature-request"
@@ -146,8 +147,8 @@ <h1 id="Vulnerability_Disclosure">How to Disclose a Vulnerability</h1>
146147
</a>
147148
.
148149
</span>
149-
Include as much detail as possible to ensure reproducibility. At a
150-
minimum, vulnerability disclosures should include:
150+
&nbsp;Include as much detail as possible to ensure reproducibility. At
151+
a minimum, vulnerability disclosures should include:
151152
</p>
152153
<ul>
153154
<li>Vulnerability Description</li>

frontend/src/styles/leaderboards.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,26 @@
161161
padding: var(--padding);
162162
}
163163

164+
.globalRank {
165+
i {
166+
display: none;
167+
}
168+
span {
169+
display: inline;
170+
}
171+
}
164172
&.friendsOnly {
165173
td:first-child {
166174
display: table-cell;
167175
}
176+
.globalRank {
177+
i {
178+
display: inline;
179+
}
180+
span {
181+
display: none;
182+
}
183+
}
168184
}
169185
td:first-child {
170186
display: none;

frontend/src/ts/controllers/route-controller.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ type Route = {
4747

4848
const route404: Route = {
4949
path: "404",
50-
load: async () => {
51-
await PageController.change("404");
50+
load: async (_params, options) => {
51+
await PageController.change("404", options);
5252
},
5353
};
5454

@@ -224,7 +224,12 @@ async function router(options = {} as NavigateOptions): Promise<void> {
224224
};
225225

226226
if (match === undefined) {
227-
await route404.load({}, {});
227+
await route404.load(
228+
{},
229+
{
230+
force: true,
231+
}
232+
);
228233
return;
229234
}
230235

frontend/src/ts/pages/leaderboards.ts

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -444,10 +444,8 @@ function buildTableRow(entry: LeaderboardEntry, me = false): HTMLElement {
444444
}
445445
element.dataset["uid"] = entry.uid;
446446
element.innerHTML = `
447-
<td>${entry.friendsRank ?? ""}</td>
448-
<td>${
449-
entry.rank === 1 ? '<i class="fas fa-fw fa-crown"></i>' : entry.rank
450-
}</td>
447+
<td>${formatRank(entry.friendsRank)}</td>
448+
<td>${formatRank(entry.rank)}</td>
451449
<td>
452450
<div class="avatarNameBadge">
453451
<div class="avatarPlaceholder"></div>
@@ -504,9 +502,7 @@ function buildWeeklyTableRow(
504502
element.dataset["uid"] = entry.uid;
505503
element.innerHTML = `
506504
<td></td>
507-
<td>${
508-
entry.rank === 1 ? '<i class="fas fa-fw fa-crown"></i>' : entry.rank
509-
}</td>
505+
<td>${formatRank(entry.rank)}</td>
510506
<td>
511507
<div class="avatarNameBadge">
512508
<div class="avatarPlaceholder"></div>
@@ -718,9 +714,7 @@ function fillUser(): void {
718714
};
719715

720716
const html = `
721-
<div class="rank">${
722-
rank === 1 ? '<i class="fas fa-fw fa-crown"></i>' : rank
723-
}</div>
717+
<div class="rank">${formatRank(rank)}</div>
724718
<div class="userInfo">
725719
<div class="top">You (${percentileString})</div>
726720
<div class="bottom">${diffText}</div>
@@ -811,11 +805,7 @@ function fillUser(): void {
811805
};
812806

813807
const html = `
814-
<div class="rank">${
815-
userData.rank === 1
816-
? '<i class="fas fa-fw fa-crown"></i>'
817-
: userData.rank
818-
}</div>
808+
<div class="rank">${formatRank(userData.rank)}</div>
819809
<div class="userInfo">
820810
<div class="top">You (${percentileString})</div>
821811
<div class="bottom">${diffText}</div>
@@ -1390,6 +1380,13 @@ function updateTimeText(
13901380
text.attr("aria-label", localDateString);
13911381
}
13921382

1383+
function formatRank(rank: number | undefined): string {
1384+
if (rank === undefined) return "";
1385+
if (rank === 1) return '<i class="fas fa-fw fa-crown"></i>';
1386+
1387+
return rank.toString();
1388+
}
1389+
13931390
$(".page.pageLeaderboards .jumpButtons button").on("click", function () {
13941391
const action = $(this).data("action") as Action;
13951392
if (action !== "goToPage") {

0 commit comments

Comments
 (0)