Skip to content

855 update the top nav for check and submit#888

Merged
GeorgeGoodall-GovUk merged 19 commits into
mainfrom
855-update-the-top-nav-for-check-and-submit
Feb 20, 2025
Merged

855 update the top nav for check and submit#888
GeorgeGoodall-GovUk merged 19 commits into
mainfrom
855-update-the-top-nav-for-check-and-submit

Conversation

@GeorgeGoodall-GovUk
Copy link
Copy Markdown
Contributor

@GeorgeGoodall-GovUk GeorgeGoodall-GovUk commented Feb 11, 2025

Preview Link

https://submit-pr-888.herokuapp.com/

What type of PR is this? (check all applicable)

  • Refactor

Description

Removes nav links from check and submit

Also:

  • makes it easier to set nav links on a page by page basis
  • standardise nunjucks format to first do imports, then set constant vars, then extend templates
  • added missing class to link

Related Tickets & Documents

QA Instructions, Screenshots, Recordings

Before

image

After

image

Added/updated tests?

  • No

QA sign off

  • Code has been checked and approved
  • Design has been checked and approved
  • Product and business logic has been checked and proved

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • Introduces a dynamic navigation system with enhanced breadcrumb displays, offering a more flexible and user-friendly journey across the site.
  • Style
    • Refined link styling and consistent layout adjustments deliver improved visual clarity and readability.
  • Chores
    • Simplified service texts and page titles streamline messaging, while configuration updates enhance clarity.
  • Tests
    • Automated tests have been updated to validate the revised service titles and navigation changes.
    • New test suite added to ensure the functionality of the navigation links.

@GeorgeGoodall-GovUk GeorgeGoodall-GovUk linked an issue Feb 11, 2025 that may be closed by this pull request
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 11, 2025

Walkthrough

This pull request applies a series of updates across multiple view templates, test suites, configuration files, and filters. The changes primarily introduce a dynamic navigation system using a new variable navigationItems and a corresponding helper function (getNavigationLinks), replacing hardcoded navigation arrays. Several templates have also undergone reordering of layout extension positions and formatting adjustments. In addition, service type values and descriptive texts have been updated (e.g. from "Submit and update your planning data" to "Submit your planning data"). Finally, related test suites have been modified to reflect these updated titles and parameter values.

Changes

File(s) Change Summary
src/views/check/results/results.html Updated anchor tag to include the class govuk-link.
src/views/components/app-header.html, src/views/organisations/dataset-overview.html, src/views/organisations/datasetTaskList.html, src/views/organisations/dataview.html, src/views/organisations/find.html, src/views/organisations/get-started.html, src/views/organisations/http-error.html, src/views/organisations/issueDetails.html, src/views/organisations/issueTable.html, src/views/organisations/overview.html, src/views/accessibility.html, src/views/cookies.html, src/views/error.html, src/views/landing.html, src/views/privacy-notice.html Introduced dynamic navigation by adding navigationItems using getNavigationLinks, adjusted the order of layout extensions and formatting, and updated serviceType values from 'Submit' or 'Check' to 'Manage' where applicable.
config/default.yaml Modified serviceNames descriptions for the submit and check services.
Test files under test/unit/ (e.g. confirmationPage.test.js, findPage.test.js, cookie banner tests, choose-datasetPage.test.js, dataset-details.test.js, lpa-detailsPage.test.js) Updated page title parameters to remove the phrase "and update your planning data" and included explicit serviceType parameters in relevant tests.
src/filters/filters.js, src/filters/getNavigationLinks.js Added a new getNavigationLinks function (with associated navigationLinks definitions) and integrated it as a Nunjucks filter.

Sequence Diagram(s)

sequenceDiagram
    participant U as User Request
    participant T as Template Engine
    participant G as getNavigationLinks Filter
    participant N as Navigation Links Repository

    U->>T: Request view rendering
    T->>G: Call getNavigationLinks(currentUrl, linkKeys)
    G->>N: Retrieve predefined navigation links
    N-->>G: Return link details
    G-->>T: Return navigationItems array
    T-->>U: Render view with dynamic navigation
