Skip to content

Conversation

@denshaw-09
Copy link

@denshaw-09 denshaw-09 commented Jul 29, 2025

Related Issue


Description

This PR completely redesigns the Contributors page to match the modern dashboard UI shown in the provided reference image.
Summary Cards:
Added Pull Requests, Issues, and Engagement cards at the top, each with a relevant icon inside a rounded box.
Labels ("Opened", "Merged", "Velocity", etc.) are now above the numbers, with bold numbers and lighter, smaller labels.
Engagement card now includes the "Activity Ratio" label above a pill-shaped "Low" button with a down-arrow icon.


How Has This Been Tested?

Manually verified the UI matches the reference image for:
Summary cards (icons, layout, labels, numbers, pill/button for activity ratio)
Table layout and styling (activity pills, PR overview bar, avatars, etc.)
Checked that all data loads correctly from the GitHub API and updates on period change.


Screenshots (if applicable)

image

Type of Change

  • Bug fix
  • New feature
  • Code style update
  • Breaking change
  • Documentation update

Summary by CodeRabbit

  • New Features

    • Introduced a comprehensive contributors dashboard displaying repository metrics, including stars, forks, open issues, pull requests, and issues.
    • Added summary cards for pull requests, issues, and engagement metrics with activity ratios and velocity indicators.
    • Implemented a paginated contributors table with enhanced visuals, activity levels, progress bars, avatars, and activity graphs.
    • Included a period selector and filter option for interactive data exploration.
  • Refactor

    • Replaced the previous simple contributors list with a detailed, interactive dashboard view.
  • Chores

    • Removed outdated environment variable sample file.

@netlify
Copy link

netlify bot commented Jul 29, 2025

Deploy Preview for github-spy ready!

Name Link
🔨 Latest commit 0c0d845
🔍 Latest deploy log https://app.netlify.com/projects/github-spy/deploys/6888daf51e6a500008981601
😎 Deploy Preview https://deploy-preview-147--github-spy.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 29, 2025

Walkthrough

The .env.sample file was deleted, removing environment variable definitions for port, MongoDB URI, and session secret. The ContributorsPage component was extensively enhanced from a simple contributors list to a detailed dashboard showing repository stats, contributor metrics, pull request and issue summaries, with pagination and interactive UI elements.

Changes

Cohort / File(s) Change Summary
Environment Variable Removal
backend/.env.sample
Deleted the entire .env.sample file, removing predefined environment variables for PORT, MONGO_URI, and SESSION_SECRET.
Contributors Dashboard Enhancement
src/pages/Contributors/Contributors.tsx
Transformed the contributors page into a comprehensive dashboard displaying GitHub repository statistics, contributors, pull requests, and issues. Added summary cards, paginated contributors table with activity levels, PR overview, velocity metrics, avatars, and activity graphs. Included new state variables, helper functions, and error/loading handling.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ContributorsPage
    participant GitHubAPI

    User->>ContributorsPage: Visit Contributors Page
    ContributorsPage->>GitHubAPI: Fetch repo stats (stars, forks, issues)
    ContributorsPage->>GitHubAPI: Fetch contributors
    ContributorsPage->>GitHubAPI: Fetch pull requests
    ContributorsPage->>GitHubAPI: Fetch issues
    GitHubAPI-->>ContributorsPage: Return data
    ContributorsPage->>ContributorsPage: Calculate metrics & summary stats
    ContributorsPage->>User: Render dashboard (summary cards, table, graphs)
    User->>ContributorsPage: Interact (pagination, filters)
    ContributorsPage->>ContributorsPage: Update UI accordingly
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Assessment against linked issues

Objective Addressed Explanation
Share Link, Fetch highest no. of PRs for any repo, Visualize in chart/table (#21)

Poem

In the garden of code where contributors grow,
A dashboard now blossoms, with stats all aglow.
PRs and issues, in tables they dance,
With avatars, graphs, and metrics enhanced.
The bunnies rejoice, their carrots held high—
For dashboards like these make the codebase fly! 🥕✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 01ff391 and 0c0d845.

📒 Files selected for processing (1)
  • backend/.env.sample (0 hunks)
💤 Files with no reviewable changes (1)
  • backend/.env.sample
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (2)
src/pages/Contributors/Contributors.tsx (2)

179-182: Extract inline SVG icons to reusable components.

The inline SVG icons for PR, Issues, and Engagement should be extracted to separate components for better maintainability and reusability.

// Create an icons file or folder
const PullRequestIcon = () => (
  <svg width="22" height="22" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
    <path d="M7 7V17" stroke="#64748b" strokeWidth="2" strokeLinecap="round"/>
    <path d="M17 7V17" stroke="#64748b" strokeWidth="2" strokeLinecap="round"/>
    <circle cx="7" cy="5" r="2" fill="#64748b"/>
    <circle cx="7" cy="19" r="2" fill="#64748b"/>
    <circle cx="17" cy="5" r="2" fill="#64748b"/>
    <circle cx="17" cy="19" r="2" fill="#64748b"/>
  </svg>
);

Also applies to: 208-210, 236-238


36-372: Consider architectural improvements for production readiness.

Additional suggestions for a production-ready implementation:

  1. Implement data caching to reduce API calls
  2. Add loading states for individual metrics
  3. Handle partial data loading failures gracefully
  4. Consider using a state management solution for complex data
  5. Add unit tests for data calculations and UI components

Would you like me to help create a more robust data fetching layer with proper caching and error handling?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8b64528 and d8ba0d9.

📒 Files selected for processing (2)
  • backend/.env.sample (1 hunks)
  • src/pages/Contributors/Contributors.tsx (1 hunks)
🔇 Additional comments (1)
backend/.env.sample (1)

1-1: Confirm database name update across the codebase

A search for “githubTracker” across .js, .ts, .json, .yaml, .yml, .env, and .md files returned no matches. To avoid any runtime failures, please manually verify that no legacy references to the old database name remain in:

  • Configuration files (e.g., CI/CD YAML, deployment scripts)
  • Documentation or READMEs
  • Any custom scripts or tooling

Comment on lines +30 to +32
const REPO_OWNER = "mehul-m-prajapati";
const REPO_NAME = "github_tracker";
const REPO_FULL = `${REPO_OWNER}/${REPO_NAME}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Replace hardcoded repository values with dynamic props.

The PR objective is to create a feature that showcases ANY user's top contributions, but these hardcoded values limit the component to only one specific repository. This doesn't meet the requirement of sharing a URL for different users.

-const REPO_OWNER = "mehul-m-prajapati";
-const REPO_NAME = "github_tracker";
-const REPO_FULL = `${REPO_OWNER}/${REPO_NAME}`;
+interface ContributorsPageProps {
+  repoOwner: string;
+  repoName: string;
+}
+
+const ContributorsPage: React.FC<ContributorsPageProps> = ({ repoOwner, repoName }) => {
+  const REPO_FULL = `${repoOwner}/${repoName}`;

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/pages/Contributors/Contributors.tsx around lines 30 to 32, the repository
owner and name are hardcoded as constants, which restricts the component to a
single repository. To fix this, refactor the component to accept the repository
owner and name as props, then construct the full repository string dynamically
from these props instead of using fixed values. This will allow the component to
display contributions for any user's repository as intended.

Comment on lines 48 to +87
useEffect(() => {
const fetchContributors = async () => {
const fetchData = async () => {
setLoading(true);
try {
const response = await axios.get(GITHUB_REPO_CONTRIBUTORS_URL, {
withCredentials: false,
});
setContributors(response.data);
// Repo stats (stars, forks, open issues)
const repoRes = await axios.get(`https://api.github.com/repos/${REPO_FULL}`);
setRepoStats(repoRes.data);

// Contributors
const contribRes = await axios.get(`https://api.github.com/repos/${REPO_FULL}/contributors?per_page=100`);
setContributors(contribRes.data);

// PRs (all states)
const prRes = await axios.get(`https://api.github.com/repos/${REPO_FULL}/pulls?state=all&per_page=100`);
const prs = prRes.data;
const opened = prs.length;
const merged = prs.filter(pr => pr.merged_at).length;
// Calculate PR velocity (mock: 1d if any, else '-')
const velocity = opened > 0 ? "1d" : "-";
setPrStats({ opened, merged, velocity });

// Issues (all states, filter out PRs)
const issueRes = await axios.get(`https://api.github.com/repos/${REPO_FULL}/issues?state=all&per_page=100`);
const issues = issueRes.data.filter(issue => !issue.pull_request);
const openedIssues = issues.length;
const closedIssues = issues.filter(issue => issue.state === "closed").length;
// Calculate Issue velocity (mock: 5d if any, else '-')
const issueVelocity = openedIssues > 0 ? "5d" : "-";
setIssueStats({ opened: openedIssues, closed: closedIssues, velocity: issueVelocity });
} catch (err) {
setError("Failed to fetch contributors. Please try again later.");
setRepoStats(null);
setContributors([]);
setPrStats({ opened: 0, merged: 0, velocity: "-" });
setIssueStats({ opened: 0, closed: 0, velocity: "-" });
} finally {
setLoading(false);
}
};
fetchData();
}, [period]);
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

❓ Verification inconclusive

Address API rate limits and incomplete data fetching.

Several issues with the data fetching implementation:

  1. No GitHub API rate limit handling - this will fail quickly for unauthenticated requests
  2. Using per_page=100 without pagination means you'll miss data if there are more than 100 items
  3. The period state changes trigger refetch but isn't used in the API calls
  4. Mock velocity calculations should be replaced with real metrics

