Skip to content

Conversation

@codic-yeeshu
Copy link
Contributor

Resolves #1425

  • Improved breadcrumbs by introducing a Page Layout component.
  • Instead of showing elements from the URL, we now use props as breadcrumb items.
  • Also modified test cases that were affected by the changes.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 29, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a unified page layout with breadcrumb navigation across detail and search pages for a more consistent user experience.
    • Added a new layout component that supports both automatic and custom breadcrumb generation.
  • Refactor

    • Updated the breadcrumb component to accept explicit breadcrumb data instead of deriving it from the URL path.
    • Refactored multiple test files to use shared assertion utilities, improving maintainability and consistency.
    • Removed inline breadcrumb rendering from the main layout in favor of the new page layout approach.
    • Adjusted test assertions for headings to use more accessible queries.
  • Style

    • Modified detail card backgrounds for improved visual consistency.
  • Chores

    • Updated test and TypeScript configurations to support new test utilities and path aliases.

Walkthrough

This change refactors the BreadCrumbs component to accept explicit breadcrumb items, introduces a new PageLayout component to handle breadcrumb and page structure, and updates all relevant pages to use this layout for improved breadcrumb accuracy. Shared test utilities are added, and existing tests are refactored to use these helpers and validate the new breadcrumb logic.

Changes

Files/Groups Change Summary
frontend/tests/testUtils/sharedAssertions.ts Added shared async assertion utilities for React Testing Library: assertRepoDetails, assertHeadingsAndTexts, and assertContributorToggle.
frontend/tests/unit/components/BreadCrumbs.test.tsx Refactored tests to pass breadcrumb items as props instead of relying on pathname; introduced helper for rendering with items.
frontend/tests/unit/pages/About.test.tsx
.../CommitteeDetails.test.tsx
.../OrganizationDetails.test.tsx
.../ProjectDetails.test.tsx
.../RepositoryDetails.test.tsx
.../SnapshotDetails.test.tsx
.../UserDetails.test.tsx
Refactored tests to use shared assertion helpers and updated heading queries for better accessibility; removed direct fireEvent usage where replaced by helpers.
frontend/jest.config.ts
frontend/tsconfig.json
Updated Jest and TypeScript configs to support the new testUtils directory and alias.
frontend/src/app/about/page.tsx
.../chapters/[chapterKey]/page.tsx
.../chapters/page.tsx
.../committees/[committeeKey]/page.tsx
.../committees/page.tsx
.../contribute/page.tsx
.../members/[memberKey]/page.tsx
.../members/page.tsx
.../organizations/[organizationKey]/page.tsx
.../organizations/page.tsx
.../organizations/[organizationKey]/repositories/[repositoryKey]/page.tsx
.../projects/[projectKey]/page.tsx
.../projects/page.tsx
.../snapshots/[id]/page.tsx
.../snapshots/page.tsx
Wrapped page content in new PageLayout component, passing appropriate breadcrumbItems for each page, and updated how breadcrumbs are constructed (using entity names instead of keys where possible).
frontend/src/app/layout.tsx Removed BreadCrumbs import and usage from RootLayout.
frontend/src/components/BreadCrumbs.tsx Refactored to accept breadcrumbItems as props, removed internal pathname logic, and updated rendering logic for explicit breadcrumbs.
frontend/src/components/PageLayout.tsx Added new PageLayout component to generate and render breadcrumbs and wrap page content; supports both automatic and explicit breadcrumb construction.
frontend/src/components/CardDetailsPage.tsx Removed light mode background color class from DetailsCard outer div.

Assessment against linked issues