Loading

Suggested labels

enhancement

Suggested reviewers

  • rosado

Poem

Hopping through code with glee,
I found fresh links set dynamically.
Navigation items dance on screen,
Service types now crisp and clean.
With a twitch of my whiskers, I cheer—
Great changes abound, my dear! 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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. (Beta)
  • @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.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 11, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 65.99% 5036 / 7631
🔵 Statements 65.99% 5036 / 7631
🔵 Functions 64.95% 228 / 351
🔵 Branches 81.19% 704 / 867
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/filters/filters.js 100% 100% 100% 100%
src/filters/getNavigationLinks.js 100% 100% 100% 100%
Generated in workflow #833 for commit 461b4cf by the Vitest Coverage Report Action

Copy link
Copy Markdown
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

🔭 Outside diff range comments (1)
src/views/organisations/issueTable.html (1)

141-141: ⚠️ Potential issue

Remove stray character.

There's a stray 'p' character that could cause template rendering issues.

-    } %}p
+    } %}
🧹 Nitpick comments (4)
src/views/organisations/dataview.html (1)

6-17: Consider simplifying the active state logic.

The current implementation can be made more concise by removing redundant checks:

-    active: currentPath and currentPath.startsWith('/organisations')
+    active: currentPath?.startsWith('/organisations')
src/views/organisations/datasetTaskList.html (1)

5-16: Consider extracting navigation items to a shared template.

The navigation structure is duplicated across multiple templates. Consider moving it to a shared include file to improve maintainability.

Example implementation:

