-
Notifications
You must be signed in to change notification settings - Fork 118
Feature/leaderboard filter #583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/leaderboard filter #583
Conversation
… and larger icons
…er effects for better usability
Someone is attempting to deploy a commit to the recode Team on Vercel. A member of the Team first needs to authorize it. |
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 👇🏻
If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊 |
There was a problem hiding this 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.
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 |
Copilot
AI
Sep 22, 2025
There was a problem hiding this comment.
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.
<div className={`rank-badge ${getRankClass(filteredContributors.indexOf(contributor))}`}> | ||
{filteredContributors.indexOf(contributor) + 1} |
Copilot
AI
Sep 22, 2025
There was a problem hiding this comment.
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 |
Copilot
AI
Sep 22, 2025
There was a problem hiding this comment.
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.
@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 |
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Find in logs
it failed can u look into it? |
is this for this PR or the one i created @sanjay-kv ? |
Description
Implemented filtering feature in the Leaderboard page for better transparency between the contributors.
Solves: #563
Type of Change
Checklist
npm run build
and attached screenshot(s) in this PR.Video preview:
2025-09-22.20-04-57.mp4