Skip to content

Conversation

@arkid15r
Copy link
Collaborator

Remove the contributions counters as it has different values depending on the page (main, organization, repository as well as the main point -- project based contributions vs all member contributions)

Some before/after screenshots:
Screenshot 2025-07-10 at 4 46 38 PM
Screenshot 2025-07-10 at 4 47 22 PM

Screenshot 2025-07-10 at 4 46 48 PM Screenshot 2025-07-10 at 4 47 31 PM

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 10, 2025

Summary by CodeRabbit

  • New Features

    • Increased the number of top contributors shown by default across multiple pages from 6 or 9 to 12, and raised the backend and frontend contributor limits to 20.
    • Improved contributor grid layout for better display on large screens.
  • Bug Fixes

    • Contributor lists now display only avatars and names, removing contribution counts from UI and tooltips for a cleaner appearance.
  • Tests

    • Updated tests and mock data to align with the new contributor display logic and removed assertions related to contribution counts.
  • Chores

    • Enhanced contributor and user type definitions with additional optional fields and improved data structure consistency.
      """

Summary by CodeRabbit

  • New Features

    • Increased the number of top contributors displayed across various pages and components from 6 or 9 to 12 or 20, providing a broader view of contributors.
  • Refactor

    • Removed the display of individual contribution counts for contributors throughout the application.
    • Updated contributor grid layouts for improved visual presentation.
  • Bug Fixes

    • Improved test reliability by enforcing exact matching for contributor names and images in UI tests.
  • Chores

    • Updated test data and queries to remove contribution count fields and align with new contributor display logic.

Walkthrough

The changes increase the default and displayed number of top contributors across backend and frontend, remove the display and retrieval of the contributionsCount property for contributors, update related mock data and tests, and adjust component and query implementations to support these updates. Contributor grid layouts and type definitions are also updated accordingly.

Changes

Files/Paths Change Summary
backend/apps/github/graphql/queries/repository_contributor.py Increased default limit in top_contributors from 15 to 20.
frontend/src/components/TopContributorsList.tsx, .../CardDetailsPage.tsx, .../about/page.tsx, .../page.tsx Increased initial contributors shown (6→12 or 9→12), updated grid layout, removed contributions count display.
frontend/src/components/ContributorAvatar.tsx, .../types/contributor.ts Made contributionsCount optional in Contributor type, updated tooltip logic to handle absence of the field.
frontend/src/server/queries/*Queries.ts Removed contributionsCount from topContributors in all GraphQL queries; increased limit in home query (18→20).
frontend/tests/e2e/pages/.spec.ts, .../unit/pages/.test.tsx Updated tests to remove assertions for contributions count, enforce exact matching, and adjust visible contributor indices.
frontend/tests/e2e/data/.ts, .../unit/data/.ts Removed contributionsCount from all mock contributor data.

Possibly related PRs

Suggested labels

backend-tests

Suggested reviewers

  • kasya
    """

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d212cc3 and e95d006.

