Skip to content

Conversation

iitzIrFan
Copy link
Member

Description

Implemented filtering feature in the Leaderboard page for better transparency between the contributors.

Solves: #563

Type of Change

  • New feature (e.g., new page, component, or functionality)
  • Bug fix (non-breaking change that fixes an issue)
  • UI/UX improvement (design, layout, or styling updates)
  • [] Performance optimization (e.g., code splitting, caching)
  • Documentation update (README, contribution guidelines, etc.)
  • Other (please specify):

Checklist

  • My code follows the style guidelines of this project.
  • I have tested my changes across major browsers and devices
  • My changes do not generate new console warnings or errors .
  • I ran npm run build and attached screenshot(s) in this PR.
  • This is already assigned Issue to me, not an unassigned issue.

Video preview:

2025-09-22.20-04-57.mp4

@iitzIrFan iitzIrFan requested a review from sanjay-kv September 22, 2025 14:41
@iitzIrFan iitzIrFan self-assigned this Sep 22, 2025
@Copilot Copilot AI review requested due to automatic review settings September 22, 2025 14:41
@iitzIrFan iitzIrFan added the enhancement New feature or request label Sep 22, 2025
@iitzIrFan iitzIrFan added area:UI Related to UI/UX. For Frontend Developers. kind:feature Feature Requests area:production-image Production image improvements and fixes labels Sep 22, 2025
Copy link

vercel bot commented Sep 22, 2025

Someone is attempting to deploy a commit to the recode Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

Thank you for submitting your pull request! 🙌 We'll review it as soon as possible. The estimated time for response is 5–8 hrs.

In the meantime, please provide all necessary screenshots and make sure you run - npm build run , command and provide a screenshot, a video recording, or an image of the update you made below, which helps speed up the review and assignment. If you have questions, reach out to LinkedIn. Your contributions are highly appreciated!😊

Note: I maintain the repo issue every day twice at 8:00 AM IST and 9:00 PM IST. If your PR goes stale for more than one day, you can tag and comment on this same issue by tagging @sanjay-kv.

We are here to help you on this journey of open source. Consistent 20 contributions are eligible for sponsorship 💰

🎁 check our list of amazing people we sponsored so far: GitHub Sponsorship. ✨

📚Your perks for contribution to this community 👇🏻

  1. Get free Consultation use code recode50 to get free: Mentorship for free.

  2. Get the Ebook for free use code recode at checkout: Data Science cheatsheet for Beginners.

  3. Check out this weekly Newsletter: Sanjay's Newsletter.

If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊

@iitzIrFan iitzIrFan moved this to In Progress in @recode-web Sep 22, 2025
@iitzIrFan iitzIrFan added the under review Review under the maintainers or the admins label Sep 22, 2025
@iitzIrFan iitzIrFan linked an issue Sep 22, 2025 that may be closed by this pull request
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a filtering feature for the Leaderboard page to allow filtering contributors by time periods (all time, weekly, monthly, yearly) for better transparency between contributors.

  • Adds time period filtering with dropdown selection (all time, past year, past month, past week)
  • Implements simulated contribution filtering based on selected time period using random factors
  • Updates UI layout to include filter controls in the top performers section and improves pagination styling

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/components/dashboard/LeaderBoard/leaderboard.tsx Adds time period filtering logic, UI controls, and fixes ranking display issues
src/components/dashboard/LeaderBoard/leaderboard.css Styles for the new filter controls and enhanced pagination design

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +105 to +127
return contributors.map(contributor => {
// Apply a random factor based on time period to simulate date filtering
// This is just for demonstration - in a real app you'd use actual date data
let factor = 1;
switch (timePeriod) {
case "weekly":
factor = 0.1 + Math.random() * 0.1; // Keep 10-20% for weekly
break;
case "monthly":
factor = 0.3 + Math.random() * 0.2; // Keep 30-50% for monthly
break;
case "yearly":
factor = 0.7 + Math.random() * 0.2; // Keep 70-90% for yearly
break;
}

const filteredPrs = Math.floor(contributor.prs * factor);
return {
...contributor,
prs: filteredPrs,
points: filteredPrs * 10, // Assuming each PR is worth 10 points
};
}).filter(contributor => contributor.prs > 0); // Remove contributors with 0 PRs
Copy link

Copilot AI Sep 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using Math.random() in the filtering logic will produce inconsistent results every time the component re-renders or the filter is changed. This creates a poor user experience where the same filter selection shows different data. Consider using a deterministic approach based on contributor.username or contributor.id as a seed for consistent results.

Copilot uses AI. Check for mistakes.

Comment on lines +422 to +423
<div className={`rank-badge ${getRankClass(filteredContributors.indexOf(contributor))}`}>
{filteredContributors.indexOf(contributor) + 1}
Copy link

Copilot AI Sep 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using indexOf() inside the render loop is inefficient as it performs a linear search for each contributor. This creates O(n²) complexity. Consider calculating ranks once during the filtering process or using the existing indexOfFirst + index calculation.

Copilot uses AI. Check for mistakes.

return {
...contributor,
prs: filteredPrs,
points: filteredPrs * 10, // Assuming each PR is worth 10 points
Copy link

Copilot AI Sep 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded value of 10 points per PR should be extracted as a named constant (e.g., POINTS_PER_PR = 10) to improve maintainability and make the scoring system more explicit.

Copilot uses AI. Check for mistakes.

@iitzIrFan
Copy link
Member Author

@Adez017 I have implemented the filter feature in the leaderboard page but, the data through the API needs documentation or more details of how it is fetching data of PR's to the leaderboard.

@sanjay-kv Ready for merge.

@Adez017
Copy link
Member

Adez017 commented Sep 22, 2025

@Adez017 I have implemented the filter feature in the leaderboard page but, the data through the API needs documentation or more details of how it is fetching data of PR's to the leaderboard.

@sanjay-kv Ready for merge.

Sure i'll add the documentation soon @iitzIrFan

Copy link

vercel bot commented Sep 23, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
recode-website Ready Ready Preview Comment Sep 23, 2025 0:25am

@sanjay-kv sanjay-kv added recode this is label for leaderboard level 3 50 points labels Sep 23, 2025
@sanjay-kv sanjay-kv merged commit 7cfe0fb into recodehive:main Sep 23, 2025
4 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in @recode-web Sep 23, 2025
@sanjay-kv
Copy link
Member

Find in logs
CtrlF
Running build in Washington, D.C., USA (East) – iad1
Build machine configuration: 4 cores, 8 GB
Cloning github.com/recodehive/recode-website (Branch: Experiment, Commit: 613ed70)
Cloning completed: 2.211s
Restored build cache from previous deployment (Ey17xe3FwEz1YziB3TPPdctyAbys)
Running "vercel build"
Vercel CLI 48.1.1
Warning: Detected "engines": { "node": ">=18.0" } in your package.json that will automatically upgrade when a new major Node.js Version is released. Learn More: http://vercel.link/node-version
Installing dependencies...
up to date in 3s
423 packages are looking for funding
run npm fund for details
Running "npm run build"

[email protected] build
docusaurus build
[INFO] [en] Creating an optimized production build...
[WARNING] Docusaurus found blog posts without truncation markers:

  • "blog/n8n-workflow-automation/index.md"

it failed can u look into it?

@Adez017
Copy link
Member

Adez017 commented Sep 23, 2025

is this for this PR or the one i created @sanjay-kv ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:production-image Production image improvements and fixes area:UI Related to UI/UX. For Frontend Developers. enhancement New feature or request kind:feature Feature Requests level 3 50 points recode this is label for leaderboard under review Review under the maintainers or the admins

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Leaderboard changes

3 participants