- Notifications
You must be signed in to change notification settings - Fork95
Added repository count and followers count for the users/organizations page#1370
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation
Summary by CodeRabbit
WalkthroughThe changes introduce a new attribute for public repository counts in both backend and frontend code. On the backend, indexing functions are updated to include an additional attribute ( Changes
Suggested labels
Suggested reviewers
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat withCodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
frontend/src/types/card.ts (1)
54-64
:Naming consistency between interfaces.I noticed that we're using
public_repositories_count
inOrganizationTypeAlgolia
butrepositories_count
inUserCardProps
. While this works, consider using consistent naming across the codebase to avoid confusion.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
backend/apps/core/utils/index.py
(1 hunks)backend/apps/github/index/organization.py
(1 hunks)backend/apps/github/models/mixins/organization.py
(1 hunks)frontend/src/app/members/page.tsx
(1 hunks)frontend/src/app/organizations/page.tsx
(1 hunks)frontend/src/components/UserCard.tsx
(2 hunks)frontend/src/types/card.ts
(1 hunks)frontend/src/types/organization.ts
(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
frontend/src/app/members/page.tsx (1)
frontend/src/types/user.ts (1)
user
(3-17)
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: Run backend tests
- GitHub Check: Run frontend e2e tests
- GitHub Check: Run frontend unit tests
- GitHub Check: CodeQL (python)
- GitHub Check: CodeQL (javascript-typescript)
🔇 Additional comments (10)
frontend/src/types/organization.ts (1)
14-14
:LGTM: Added repository count property successfully.The addition of
public_repositories_count
as a required number property to theOrganizationTypeAlgolia
interface properly enables tracking and displaying the count of public repositories for organizations.frontend/src/types/card.ts (1)
63-63
:LGTM: Added repository count to UserCardProps.The addition of the optional
repositories_count
property to theUserCardProps
interface aligns with the PR objectives, allowing displaying repository counts for users while maintaining consistency with other existing optional properties likefollowers_count
.backend/apps/github/index/organization.py (1)
22-22
:LGTM: Added repository count field to Algolia index.The addition of
"idx_public_repositories_count"
to the fields tuple properly exposes this data for indexing in Algolia, which is correctly positioned in alphabetical order among the other fields.backend/apps/github/models/mixins/organization.py (1)
69-73
:LGTM: Added property method for repository count.The new
idx_public_repositories_count
property method follows the established pattern of other index mixin properties, is well-documented, and correctly returns the organization's public repositories count for indexing purposes.backend/apps/core/utils/index.py (1)
119-130
:LGTM: Added repository count attribute for organizationsYou've correctly added the
idx_public_repositories_count
attribute to the list of retrievable attributes for organizations, which will ensure this data is available for the frontend.frontend/src/app/members/page.tsx (1)
43-46
:Well-implemented followers and repositories countGood addition of the followers and repositories count properties to the UserCard component. The implementation correctly uses the existing properties from the user object.
frontend/src/app/organizations/page.tsx (1)
40-48
:Props reordering with repositories count addedThe reordering of properties improves readability, and the addition of the repositories count from
organization.public_repositories_count
aligns with the backend changes.frontend/src/components/UserCard.tsx (3)
1-7
:Good imports for new functionalityYou've added the required imports for the new feature:
faFileCode
for the repository icon andmillify
for nicely formatting large numbers.
8-18
:Well-structured props destructuringThe props are now properly reorganized and include the new
repositories_count
property. The order makes logical sense, grouping related properties together.
45-58
:Nice UI implementation for displaying countsGreat implementation of the counts display:
- The flex container with gap creates a clean layout
- Conditional rendering ensures counts are only shown when they exist
- Using
millify
with precision parameter makes the numbers more readable- Appropriate icons add visual context for each metric
Please retry analysis of this Pull-Request directly on SonarQube Cloud |
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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
frontend/__tests__/e2e/pages/Organizations.spec.ts (1)
39-42
:Make the test more specific by associating counts with their metrics.The test verifies that formatted counts are visible but doesn't distinguish between followers and repositories counts. Consider using more specific selectors or data-testid attributes to ensure you're testing the right metrics in the right places.
- test('displays followers and repositories counts correctly', async ({ page }) => {- await expect(page.getByText('1k')).toBeVisible()- await expect(page.getByText('1.5k')).toBeVisible()+ test('displays followers and repositories counts correctly', async ({ page }) => {+ // Check first organization (test-org) with 1k followers and 2k repositories+ await expect(page.locator('[data-testid="followers-count"]').first()).toContainText('1k')+ await expect(page.locator('[data-testid="repositories-count"]').first()).toContainText('2k')++ // Check second organization (another-org) with 2k followers and 1.5k repositories+ await expect(page.locator('[data-testid="followers-count"]').nth(1)).toContainText('2k')+ await expect(page.locator('[data-testid="repositories-count"]').nth(1)).toContainText('1.5k') })frontend/__tests__/e2e/pages/Users.spec.ts (1)
56-61
:Enhance test specificity for metric values.Similar to the Organizations test, this test could be more specific about which metric each value represents. Consider using more precise selectors or data-testid attributes to avoid potential ambiguity.
test('displays followers and repositories counts correctly', async ({ page }) => { const userButton = await page.getByRole('button', { name: 'John Doe' }) await userButton.waitFor({ state: 'visible' })- await expect(page.getByText('1k')).toBeVisible()- await expect(page.getByText('2k')).toBeVisible()+ await expect(page.locator('[data-testid="followers-count"]').first()).toContainText('1k')+ await expect(page.locator('[data-testid="repositories-count"]').first()).toContainText('2k') })
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
frontend/__tests__/e2e/pages/Organizations.spec.ts
(1 hunks)frontend/__tests__/e2e/pages/Users.spec.ts
(2 hunks)frontend/__tests__/unit/data/mockOrganizationData.ts
(2 hunks)frontend/__tests__/unit/data/mockUserData.ts
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Run frontend e2e tests
- GitHub Check: Run frontend unit tests
🔇 Additional comments (4)
frontend/__tests__/unit/data/mockUserData.ts (1)
9-10
:LGTM! The mock data updates properly support the new feature.The addition of follower and repository counts to the mock user data correctly implements the structure needed for testing the new UI features.
Also applies to: 18-19
frontend/__tests__/unit/data/mockOrganizationData.ts (1)
15-15
:LGTM! The mock organization data now includes public repository counts.The addition of the
public_repositories_count
property to the organization objects properly supports the new feature for displaying repository counts.Also applies to: 31-31
frontend/__tests__/e2e/pages/Users.spec.ts (2)
27-28
:Button name simplification improves test clarity.The simplified button names make the tests more maintainable and less brittle. This is a good improvement.
Also applies to: 50-50
43-43
:Good use ofexact: true
for precise button selection.Adding the
exact: true
option for the page number button prevents potential false matches with other elements containing the text "2".
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.
LGTM 👍
Add the PR description here.