Skip to content

feat: Implement a side-by-side user comparison tool for the leaderboard #103

@Vachhani-Tapan

Description

@Vachhani-Tapan

Feature Description

Add a comparison feature to the leaderboard that allows users to select up to 3 peers and compare their LeetCode stats and progress side-by-side using interactive charts and statistics. This will boost engagement by encouraging healthy competition and allowing students to analyze their grinding velocity compared to their peers.

User Flow

  1. Selection: Add a checkbox next to each student's name on both desktop (leaderboard-row) and mobile (mobile-card) views.
  2. Action: Once 2 or 3 users are selected, a floating bar appears at the bottom with a "Compare" button.
  3. Comparison Screen: Clicking "Compare" opens a modal or dedicated panel displaying:
    • Metrics Comparison Table: Side-by-side table comparing score, easy/medium/hard problems solved, and average daily problems.
    • Difficulty Breakdown Chart: A comparative bar chart (Easy/Medium/Hard) for each user.
    • Progress History Chart: A combined line graph showing cumulative problems solved over time (using the /api/student/:username history endpoint).

Proposed Changes

  1. frontend/leaderboard.html: Add checkboxes to row elements, a floating action panel, and a comparison overlay/modal that matches the existing dark/matrix style.
  2. frontend/js/compare.js (New File): Handle selection state, fetch history data for compared users from /api/student/:username, and render comparison charts using a lightweight graphing library (like Chart.js via CDN).

Metadata

Metadata

Labels

FrontendTask mainly involving frontendlevel:advancedIndicates the difficultytype:featureNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions