From 96efe65e6638db41cebe6cd360498ad977725a7e Mon Sep 17 00:00:00 2001 From: yashvi-3106 Date: Sat, 18 Jul 2026 12:23:14 +0530 Subject: [PATCH 1/2] feat(frontend): add CENTURION gamification badge to user profiles --- frontend/js/user/badges.js | 20 ++++++++++++++++++++ frontend/user.html | 17 +++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/frontend/js/user/badges.js b/frontend/js/user/badges.js index 7056ee60..ca26b680 100644 --- a/frontend/js/user/badges.js +++ b/frontend/js/user/badges.js @@ -2,6 +2,17 @@ const ALL_BADGES = [ { id: "HOT_STREAK", title: "Solved >= 1 problem every day for 7 days" }, { id: "SPEEDRUN", title: "Top 3 problem-solving velocity this week" }, { id: "UP_LINK", title: "Jumped 5+ positions in overall ranks today" }, +<<<<<<< Updated upstream +======= + { + 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", + }, +>>>>>>> Stashed changes ]; async function loadBadges(username) { @@ -35,6 +46,15 @@ async function loadBadges(username) { if (streak) earnedSet.add("HOT_STREAK"); } + 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"); } diff --git a/frontend/user.html b/frontend/user.html index 6abbac3e..d407a323 100644 --- a/frontend/user.html +++ b/frontend/user.html @@ -203,6 +203,23 @@ text-shadow: 0 0 5px rgba(255, 76, 76, 0.3); } +<<<<<<< Updated upstream +======= + .badge-hardcarry { + color: #ff003c; + background: rgba(255, 0, 60, 0.15); + border-color: rgba(255, 0, 60, 0.4); + 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); + } + +>>>>>>> Stashed changes .badge-uplink { color: var(--cyan); background: rgba(0, 229, 255, 0.1); From 0fa27387b13c11ba8045f82b0409f68b4a1e5e26 Mon Sep 17 00:00:00 2001 From: yashvi-3106 Date: Tue, 21 Jul 2026 14:03:37 +0530 Subject: [PATCH 2/2] fix(frontend): resolve merge conflicts and format badges code --- frontend/js/user/badges.js | 3 --- frontend/user.html | 3 --- 2 files changed, 6 deletions(-) diff --git a/frontend/js/user/badges.js b/frontend/js/user/badges.js index ca26b680..6d8696f7 100644 --- a/frontend/js/user/badges.js +++ b/frontend/js/user/badges.js @@ -2,8 +2,6 @@ const ALL_BADGES = [ { id: "HOT_STREAK", title: "Solved >= 1 problem every day for 7 days" }, { id: "SPEEDRUN", title: "Top 3 problem-solving velocity this week" }, { id: "UP_LINK", title: "Jumped 5+ positions in overall ranks today" }, -<<<<<<< Updated upstream -======= { id: "HARD_CARRY", title: "Solved 5+ Hard problems and 0 Easy problems over the past 7 days", @@ -12,7 +10,6 @@ const ALL_BADGES = [ id: "CENTURION", title: "Solved a grand total of 100 or more problems", }, ->>>>>>> Stashed changes ]; async function loadBadges(username) { diff --git a/frontend/user.html b/frontend/user.html index d407a323..7386f7ef 100644 --- a/frontend/user.html +++ b/frontend/user.html @@ -203,8 +203,6 @@ text-shadow: 0 0 5px rgba(255, 76, 76, 0.3); } -<<<<<<< Updated upstream -======= .badge-hardcarry { color: #ff003c; background: rgba(255, 0, 60, 0.15); @@ -219,7 +217,6 @@ text-shadow: 0 0 8px rgba(255, 159, 28, 0.5); } ->>>>>>> Stashed changes .badge-uplink { color: var(--cyan); background: rgba(0, 229, 255, 0.1);