Consider implementing:

  • GitHub API authentication
  • Proper pagination handling
  • Real velocity calculations based on the selected period
  • Rate limit monitoring

🏁 Script executed:

#!/bin/bash
# Description: Check if there's any authentication setup for GitHub API

# Search for GitHub API authentication
rg -A 5 "github.*token|GITHUB_TOKEN|Authorization.*github" --type ts --type tsx --type js

Length of output: 119


🏁 Script executed:

#!/bin/bash
# Search for environment variables related to GitHub authentication
rg -n "process\\.env" -g "*.ts" -g "*.tsx"

# Look for custom axios instances or default header overrides
rg -n "axios\\.create" -g "*.ts" -g "*.tsx"
rg -n "axios\\.defaults" -g "*.ts" -g "*.tsx"

# Check for explicit Authorization header usage
rg -n "Authorization" -g "*.ts" -g "*.tsx"

Length of output: 178


Implement robust GitHub API integration and real metrics

The current Contributors.tsx data fetching has several gaps that can lead to incomplete or unauthenticated data. Please address the following in src/pages/Contributors/Contributors.tsx:

  • Authentication (lines 53, 57, 61, 70):
    • No Authorization header or token usage – unauthenticated calls are limited to 60/hour.
    • Add support for process.env.GITHUB_TOKEN (or similar) in your axios requests.

  • Pagination (all calls with per_page=100):
    • You’ll miss any data beyond page 1.
    • Implement a loop or follow the Link header to fetch all pages of contributors, PRs, and issues.

  • Unused period dependency (useEffect deps):
    • The dropdown’s period value is not applied to any API query.
    • Pass since/until query parameters (or switch to the GraphQL API) to filter data by the selected period.

  • Mock velocity calculations (lines 66, 75):
    • Replace hard-coded "1d"/"5d" with actual durations computed from PR/issue timestamps (e.g. average or median time to merge/close).

<TableHead>
<TableRow>
<TableCell padding="checkbox"></TableCell>
<TableCell>REPOSITORY</TableCell>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Clarify data model: repositories vs contributors.

The table header shows "REPOSITORY" but the data displayed is contributor information. This creates confusion about what data is being presented.

Either:

  1. Change the header to "CONTRIBUTOR" to match the data
  2. Or restructure to actually show repository data as the PR objectives suggest

The PR objective mentions showing "top contributions" which could be interpreted as either top repositories or top contributors.

Also applies to: 297-304

🤖 Prompt for AI Agents
In src/pages/Contributors/Contributors.tsx around lines 270 and 297-304, the
table header "REPOSITORY" does not match the contributor data displayed, causing
confusion. To fix this, either rename the header to "CONTRIBUTOR" to align with
the data shown or modify the data rows to display repository information if the
intent is to show top repositories. Ensure consistency between the header and
the data content throughout these lines.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (5)
src/pages/Contributors/Contributors.tsx (5)

30-32: Replace hardcoded repository values with dynamic props.

This issue was already identified in previous reviews. The hardcoded values prevent the component from showcasing different users' contributions as required by the PR objectives.


48-87: Address API integration issues identified in previous reviews.

The data fetching implementation still has the same unresolved issues from previous reviews:

  1. No GitHub API authentication - will hit rate limits quickly
  2. per_page=100 without pagination loses data beyond page 1
  3. period dependency triggers refetch but isn't used in API queries
  4. Mock velocity calculations (lines 66, 75) should use real metrics

94-143: Replace mock implementations with real calculations.

The helper functions still return mock/hardcoded data as identified in previous reviews. This doesn't provide real insights into contributor activity.


270-270: Clarify data model: repositories vs contributors.

This table header confusion was already identified in previous reviews. The header shows "REPOSITORY" but displays contributor data.


299-299: Remove hardcoded avatar path.

This avatar source issue was already flagged in previous reviews. The implementation now uses dynamic avatar URLs which addresses the concern.

🧹 Nitpick comments (1)
src/pages/Contributors/Contributors.tsx (1)

356-356: Fix inconsistent terminology in pagination text.

The pagination text says "repos" but should say "contributors" since that's what the table actually displays.

-Showing {paginatedContributors.length > 0 ? (page - 1) * perPage + 1 : 0} - {Math.min(page * perPage, contributors.length)} of {contributors.length} repos
+Showing {paginatedContributors.length > 0 ? (page - 1) * perPage + 1 : 0} - {Math.min(page * perPage, contributors.length)} of {contributors.length} contributors
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d8ba0d9 and 01ff391.

📒 Files selected for processing (1)
  • src/pages/Contributors/Contributors.tsx (1 hunks)

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🚀 Feature: Create a page to showcase top contributions of a User when he logs in

1 participant