Objective (Issue #) Addressed Explanation
Refactor BreadCrumbs to accept explicit breadcrumb items and display entity names instead of keys (#1425)
Update all relevant pages to use the improved breadcrumb logic and show correct H1 headers (#1425)
Implement PageLayout to manage breadcrumb and page structure consistently (#1425)
Add/Update tests to cover new breadcrumb logic and ensure correct display (#1425)

Assessment against linked issues: Out-of-scope changes

Code Change (file_path) Explanation
Addition of shared assertion helpers for repository details, headings/texts, and contributor toggling (frontend/tests/testUtils/sharedAssertions.ts) These utilities, while beneficial for test maintainability, are not directly required by the breadcrumb objectives in #1425.
Refactoring of contributor toggle and details assertions in unrelated test files (multiple test files) These test changes are not related to the breadcrumb improvements requested in #1425.
Removal of light mode background color in DetailsCard (frontend/src/components/CardDetailsPage.tsx) This styling change is unrelated to breadcrumb or layout objectives in #1425.

Possibly related PRs

  • OWASP/Nest#960: Refactors contributor toggle tests, related at the test utility and test case level.
  • OWASP/Nest#1397: Implements the initial BreadCrumbs component, directly related to the refactor in this PR.

Suggested reviewers

  • kasya
  • arkid15r
  • aramattamara
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment

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

🧹 Nitpick comments (8)
frontend/src/app/committees/page.tsx (1)

67-67: Simplify the conditional rendering with optional chaining.

The current pattern can be improved using optional chaining for better readability and modern JavaScript practices.

Apply this diff:

-        {committees && committees.map(renderCommitteeCard)}
+        {committees?.map(renderCommitteeCard)}
frontend/src/app/projects/page.tsx (1)

62-86: LGTM! Consistent page layout implementation with minor optimization opportunity.

The PageLayout wrapper correctly provides breadcrumb navigation and follows the established pattern across the application.

Consider using optional chaining for cleaner code:

-        {projects && projects.filter((project) => project.isActive).map(renderProjectCard)}
+        {projects?.filter((project) => project.isActive).map(renderProjectCard)}
frontend/src/app/contribute/page.tsx (1)

74-89: LGTM! Consistent page layout implementation with minor optimization opportunity.

The PageLayout wrapper correctly follows the established pattern and provides consistent page structure across the application.

Consider using optional chaining for cleaner code:

-        {issues && issues.map(renderContributeCard)}
+        {issues?.map(renderContributeCard)}
frontend/src/app/members/page.tsx (1)

67-67: Use optional chaining for safer array access.

The static analysis tool correctly identifies that optional chaining would be safer here.

-          {users && users.map((user) => <div key={user.key}>{renderUserCard(user)}</div>)}
+          {users?.map((user) => <div key={user.key}>{renderUserCard(user)}</div>)}
frontend/src/app/chapters/page.tsx (1)

105-105: Use optional chaining for safer array access.

The static analysis tool correctly identifies that optional chaining would be safer here.

-        {chapters && chapters.filter((chapter) => chapter.isActive).map(renderChapterCard)}
+        {chapters?.filter((chapter) => chapter.isActive).map(renderChapterCard)}
frontend/src/app/organizations/page.tsx (1)

68-68: Address the optional chaining suggestion.

Static analysis correctly identifies that this could be made safer with optional chaining.

Apply this diff to use optional chaining:

-        {organizations && organizations.map(renderOrganizationCard)}
+        {organizations?.map(renderOrganizationCard)}

This provides the same safety but with more concise syntax.

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

8-15: Improve TypeScript interface naming and consistency.

The interface naming could be more consistent and descriptive.

-export interface crumbItem {
+export interface CrumbItem {
   title: string
 }

 export interface PageLayoutProps {
-  breadcrumbItems?: crumbItem | crumbItem[]
+  breadcrumbItems?: CrumbItem | CrumbItem[]
   children: React.ReactNode
 }

43-54: Simplify complex breadcrumb logic.

The current logic is hard to follow with multiple conditionals. Consider breaking it down for better readability.

 export default function PageLayout({ breadcrumbItems, children }: PageLayoutProps) {
   const pathname = usePathname()
-  const isBreadCrumbItemsEmpty = _.isEmpty(breadcrumbItems)
-  let allBreadcrumbs: BreadCrumbItem[]
-  if (_.isArray(breadcrumbItems)) {
-    allBreadcrumbs = generateBreadcrumbsFromItems(breadcrumbItems, pathname)
-  } else {
-    const autoBreadcrumbs = generateAutoBreadcrumbs(pathname, !isBreadCrumbItemsEmpty)
-    allBreadcrumbs = isBreadCrumbItemsEmpty
-      ? autoBreadcrumbs
-      : [...autoBreadcrumbs, { title: _.get(breadcrumbItems, 'title', ''), path: pathname }]
-  }
+  
+  const allBreadcrumbs = useMemo(() => {
+    if (_.isEmpty(breadcrumbItems)) {
+      return generateAutoBreadcrumbs(pathname)
+    }
+    
+    if (_.isArray(breadcrumbItems)) {
+      return generateBreadcrumbsFromItems(breadcrumbItems, pathname)
+    }
+    
+    // Single breadcrumb item
+    const autoBreadcrumbs = generateAutoBreadcrumbs(pathname, true)
+    return [...autoBreadcrumbs, { title: breadcrumbItems.title, path: pathname }]
+  }, [breadcrumbItems, pathname])

Don't forget to import useMemo:

+import React, { useMemo } from 'react'
-import React from 'react'
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 822908b and c89fbc6.

📒 Files selected for processing (30)
  • frontend/__tests__/testUtils/sharedAssertions.ts (1 hunks)
  • frontend/__tests__/unit/components/BreadCrumbs.test.tsx (1 hunks)
  • frontend/__tests__/unit/pages/About.test.tsx (2 hunks)
  • frontend/__tests__/unit/pages/CommitteeDetails.test.tsx (2 hunks)
  • frontend/__tests__/unit/pages/OrganizationDetails.test.tsx (1 hunks)
  • frontend/__tests__/unit/pages/ProjectDetails.test.tsx (4 hunks)
  • frontend/__tests__/unit/pages/RepositoryDetails.test.tsx (4 hunks)
  • frontend/__tests__/unit/pages/SnapshotDetails.test.tsx (4 hunks)
  • frontend/__tests__/unit/pages/UserDetails.test.tsx (3 hunks)
  • frontend/jest.config.ts (1 hunks)
  • frontend/src/app/about/page.tsx (2 hunks)
  • frontend/src/app/chapters/[chapterKey]/page.tsx (2 hunks)
  • frontend/src/app/chapters/page.tsx (2 hunks)
  • frontend/src/app/committees/[committeeKey]/page.tsx (2 hunks)
  • frontend/src/app/committees/page.tsx (2 hunks)
  • frontend/src/app/contribute/page.tsx (2 hunks)
  • frontend/src/app/layout.tsx (0 hunks)
  • frontend/src/app/members/[memberKey]/page.tsx (2 hunks)
  • frontend/src/app/members/page.tsx (2 hunks)
  • frontend/src/app/organizations/[organizationKey]/page.tsx (2 hunks)
  • frontend/src/app/organizations/[organizationKey]/repositories/[repositoryKey]/page.tsx (2 hunks)
  • frontend/src/app/organizations/page.tsx (2 hunks)
  • frontend/src/app/projects/[projectKey]/page.tsx (2 hunks)
  • frontend/src/app/projects/page.tsx (2 hunks)
  • frontend/src/app/snapshots/[id]/page.tsx (2 hunks)
  • frontend/src/app/snapshots/page.tsx (2 hunks)
  • frontend/src/components/BreadCrumbs.tsx (2 hunks)
  • frontend/src/components/CardDetailsPage.tsx (1 hunks)
  • frontend/src/components/PageLayout.tsx (1 hunks)
  • frontend/tsconfig.json (2 hunks)
💤 Files with no reviewable changes (1)
  • frontend/src/app/layout.tsx
🧰 Additional context used
🧠 Learnings (7)
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.
frontend/src/app/committees/[committeeKey]/page.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 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.
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.
frontend/src/app/projects/[projectKey]/page.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.
frontend/src/app/snapshots/page.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 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.
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.
frontend/src/app/chapters/[chapterKey]/page.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.
frontend/src/app/members/[memberKey]/page.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.
frontend/src/app/snapshots/[id]/page.tsx (1)
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 (7)
frontend/src/app/committees/page.tsx (1)
frontend/src/components/PageLayout.tsx (1)
  • PageLayout (43-62)
frontend/src/app/organizations/page.tsx (1)
frontend/src/components/PageLayout.tsx (1)
  • PageLayout (43-62)
frontend/src/app/contribute/page.tsx (1)
frontend/src/components/PageLayout.tsx (1)
  • PageLayout (43-62)
frontend/__tests__/unit/pages/About.test.tsx (1)
frontend/__tests__/testUtils/sharedAssertions.ts (1)
  • assertContributorToggle (51-72)
frontend/__tests__/unit/pages/SnapshotDetails.test.tsx (1)
frontend/__tests__/testUtils/sharedAssertions.ts (1)
  • assertHeadingsAndTexts (32-49)
frontend/__tests__/unit/pages/ProjectDetails.test.tsx (1)
frontend/__tests__/testUtils/sharedAssertions.ts (2)
  • assertRepoDetails (3-30)
  • assertContributorToggle (51-72)
frontend/__tests__/unit/pages/RepositoryDetails.test.tsx (1)
frontend/__tests__/testUtils/sharedAssertions.ts (2)
  • assertRepoDetails (3-30)
  • assertContributorToggle (51-72)
🪛 Biome (1.9.4)
frontend/src/app/committees/page.tsx

[error] 67-67: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

frontend/src/app/members/page.tsx

[error] 67-67: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

frontend/src/app/organizations/page.tsx

[error] 68-68: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

frontend/src/app/chapters/page.tsx

[error] 105-105: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

frontend/src/app/contribute/page.tsx

[error] 86-86: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

frontend/src/app/projects/page.tsx

[error] 83-83: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

🔇 Additional comments (61)
frontend/src/app/committees/page.tsx (1)

55-69: LGTM! PageLayout integration follows the established pattern.

The introduction of PageLayout wrapper provides consistent breadcrumb navigation and page structure. This aligns with the broader refactor across the application.

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

64-64: Background styling change aligns with PageLayout refactor.

Removing the explicit bg-white class is appropriate since PageLayout now handles the overall page background and layout structure consistently across the application.

frontend/tsconfig.json (2)

27-27: Test utilities path alias properly configured.

Adding the @testUtils/* alias enables clean imports of shared test utilities and follows the established alias pattern in the project.


39-39: Include array properly updated for test utilities.

Adding "__tests__" to the include array ensures TypeScript processes the test utility files during compilation, which is necessary for the new shared test utilities.

frontend/src/app/committees/[committeeKey]/page.tsx (2)

20-20: PageLayout import added for breadcrumb support.

The import follows the established pattern for introducing consistent page layout and breadcrumb navigation.


84-94: PageLayout wrapper correctly implemented.

The PageLayout component properly wraps the DetailsCard and passes the committee name as breadcrumb title. This provides consistent navigation structure while preserving all existing functionality.

frontend/src/app/projects/[projectKey]/page.tsx (2)

21-21: PageLayout import consistent with refactor pattern.

The import aligns with the broader refactor to introduce consistent page layout and breadcrumb navigation across detail pages.


94-112: PageLayout implementation matches established pattern.

The PageLayout wrapper correctly encapsulates the DetailsCard and provides the project name for breadcrumb navigation. All existing props and functionality are preserved while adding consistent page structure.

frontend/__tests__/unit/pages/OrganizationDetails.test.tsx (1)

73-74: LGTM! Improved semantic query for better accessibility testing.

The change from getByText to getByRole('heading') is an excellent improvement that makes the test more semantic and accessible-focused. This approach better reflects how users and assistive technologies interact with the content.

frontend/jest.config.ts (2)

35-39: LGTM! Proper Jest configuration for test utilities.

Correctly excludes the testUtils directory from test discovery while maintaining it in coverage collection.


45-45: LGTM! Convenient alias for test utilities.

The @testUtils alias follows the established pattern and provides clean imports for shared test utilities.

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

10-10: LGTM! Added PageLayout import for consistent page structure.

Properly imports the new PageLayout component to enable breadcrumb navigation and consistent page layout.

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

12-12: LGTM! Added PageLayout import for consistent page structure.

Properly imports the PageLayout component to enable uniform layout and breadcrumb navigation.

frontend/src/app/organizations/[organizationKey]/page.tsx (2)

18-18: LGTM! Added PageLayout import for consistent page structure.

Properly imports the PageLayout component to enable breadcrumb navigation and layout consistency.


117-132: LGTM! Excellent implementation of PageLayout with explicit breadcrumb items.

The PageLayout wrapper correctly follows the new pattern by:

  • Providing consistent page structure and breadcrumb navigation
  • Explicitly passing the organization name as breadcrumb title
  • Maintaining all existing DetailsCard functionality

This implementation properly supports the breadcrumb refactor where items are now passed as props instead of being derived from the URL.

frontend/src/app/members/page.tsx (2)

6-6: LGTM: Consistent PageLayout integration.

The addition of the PageLayout import aligns with the breadcrumb enhancement objective.


54-70: LGTM: Proper PageLayout wrapping pattern.

The wrapping of SearchPageLayout with PageLayout follows the consistent architectural pattern being applied across all pages for improved breadcrumb navigation.

frontend/src/app/snapshots/page.tsx (2)

10-10: LGTM: Consistent PageLayout integration.

The addition of the PageLayout import aligns with the breadcrumb enhancement objective.


66-80: LGTM: Proper PageLayout wrapping pattern.

The wrapping of the entire page content with PageLayout follows the consistent architectural pattern being applied across all pages for improved breadcrumb navigation.

frontend/src/app/chapters/page.tsx (2)

12-12: LGTM: Consistent PageLayout integration.

The addition of the PageLayout import aligns with the breadcrumb enhancement objective.


80-107: LGTM: Proper PageLayout wrapping pattern.

The wrapping of SearchPageLayout with PageLayout follows the consistent architectural pattern being applied across all pages for improved breadcrumb navigation.

frontend/src/app/chapters/[chapterKey]/page.tsx (2)

13-13: LGTM: Consistent PageLayout integration.

The addition of the PageLayout import aligns with the breadcrumb enhancement objective.


64-75: Excellent breadcrumb implementation.

This demonstrates the proper enhancement from URL-derived breadcrumbs to explicit breadcrumb props. The breadcrumbItems={{ title: chapter.name }} provides accurate context-aware breadcrumb navigation.

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

3-3: LGTM: Good test utility integration.

The import of shared assertion utilities follows DRY principles and improves test maintainability.


52-63: Excellent test refactoring.

Replacing multiple individual assertions with the shared assertHeadingsAndTexts utility reduces code duplication and improves maintainability. The ESLint disable comment is appropriate since the assertion logic is now encapsulated in the utility function.

frontend/__tests__/unit/pages/UserDetails.test.tsx (1)

91-92: Excellent improvement to test semantic accuracy!

The switch from getByText('Test User') to getByRole('heading', { name: 'Test User' }) is a significant improvement that:

  • Uses semantic queries that better represent user interaction
  • Provides better accessibility testing coverage
  • Makes tests more specific and reliable by targeting the actual heading element

This change aligns with React Testing Library best practices.

Also applies to: 271-271, 331-332

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

6-6: PageLayout integration looks good!

The wrapping of SearchPageLayout within PageLayout is consistent with the broader refactoring to standardize page layouts and breadcrumb handling across the application.

Also applies to: 55-71

frontend/src/app/members/[memberKey]/page.tsx (1)

25-25: Well-implemented PageLayout integration with proper breadcrumb context!

The implementation correctly:

  • Wraps the DetailsCard in PageLayout for consistent page structure
  • Provides meaningful breadcrumb context using user?.name || user?.login
  • Maintains the existing component structure and props

The fallback from name to login ensures breadcrumbs always have a meaningful title.

Also applies to: 194-209

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

31-31: Clean PageLayout integration for consistent page structure!

The implementation correctly wraps the entire About page content in PageLayout without passing explicit breadcrumb items, allowing automatic breadcrumb generation based on the pathname. This is appropriate for this static page and maintains consistency with the broader layout refactoring.

Also applies to: 102-243

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

4-4: Excellent refactoring to use shared test utilities!

The replacement of inline test logic with assertContributorToggle from the shared assertions module:

  • Reduces code duplication across test files
  • Improves test maintainability
  • Follows DRY principles
  • The eslint-disable comment is appropriate since the actual assertions are within the shared utility

This aligns with the broader effort to standardize test patterns across the codebase.

Also applies to: 211-216

frontend/src/app/snapshots/[id]/page.tsx (2)

19-19: Good addition of PageLayout import.

The import aligns with the new standardized page layout pattern being applied across the application.


113-196: Breadcrumbs Auto-Generation Confirmed for Snapshot Pages

I’ve inspected the PageLayout implementation and confirmed that, in the absence of a breadcrumbItems prop (as on snapshots/[id]), it falls back to auto‐generating breadcrumbs from the URL segments—e.g.
• “Snapshots” → /snapshots
{id}/snapshots/{id}

If you’d like to display the snapshot’s title instead of the numeric id, simply pass a breadcrumbItems array to PageLayout with the desired titles.

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

4-4: Good use of shared assertion utilities.

Importing assertHeadingsAndTexts improves test consistency and reduces code duplication across test files.


66-66: Excellent test refactoring with shared assertion helper.

The replacement of multiple individual expect calls with assertHeadingsAndTexts improves maintainability and consistency. The ESLint disable comment is appropriate since assertions are now handled by the helper function.

Also applies to: 75-78


147-148: Improved semantic accuracy with role-based query.

Using getByRole('heading', { name: 'New Snapshot' }) is more semantically accurate than getByText for heading elements.

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

3-4: Clean import optimization with shared assertion utilities.

Removing fireEvent and adding shared assertion helpers assertContributorToggle and assertRepoDetails improves test maintainability and consistency across the test suite.


72-72: Excellent consolidation of repository detail assertions.

The assertRepoDetails helper significantly reduces boilerplate code while maintaining test coverage. The ESLint disable comment is appropriate since assertions are now in the helper function.

Also applies to: 81-87


110-110: Great simplification of contributor toggle testing.

Replacing complex waitFor, fireEvent, and multiple expect calls with assertContributorToggle makes the test much more readable and maintainable.

Also applies to: 113-113

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

3-4: Consistent import optimization across test files.

The removal of fireEvent and addition of shared assertion helpers follows the same excellent pattern applied to other test files in this PR.


63-63: Excellent use of shared repository detail assertions.

The assertRepoDetails helper consolidates multiple assertions into a reusable utility, improving test maintainability and consistency with other repository-related tests.

Also applies to: 72-80


103-103: Great consistency in contributor toggle testing.

Using assertContributorToggle maintains consistency with the ProjectDetails test refactoring and improves test readability.

Also applies to: 106-106

frontend/__tests__/unit/components/BreadCrumbs.test.tsx (4)

5-5: Excellent helper function for improved test clarity.

The renderBreadCrumbs helper function cleanly abstracts the component rendering with props, making tests more readable and maintainable.


7-11: Well-structured test data for comprehensive coverage.

The sampleItems constant provides realistic breadcrumb data that covers multiple hierarchy levels, supporting thorough testing scenarios.


14-43: Excellent architectural alignment with prop-driven design.

The refactored tests properly reflect the component's new design where breadcrumb items are passed as props instead of being derived from the URL. This improves testability by removing dependency on Next.js routing internals and aligns with the broader PageLayout integration pattern.


45-59: Comprehensive styling verification.

The hover styles test ensures the breadcrumb links maintain proper interactive styling, which is important for user experience.

frontend/src/app/organizations/[organizationKey]/repositories/[repositoryKey]/page.tsx (7)

11-11: LGTM: Lodash import for safe property access.

The lodash import is appropriately used for safe property access in breadcrumb construction.


16-16: LGTM: Clean integration of new dependencies.

The imports for organization metadata query and PageLayout component are properly added and used consistently throughout the component.

Also applies to: 22-22


30-30: LGTM: Appropriate state management.

The new state variable for organization metadata follows the existing pattern and is properly typed.


34-36: LGTM: Consistent GraphQL query pattern.

The organization metadata query follows the same pattern as the existing repository query with proper variable passing.


45-47: LGTM: Proper state updates and dependency management.

The useEffect correctly handles the new organization data state and includes it in the dependency array to prevent stale closures.

Also applies to: 52-52


123-125: LGTM: Safe property access with appropriate fallbacks.

The use of _.get() with fallbacks to the key values ensures robust breadcrumb display even when metadata is missing.


128-142: LGTM: Clean component wrapping with PageLayout.

The DetailsCard is properly wrapped within PageLayout, maintaining all existing props while adding breadcrumb functionality.

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

17-30: LGTM: Robust automatic breadcrumb generation.

The function properly handles path segments with good edge case handling using lodash utilities.


56-61: LGTM: Clean and simple component render.

The render logic is straightforward and appropriate for a layout component.

frontend/__tests__/testUtils/sharedAssertions.ts (2)

3-30: LGTM: Well-structured repository details assertion.

The function uses good TypeScript typing with optional parameters and follows React Testing Library best practices with waitFor and semantic queries.


32-49: LGTM: Flexible heading and text assertion utility.

The function correctly handles optional heading checks and iterates through text assertions efficiently.

frontend/src/components/BreadCrumbs.tsx (5)

9-16: LGTM: Well-defined TypeScript interfaces.

The interfaces clearly define the expected props structure and are properly exported for reuse.


18-19: LGTM: Proper props destructuring and early return.

The component correctly handles empty breadcrumb arrays with an early return.


22-22: LGTM: Improved styling with dark mode support.

The addition of dark background color enhances the visual consistency.


40-43: LGTM: Consistent hardcoded Home link.

The Home link provides a good baseline for all breadcrumb trails and maintains accessibility with proper aria attributes.


45-63: LGTM: Clean breadcrumb item rendering.

The mapping logic properly handles the last item state and generates appropriate keys. The conditional rendering for links vs. spans is correct.

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.

@codic-yeeshu could you run make test-frontend and fix those unit tests that are failing before we start the review?

@sonarqubecloud
Copy link

@arkid15r
Copy link
Collaborator

Closing as abandoned.

@arkid15r arkid15r closed this Jul 20, 2025
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.

Improve breadcrumbs component

3 participants