Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions frontend/js/user/badges.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ const ALL_BADGES = [
id: "HARD_CARRY",
title: "Solved 5+ Hard problems and 0 Easy problems over the past 7 days",
},
{
id: "CENTURION",
title: "Solved a grand total of 100 or more problems",
},
];

async function loadBadges(username) {
Expand Down Expand Up @@ -47,6 +51,15 @@ async function loadBadges(username) {
}
}

if (history.length >= 1) {
const latest = history[history.length - 1];
const totalSolved =
(latest.easy || 0) + (latest.medium || 0) + (latest.hard || 0);
if (totalSolved >= 100) {
earnedSet.add("CENTURION");
}
}

if (ranks.overall && parseInt(ranks.overall.change, 10) >= 5) {
earnedSet.add("UP_LINK");
}
Expand Down
7 changes: 7 additions & 0 deletions frontend/user.html
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,13 @@
text-shadow: 0 0 8px rgba(255, 0, 60, 0.5);
}

.badge-centurion {
color: #ff9f1c;
background: rgba(255, 159, 28, 0.15);
border-color: rgba(255, 159, 28, 0.4);
text-shadow: 0 0 8px rgba(255, 159, 28, 0.5);
}

.badge-uplink {
color: var(--cyan);
background: rgba(0, 229, 255, 0.1);
Expand Down
Loading