{# _shared-navigation.html #}
{% set navigationItems = [
  {
    href: "/organisations",
    text: "Find your organisation",
    active: currentPath?.startsWith('/organisations')
  },
  {
    href: "/guidance",
    text: "Guidance",
    active: currentPath?.startsWith('/guidance')
  }
]%}

Then in each template:

{% include "_shared-navigation.html" %}
src/views/organisations/issueDetails.html (1)

10-10: Consider using a more specific path check.

The current check startsWith('/organisations') might incorrectly set the active state for unrelated paths that happen to start with '/organisations/'. Consider using a more precise check.

-    active: currentPath and currentPath.startsWith('/organisations')
+    active: currentPath and (currentPath === '/organisations' || currentPath.startsWith('/organisations/'))
src/views/organisations/dataset-overview.html (1)

53-53: Consider moving URL styling to CSS.

The URL styling is currently defined inline. Consider moving it to a CSS class for better maintainability.

-{% set urlStyle = 'text-overflow: ellipsis; overflow: hidden; white-space: nowrap; width: 400px; display: block;' %}
+{% set urlClass = 'app-url-truncate' %}

Add this to your CSS file:

.app-url-truncate {
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  width: 400px;
  display: block;
}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 963de5a and af8e405.

📒 Files selected for processing (11)
  • src/views/check/results/results.html (1 hunks)
  • src/views/components/app-header.html (1 hunks)
  • src/views/organisations/dataset-overview.html (2 hunks)
  • src/views/organisations/datasetTaskList.html (1 hunks)
  • src/views/organisations/dataview.html (1 hunks)
  • src/views/organisations/find.html (1 hunks)
  • src/views/organisations/get-started.html (1 hunks)
  • src/views/organisations/http-error.html (1 hunks)
  • src/views/organisations/issueDetails.html (1 hunks)
  • src/views/organisations/issueTable.html (1 hunks)
  • src/views/organisations/overview.html (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/views/check/results/results.html
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: run-tests / test
🔇 Additional comments (8)
src/views/components/app-header.html (1)

9-14: Well-structured implementation of configurable navigation!

The change from hardcoded navigation to a dynamic navigationItems variable with a sensible default makes the header component more flexible and reusable.

src/views/organisations/find.html (1)

3-14: Same navigation structure as other templates.

This implements the same navigation pattern discussed in previous files.

src/views/organisations/http-error.html (1)

4-15: Consistent implementation of navigation structure.

The navigation implementation maintains consistency with other templates, which is excellent for user experience.

src/views/organisations/issueDetails.html (1)

6-17: LGTM! Navigation implementation follows the standard pattern.

The navigation items are correctly structured with proper active state logic.

src/views/organisations/issueTable.html (1)

8-19: LGTM! Navigation implementation is consistent.

The navigation structure matches the standard pattern used across other templates.

src/views/organisations/overview.html (1)

6-17: LGTM! Navigation implementation aligns with the standard pattern.

The navigation structure and active state logic are consistent with other templates.

src/views/organisations/dataset-overview.html (1)

27-38: LGTM! Navigation implementation follows the standard pattern.

The navigation structure and active state logic are consistent with other templates.

src/views/organisations/get-started.html (1)

3-14: LGTM! Navigation implementation matches the standard pattern.

The navigation structure and active state logic are consistent with other templates.

Copy link
Copy Markdown
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

🧹 Nitpick comments (6)
src/views/landing.html (1)

6-17: Add null check for currentPath variable.

The currentPath checks could be more defensive. Consider using the optional chaining operator to handle cases where currentPath might be undefined.

-    active: currentPath and currentPath.startsWith('/organisations')
+    active: currentPath?.startsWith('/organisations') ?? false
config/default.yaml (1)

20-21: Plan to remove the deprecated serviceName property.

The comment indicates that serviceName is deprecated in favour of serviceNames. Consider creating a follow-up task to remove this property.

src/views/cookies.html (1)

8-19: LGTM! Navigation implementation is consistent with other templates.

The navigationItems array follows the established pattern, maintaining consistency across the application.

Consider extracting these common navigation items into a shared template or macro to follow the DRY principle. This would make future updates easier and reduce the risk of inconsistencies.

+{# shared/navigation.njk #}
+{% macro commonNavigation(currentPath) %}
+  {% set navigationItems = [
+    {
+      href: "/organisations",
+      text: "Find your organisation",
+      active: currentPath and currentPath.startsWith('/organisations')
+    },
+    {
+      href: "/guidance",
+      text: "Guidance",
+      active: currentPath and currentPath.startsWith('/guidance')
+    }
+  ] %}
+  {{ navigationItems }}
+{% endmacro %}

Then in each template:

-{% set navigationItems = [
-  {
-    href: "/organisations",
-    text: "Find your organisation",
-    active: currentPath and currentPath.startsWith('/organisations')
-  },
-  {
-    href: "/guidance",
-    text: "Guidance",
-    active: currentPath and currentPath.startsWith('/guidance')
-  }
-]%}
+{% from "shared/navigation.njk" import commonNavigation %}
+{% set navigationItems = commonNavigation(currentPath) %}
src/views/error.html (3)

1-16: Consider moving template extension before variable declarations

For better template inheritance and clarity, it's typically recommended to place the extends statement at the beginning of the template, before any variable declarations or imports.

+{% extends "layouts/main.html" %}
 {% from "govuk/components/button/macro.njk" import govukButton %}

 {% set pageName = "Error" %}
 {% set navigationItems = [
   ...
 ]%}
-{% extends "layouts/main.html" %}

18-23: Consider enhancing error presentation

The current error display could be improved to be more user-friendly and follow GDS error pattern guidelines. Consider adding:

  • A clear error summary
  • More descriptive error messages for common scenarios
  • Stack traces only in non-production environments
-    <h1 class="govuk-heading-xl">Error</h1>
+    <h1 class="govuk-heading-xl">Sorry, there is a problem with the service</h1>

-    <h2>{{err.code + " - " if err.code}}{{err.message}}</h2>
+    <p class="govuk-body">{{err.message}}</p>
+    <p class="govuk-body">Try again later.</p>

     {%if err.stack %}
+        {% if environment !== "production" %}
         <pre>{{err.stack | safe}}</pre>
+        {% endif %}
     {% endif %}

25-28: Consider adding error tracking ID

For better support and debugging, consider adding a unique error reference ID that users can quote when reporting issues.

     {{ govukButton({
         text: "Start again",
         href: "/"
     }) }}
+    <p class="govuk-body-s">
+        If you need to contact support, please quote error reference: {{errorId}}
+    </p>
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between af8e405 and 45c5368.

📒 Files selected for processing (6)
  • config/default.yaml (1 hunks)
  • src/views/accessibility.html (1 hunks)
  • src/views/cookies.html (1 hunks)
  • src/views/error.html (1 hunks)
  • src/views/landing.html (1 hunks)
  • src/views/privacy-notice.html (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: run-tests / test
🔇 Additional comments (5)
src/views/landing.html (1)

6-17: Well-structured navigation configuration.

The navigation implementation:

  • Follows GDS patterns
  • Makes navigation configurable per page as intended
  • Clearly separates concerns between structure and presentation
config/default.yaml (1)

24-25: LGTM! Service names are now more concise and specific.

The updated service names better reflect their distinct purposes, improving clarity for users.

src/views/accessibility.html (1)

4-15: LGTM! Navigation implementation is clean and consistent.

The navigationItems array provides a clear structure for navigation links with proper active state handling.

src/views/privacy-notice.html (2)

151-151: Verify the privacy notice update date.

The privacy notice shows a future update date of 21 June 2024. Please confirm if this is intentional or if it should reflect a current or past date.


4-15: Verify the currentPath variable availability.

The navigation structure looks good and aligns with the configurable navigation objectives. However, please ensure that the currentPath variable is properly defined and passed to this template.

❌ Verification inconclusive

🏁 Script executed:

#!/bin/bash
# Search for currentPath variable definition
rg -A 5 "currentPath.*=" src/

Length of output: 1362


Confirm currentPath Provisioning

Our investigation shows that the currentPath variable is not defined within the src/views/privacy-notice.html file itself. However, similar usage in files like src/views/components/sub-navigation.html suggests that currentPath is expected to be provided through the global or contextual parameters (e.g. by the controller or layout).

Please ensure that the context passed to this and related templates reliably includes currentPath.

Comment thread src/views/error.html Outdated
Copy link
Copy Markdown
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

🔭 Outside diff range comments (2)
test/unit/javascript/components/cookie-banner.test.js (1)

60-69: ⚠️ Potential issue

Remove duplicate test case.

This test case is a duplicate of the one at lines 27-36. Both verify the same component properties. Consider removing this redundant test to maintain a cleaner test suite.

src/views/submit/check-answers.html (1)

60-60: 🛠️ Refactor suggestion

Standardise URL prefixes across change links.

The change links use inconsistent URL prefixes:

  • /submit/lpa-details
  • /submit/dataset-details
  • /submit-endpoint/dataset-details

This inconsistency could lead to confusion and maintenance issues.

Standardise all URLs to use the same prefix, preferably /submit/:

-            href: "/submit-endpoint/dataset-details",
+            href: "/submit/dataset-details",

Also applies to: 94-94, 111-111, 128-128

🧹 Nitpick comments (2)
test/unit/views/components/cookie-banner.test.js (1)

8-8: Standardise service type casing.

The service type is set to lowercase 'manage' here but uppercase 'Manage' in the JavaScript test file. Consider standardising the casing across all files.

test/unit/javascript/components/cookie-banner.test.js (1)

10-10: Standardise service type casing.

The service type is set to uppercase 'Manage' here but lowercase 'manage' in the view test file. Consider standardising the casing across all files.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8ba01d3 and 773d79b.

📒 Files selected for processing (11)
  • src/views/cookies.html (1 hunks)
  • src/views/submit/check-answers.html (1 hunks)
  • test/unit/check/confirmationPage.test.js (1 hunks)
  • test/unit/endpointSubmissionForm/confirmationPage.test.js (1 hunks)
  • test/unit/findPage.test.js (1 hunks)
  • test/unit/javascript/components/cookie-banner.test.js (1 hunks)
  • test/unit/views/components/cookie-banner.test.js (1 hunks)
  • test/unit/views/submit/check-answers.test.js (1 hunks)
  • test/unit/views/submit/choose-datasetPage.test.js (1 hunks)
  • test/unit/views/submit/dataset-details.test.js (1 hunks)
  • test/unit/views/submit/lpa-detailsPage.test.js (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • test/unit/views/submit/dataset-details.test.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/views/cookies.html
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: run-tests / test
🔇 Additional comments (8)
test/unit/views/components/cookie-banner.test.js (1)

8-8: Verify heading text matches service type.

The cookie banner heading text mentions "Submit" despite the service type being set to "manage". Please verify if this is the intended behaviour.

Also applies to: 18-18

test/unit/check/confirmationPage.test.js (1)

19-19: LGTM! Title update aligns with service context changes.

The removal of "and update" from the page title is consistent with the broader changes being made across the service.

test/unit/endpointSubmissionForm/confirmationPage.test.js (1)

19-19: LGTM! Title update maintains consistency.

The change aligns with the updated service context and maintains consistency with other confirmation pages.

test/unit/views/submit/choose-datasetPage.test.js (1)

15-15: LGTM! Title update follows service-wide changes.

The page title update maintains consistency with the service's new context whilst preserving all test functionality.

test/unit/views/submit/lpa-detailsPage.test.js (1)

15-15: LGTM! Title update completes service-wide changes.

The page title update aligns with the service's new context. Let's verify the consistency of these changes across the codebase.

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Description: Verify that all page titles have been updated consistently

# Search for any remaining instances of "Submit and update your planning data"
rg -l "Submit and update your planning data"

# Search for the new format to confirm widespread adoption
rg -l "Submit your planning data"

Length of output: 843


The submission page title update is consistent with other submission pages.

The new title "Submit your planning data" appears across all submission-related tests (including lpa-detailsPage.test.js), confirming the update. The old string showing "Submit and update your planning data" remains in non-submission areas, which appears intentional.

test/unit/findPage.test.js (1)

22-22: LGTM! Service name update is consistent.

The change to use config.serviceNames.manage aligns with the standardisation effort across the application.

test/unit/views/submit/check-answers.test.js (1)

24-24: LGTM! Service name simplification is consistent.

The simplified page title aligns with the standardisation effort across the application.

src/views/submit/check-answers.html (1)

8-8: LGTM! Service type update better reflects page purpose.

The change from 'Check' to 'Submit' more accurately represents the page's functionality.

rosado
rosado previously requested changes Feb 13, 2025
Comment thread src/views/accessibility.html Outdated
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Copy Markdown
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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 177b86d and f98c60b.

📒 Files selected for processing (17)
  • src/filters/filters.js (2 hunks)
  • src/filters/getNavigationLinks.js (1 hunks)
  • src/views/accessibility.html (1 hunks)
  • src/views/cookies.html (1 hunks)
  • src/views/error.html (1 hunks)
  • src/views/includes/navigation.html (1 hunks)
  • src/views/landing.html (1 hunks)
  • src/views/organisations/dataset-overview.html (2 hunks)
  • src/views/organisations/datasetTaskList.html (1 hunks)
  • src/views/organisations/dataview.html (1 hunks)
  • src/views/organisations/find.html (1 hunks)
  • src/views/organisations/get-started.html (1 hunks)
  • src/views/organisations/http-error.html (1 hunks)
  • src/views/organisations/issueDetails.html (1 hunks)
  • src/views/organisations/issueTable.html (1 hunks)
  • src/views/organisations/overview.html (1 hunks)
  • src/views/privacy-notice.html (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (13)
  • src/views/error.html
  • src/views/accessibility.html
  • src/views/cookies.html
  • src/views/organisations/issueDetails.html
  • src/views/organisations/dataview.html
  • src/views/organisations/overview.html
  • src/views/privacy-notice.html
  • src/views/organisations/http-error.html
  • src/views/organisations/datasetTaskList.html
  • src/views/organisations/dataset-overview.html
  • src/views/organisations/issueTable.html
  • src/views/organisations/get-started.html
  • src/views/organisations/find.html
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: run-tests / test
🔇 Additional comments (2)
src/filters/getNavigationLinks.js (1)

19-34: LGTM! Well-structured navigation link generation.

The function is well-implemented with proper error handling and filtering of undefined links. The JSDoc documentation clearly describes the parameters and return type.

src/filters/filters.js (1)

14-14: LGTM! Clean integration of navigation links filter.

The import and filter registration are properly implemented, following the existing patterns in the file.

Also applies to: 52-52

Comment thread src/filters/getNavigationLinks.js Outdated
Comment thread src/views/includes/navigation.html Outdated
Comment thread src/views/landing.html Outdated
Comment thread src/views/accessibility.html Outdated
Comment thread src/views/error.html Outdated
Comment thread src/views/components/app-header.html
This reverts commit de7cf1c.
Copy link
Copy Markdown
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

🧹 Nitpick comments (1)
test/unit/filters/getNavigationLinks.test.js (1)

5-72: LGTM! Comprehensive test coverage for main scenarios.

The test cases are well-structured and cover the primary use cases effectively.

Consider these improvements:

  1. Extract common test data to reduce duplication:
const DEFAULT_LINKS = ['organisations', 'guidance']
const DEFAULT_NAVIGATION = [
  {
    href: '/organisations',
    text: 'Find your organisation',
    active: false
  },
  {
    href: '/guidance',
    text: 'Guidance',
    active: false
  }
]
  1. Add test cases for edge cases:
it('handles URLs with query parameters', () => {
  const result = getNavigationLinks('/guidance?param=value', ['organisations', 'guidance'])
  expect(result[1].active).toBe(true)
})

it('handles URLs with trailing slashes', () => {
  const result = getNavigationLinks('/guidance/', ['organisations', 'guidance'])
  expect(result[1].active).toBe(true)
})

it('handles malformed currentUrl parameter', () => {
  expect(() => getNavigationLinks(null, ['organisations'])).not.toThrow()
  expect(() => getNavigationLinks(undefined, ['organisations'])).not.toThrow()
})
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f5b2267 and 2d24f19.

📒 Files selected for processing (16)
  • src/filters/getNavigationLinks.js (1 hunks)
  • src/views/accessibility.html (1 hunks)
  • src/views/cookies.html (1 hunks)
  • src/views/error.html (1 hunks)
  • src/views/landing.html (1 hunks)
  • src/views/organisations/dataset-overview.html (2 hunks)
  • src/views/organisations/datasetTaskList.html (1 hunks)
  • src/views/organisations/dataview.html (1 hunks)
  • src/views/organisations/find.html (1 hunks)
  • src/views/organisations/get-started.html (1 hunks)
  • src/views/organisations/http-error.html (1 hunks)
  • src/views/organisations/issueDetails.html (1 hunks)
  • src/views/organisations/issueTable.html (1 hunks)
  • src/views/organisations/overview.html (1 hunks)
  • src/views/privacy-notice.html (1 hunks)
  • test/unit/filters/getNavigationLinks.test.js (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (15)
  • src/views/cookies.html
  • src/views/landing.html
  • src/views/organisations/issueDetails.html
  • src/views/organisations/http-error.html
  • src/views/error.html
  • src/views/privacy-notice.html
  • src/views/organisations/find.html
  • src/views/organisations/datasetTaskList.html
  • src/views/organisations/dataview.html
  • src/views/organisations/issueTable.html
  • src/views/organisations/overview.html
  • src/views/organisations/get-started.html
  • src/views/accessibility.html
  • src/views/organisations/dataset-overview.html
  • src/filters/getNavigationLinks.js
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: run-tests / test
🔇 Additional comments (1)
test/unit/filters/getNavigationLinks.test.js (1)

1-4: LGTM! Well-structured test setup.

The imports and test suite setup follow best practices with clear, focused imports and a descriptive test suite name.

@eveleighoj eveleighoj temporarily deployed to submit-pr-888 February 20, 2025 14:48 Inactive
@GeorgeGoodall-GovUk GeorgeGoodall-GovUk merged commit 0739db5 into main Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update the top nav for check and submit

5 participants