📒 Files selected for processing (1)
  • frontend/src/components/TopContributorsList.tsx (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
frontend/src/components/TopContributorsList.tsx (2)
frontend/src/utils/urlFormatter.ts (1)
  • getMemberUrl (1-1)
frontend/src/utils/capitalize.ts (1)
  • capitalize (1-4)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Run frontend e2e tests
  • GitHub Check: Run backend tests
  • GitHub Check: Run frontend unit tests
  • GitHub Check: CodeQL (javascript-typescript)
🔇 Additional comments (2)
frontend/src/components/TopContributorsList.tsx (2)

17-17: LGTM! Increased initial display count aligns with PR objectives.

The increase from 6 to 12 contributors shown initially is consistent with the goal of displaying more contributors and works well with the updated grid layout.


49-65: Excellent simplification that aligns with PR objectives.

The removal of contribution counts and pluralization logic successfully addresses the inconsistency issues mentioned in the PR objectives. The simplified contributor display now focuses on the essential information (avatar and name) while maintaining good accessibility with proper title attributes.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ark/update-top-contributors

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 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 auto-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.

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
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: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b759841 and 48f5728.

📒 Files selected for processing (36)
  • backend/apps/github/graphql/queries/repository_contributor.py (1 hunks)
  • frontend/__tests__/e2e/data/mockHomeData.ts (0 hunks)
  • frontend/__tests__/e2e/pages/About.spec.ts (1 hunks)
  • frontend/__tests__/e2e/pages/ChapterDetails.spec.ts (1 hunks)
  • frontend/__tests__/e2e/pages/CommitteeDetails.spec.ts (0 hunks)
  • frontend/__tests__/e2e/pages/Home.spec.ts (1 hunks)
  • frontend/__tests__/e2e/pages/ProjectDetails.spec.ts (1 hunks)
  • frontend/__tests__/e2e/pages/RepositoryDetails.spec.ts (1 hunks)
  • frontend/__tests__/e2e/pages/UserDetails.spec.ts (0 hunks)
  • frontend/__tests__/unit/data/mockAboutData.ts (0 hunks)
  • frontend/__tests__/unit/data/mockChapterData.ts (0 hunks)
  • frontend/__tests__/unit/data/mockChapterDetailsData.ts (0 hunks)
  • frontend/__tests__/unit/data/mockCommitteeData.ts (0 hunks)
  • frontend/__tests__/unit/data/mockCommitteeDetailsData.ts (0 hunks)
  • frontend/__tests__/unit/data/mockHomeData.ts (0 hunks)
  • frontend/__tests__/unit/data/mockOrganizationData.ts (0 hunks)
  • frontend/__tests__/unit/data/mockProjectData.ts (0 hunks)
  • frontend/__tests__/unit/data/mockProjectDetailsData.ts (0 hunks)
  • frontend/__tests__/unit/data/mockRepositoryData.ts (0 hunks)
  • frontend/__tests__/unit/data/mockSnapshotData.ts (0 hunks)
  • frontend/__tests__/unit/pages/About.test.tsx (2 hunks)
  • frontend/__tests__/unit/pages/ChapterDetails.test.tsx (1 hunks)
  • frontend/__tests__/unit/pages/CommitteeDetails.test.tsx (0 hunks)
  • frontend/__tests__/unit/pages/ProjectDetails.test.tsx (1 hunks)
  • frontend/__tests__/unit/pages/RepositoryDetails.test.tsx (1 hunks)
  • frontend/src/app/about/page.tsx (1 hunks)
  • frontend/src/app/page.tsx (1 hunks)
  • frontend/src/components/CardDetailsPage.tsx (1 hunks)
  • frontend/src/components/ContributorAvatar.tsx (2 hunks)
  • frontend/src/components/TopContributorsList.tsx (2 hunks)
  • frontend/src/server/queries/committeeQueries.ts (0 hunks)
  • frontend/src/server/queries/homeQueries.ts (1 hunks)
  • frontend/src/server/queries/organizationQueries.ts (0 hunks)
  • frontend/src/server/queries/projectQueries.ts (0 hunks)
  • frontend/src/server/queries/repositoryQueries.ts (0 hunks)
  • frontend/src/types/contributor.ts (1 hunks)
💤 Files with no reviewable changes (19)
  • frontend/tests/e2e/pages/UserDetails.spec.ts
  • frontend/tests/unit/data/mockCommitteeData.ts
  • frontend/tests/unit/data/mockProjectData.ts
  • frontend/tests/unit/data/mockCommitteeDetailsData.ts
  • frontend/tests/unit/data/mockRepositoryData.ts
  • frontend/tests/unit/data/mockProjectDetailsData.ts
  • frontend/src/server/queries/repositoryQueries.ts
  • frontend/tests/e2e/pages/CommitteeDetails.spec.ts
  • frontend/src/server/queries/organizationQueries.ts
  • frontend/tests/unit/data/mockChapterData.ts
  • frontend/tests/e2e/data/mockHomeData.ts
  • frontend/tests/unit/data/mockHomeData.ts
  • frontend/tests/unit/pages/CommitteeDetails.test.tsx
  • frontend/tests/unit/data/mockOrganizationData.ts
  • frontend/tests/unit/data/mockChapterDetailsData.ts
  • frontend/src/server/queries/projectQueries.ts
  • frontend/tests/unit/data/mockAboutData.ts
  • frontend/src/server/queries/committeeQueries.ts
  • frontend/tests/unit/data/mockSnapshotData.ts
🧰 Additional context used
🧠 Learnings (1)
frontend/src/components/CardDetailsPage.tsx (2)
Learnt from: ahmedxgouda
PR: OWASP/Nest#1633
File: frontend/src/components/HealthMetrics.tsx:30-30
Timestamp: 2025-06-20T16:12:59.256Z
Learning: In the DetailsCard component (frontend/src/components/CardDetailsPage.tsx), there's a length check before rendering HealthMetrics: `healthMetricsData.length > 0`. This ensures that when HealthMetrics is rendered, the data array has at least one element, making accessing data[0] safe within the HealthMetrics component.
Learnt from: ahmedxgouda
PR: OWASP/Nest#1633
File: frontend/src/components/HealthMetrics.tsx:30-30
Timestamp: 2025-06-20T16:12:59.256Z
Learning: In the DetailsCard component (frontend/src/components/CardDetailsPage.tsx), there's a safety check that ensures HealthMetrics component is only rendered when healthMetricsData exists and has at least one element: `healthMetricsData && healthMetricsData.length > 0`. This makes accessing data[0] safe within the HealthMetrics component.
🧬 Code Graph Analysis (1)
frontend/src/components/TopContributorsList.tsx (2)
frontend/src/utils/urlFormatter.ts (1)
  • getMemberUrl (1-1)
frontend/src/utils/capitalize.ts (1)
  • capitalize (1-4)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: CodeQL (javascript-typescript)
  • GitHub Check: CodeQL (python)
🔇 Additional comments (26)
frontend/src/app/page.tsx (1)

308-309: LGTM! Consistent implementation of increased contributor display.

The increase from 9 to 12 initial contributors aligns well with the PR objectives to revamp the top contributor list component. The change provides better visibility while maintaining reasonable performance.

frontend/src/app/about/page.tsx (1)

128-129: LGTM! Maintains consistency with other component updates.

The change maintains consistency with the main page and other components using TopContributorsList. The increased initial display count enhances user experience by showing more contributors upfront.

frontend/__tests__/e2e/pages/ChapterDetails.spec.ts (1)

45-48: LGTM! Improved test precision with exact matching.

Adding { exact: true } to contributor assertions improves test reliability by ensuring precise matching of contributor names and images. This is particularly important after removing contribution counts from the UI.

frontend/__tests__/e2e/pages/About.spec.ts (1)

45-46: LGTM! Consistent test improvement across page tests.

The exact matching approach is consistently applied across different page tests, ensuring reliable contributor name assertions. This maintains testing consistency and improves overall test quality.

frontend/src/components/CardDetailsPage.tsx (1)

203-204: LGTM! Consistent implementation across the shared component.

The change maintains consistency with other TopContributorsList usages throughout the application. Since CardDetailsPage is used across multiple detail pages, this ensures a uniform user experience with increased contributor visibility.

frontend/src/types/contributor.ts (1)

3-3: LGTM: Proper handling of optional contributionsCount.

Making the contributionsCount property optional is the right approach for this migration, allowing components to gracefully handle the absence of contribution count data while maintaining backward compatibility.

backend/apps/github/graphql/queries/repository_contributor.py (1)

16-16: LGTM: Increased default limit aligns with frontend changes.

The increase from 15 to 20 contributors aligns with the coordinated changes to display more contributors by default across the application.

frontend/__tests__/e2e/pages/Home.spec.ts (1)

60-61: LGTM: Improved test precision with exact matching.

Adding { exact: true } to the contributor assertions makes the tests more precise and less prone to false positives. This is a good testing practice.

frontend/__tests__/e2e/pages/RepositoryDetails.spec.ts (1)

58-61: LGTM: Consistent test improvements with exact matching.

The addition of { exact: true } follows the same pattern as other test files, ensuring consistent and precise test assertions across the application.

frontend/__tests__/e2e/pages/ProjectDetails.spec.ts (1)

62-65: LGTM: Completes the consistent test improvement pattern.

These changes complete the coordinated effort to add exact matching to contributor assertions across all e2e test files, maintaining consistency and improving test precision.

frontend/__tests__/unit/pages/ChapterDetails.test.tsx (2)

87-89: LGTM! Test expectations updated correctly.

The test expectations have been properly updated to reflect the increased maxInitialDisplay from 9 to 12, now expecting Contributors 10 and 12 to be visible initially, and Contributor 13 to not be visible.


105-110: LGTM! Mock data simplified appropriately.

The removal of contributionsCount from the mock contributor object is consistent with the broader changes to remove contribution counters from the UI.

frontend/src/components/TopContributorsList.tsx (3)

17-17: LGTM! Increased initial display count improves user experience.

Doubling the maxInitialDisplay from 6 to 12 provides better visibility of contributors without requiring user interaction.


46-46: LGTM! Grid layout updated to accommodate more contributors.

The change from 3 to 4 columns on medium screens appropriately accommodates the increased initial display count while maintaining good visual balance.


49-65: LGTM! Simplified rendering removes problematic contribution counts.

The simplified rendering that removes contribution counts addresses the core issue mentioned in the PR description about inconsistent values. The addition of title attributes for accessibility is a nice touch.

frontend/src/components/ContributorAvatar.tsx (2)

13-13: LGTM! Type guard simplified appropriately.

Removing the contributionsCount check from the type guard makes sense since this property is now optional in the Contributor type.


33-35: LGTM! Conditional tooltip content handles both cases gracefully.

The conditional tooltip content elegantly handles contributors both with and without contributionsCount, maintaining backward compatibility while adapting to the new optional nature of this property.

frontend/__tests__/unit/pages/About.test.tsx (3)

206-208: LGTM! Test expectations updated for increased initial display.

The test expectations have been correctly updated to reflect the increased maxInitialDisplay from 9 to 12, now expecting Contributors 10 and 12 to be visible initially.


217-227: LGTM! Toggle functionality tests updated consistently.

The toggle functionality tests have been properly updated to reflect the new display boundaries - expecting Contributor 12 to be visible initially, and Contributors 13, 14, 15 to appear after clicking "Show more".


234-234: LGTM! "Show less" functionality test updated correctly.

The test correctly expects Contributor 13 to not be visible after clicking "Show less", consistent with the new display boundaries.

frontend/__tests__/unit/pages/RepositoryDetails.test.tsx (3)

104-105: Test updates correctly reflect the new initial display limit.

The test expectations have been properly updated to verify that the initial state now shows 12 contributors instead of the previous smaller number, aligning with the increased display limit in the TopContributorsList component.


112-114: Expanded state test coverage looks comprehensive.

The test properly verifies that clicking "Show more" reveals contributors 13, 14, and 15, ensuring the expanded view functionality works as expected with the new display limits.


121-121: Collapse functionality test is correctly updated.

The test appropriately verifies that clicking "Show less" hides contributor 13, returning to the initial collapsed state with 12 visible contributors.

frontend/__tests__/unit/pages/ProjectDetails.test.tsx (3)

111-112: Test updates maintain consistency across components.

The test expectations are correctly updated to match the new initial display limit of 12 contributors, maintaining consistency with the RepositoryDetails test updates.


119-121: Comprehensive testing of expanded contributor view.

The test properly verifies that all expected contributors (13, 14, and 15) become visible after clicking "Show more", ensuring the functionality works correctly across different page components.


128-128: Collapse state test correctly implemented.

The test appropriately verifies the return to the initial collapsed state, ensuring contributor 13 is no longer visible after clicking "Show less".

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: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 48f5728 and d212cc3.

📒 Files selected for processing (3)
  • frontend/src/server/queries/chapterQueries.ts (0 hunks)
  • frontend/src/server/queries/snapshotQueries.ts (0 hunks)
  • frontend/src/types/user.ts (1 hunks)
💤 Files with no reviewable changes (2)
  • frontend/src/server/queries/chapterQueries.ts
  • frontend/src/server/queries/snapshotQueries.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
frontend/src/types/user.ts (3)
frontend/src/types/issue.ts (1)
  • Issue (3-19)
frontend/src/types/release.ts (1)
  • Release (3-14)
frontend/src/types/project.ts (1)
  • RepositoryCardProps (51-61)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Run Code Scan
  • GitHub Check: Run CI Denendencies Scan
  • GitHub Check: CodeQL (python)
  • GitHub Check: CodeQL (javascript-typescript)
🔇 Additional comments (2)
frontend/src/types/user.ts (2)

12-16: Clarify the inconsistency with PR objectives regarding contributionsCount.

The addition of the required contributionsCount field seems inconsistent with the PR's objective of removing contribution counters due to inconsistent values. If contribution counters are being removed from the UI, consider making this field optional or explain why it's needed as a required field.

The new optional profile fields (bio, company, email) are good additions for a comprehensive user model.


20-24: LGTM on the additional user profile fields.

The addition of issuesCount, location, and name as optional fields enhances the User type definition and provides more comprehensive user data modeling.

@arkid15r arkid15r marked this pull request as ready for review July 11, 2025 00:18
@arkid15r arkid15r requested a review from kasya as a code owner July 11, 2025 00:18
@arkid15r arkid15r requested a review from aramattamara July 11, 2025 00:18
Copy link
Collaborator

@kasya kasya left a comment

Choose a reason for hiding this comment

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

Looks great! Left one suggestion ⬇️

@arkid15r arkid15r enabled auto-merge July 11, 2025 01:42
@sonarqubecloud
Copy link

Copy link
Collaborator

@kasya kasya left a comment

Choose a reason for hiding this comment

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

🚀

@arkid15r arkid15r added this pull request to the merge queue Jul 11, 2025
Merged via the queue into main with commit 70acb5a Jul 11, 2025
24 checks passed
@arkid15r arkid15r deleted the ark/update-top-contributors branch July 11, 2025 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants