Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(driving-license): digital license, no pickup #15881

Merged
merged 3 commits into from
Sep 4, 2024

Conversation

albinagu
Copy link
Member

@albinagu albinagu commented Sep 4, 2024

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • New Features

    • Introduced a digital license information section to enhance the driving license application form.
    • Updated messaging to provide clearer information regarding digital licenses.
  • Bug Fixes

    • Corrected the ID of a section from 'confim' to 'confirm' for accurate identification.
  • Refactor

    • Removed the JurisdictionApi from various components, streamlining the application's data dependencies.
  • Documentation

    • Updated message definitions to reflect changes in the driving license application process.

@albinagu albinagu requested a review from a team as a code owner September 4, 2024 12:09
Copy link
Contributor

coderabbitai bot commented Sep 4, 2024

Walkthrough

The changes involve the removal of the JurisdictionApi from multiple files within the driving license application module, indicating a restructuring of dependencies. Additionally, the form structure has been updated to exclude the subSectionDelivery and include a new section for digital license information. Several message definitions have been modified to reflect these updates, with new entries added for digital license messaging while some older entries have been removed.

Changes

Files Change Summary
libs/application/templates/driving-license/src/dataProviders/index.ts, libs/application/templates/driving-license/src/forms/prerequisites/sectionExternalData.ts, libs/application/templates/driving-license/src/lib/drivingLicenseTemplate.ts Removed JurisdictionApi from exports and imports, indicating a shift in dependencies.
libs/application/templates/driving-license/src/forms/draft/draft.ts Removed subSectionDelivery from the form structure, altering the data captured by the form.
libs/application/templates/driving-license/src/forms/prerequisites/getForm.ts Added new import for sectionDigitalLicenseInfo, enhancing form functionality with digital license information.
libs/application/templates/driving-license/src/forms/prerequisites/sectionDigitalLicenseInfo.ts Introduced a new file defining a section for digital license information with dynamic alert messages based on user input.
libs/application/templates/driving-license/src/lib/messages.ts Modified message definitions by removing outdated entries and adding new entries related to digital license information.

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 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.

@albinagu albinagu added the automerge Merge this PR as soon as all checks pass label Sep 4, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (4)
libs/application/templates/driving-license/src/dataProviders/index.ts (1)

Impact of Removing JurisdictionApi Export

The JurisdictionApi is still being used in several parts of the codebase. Its removal from the exports in index.ts could lead to issues in the following files, which need to be refactored to handle this change:

  • libs/application/types/src/lib/template-api/shared-api/shared-api-definitions/driving-license.ts
  • libs/application/templates/driving-license-duplicate/src/forms/applicationSections/sectionDataProviders.ts
  • libs/application/templates/driving-license-duplicate/src/lib/drivingLicenseDuplicateTemplate.ts

Please ensure these files are updated to either import JurisdictionApi from its new location or adjust their logic accordingly.

Analysis chain

Line range hint 1-20: Verify the impact of removing JurisdictionApi export.

The JurisdictionApi has been removed from the list of exports. This change could impact any components or services that previously relied on the JurisdictionApi.

Run the following script to verify the usage of JurisdictionApi:

If the tests yield any results, it indicates that the removal of JurisdictionApi export has impacted the codebase. In such cases, the affected code must be refactored to remove the dependency on JurisdictionApi.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `JurisdictionApi` in the codebase.

# Test 1: Search for the import of `JurisdictionApi`. 
# Expect: No occurrences of importing `JurisdictionApi` from this file.
rg --type typescript -g '!node_modules' -g '!dist' $'from \'@island.is/application/templates/driving-license/src/dataProviders\'' -A 5 | rg $'JurisdictionApi'

# Test 2: Search for the usage of `JurisdictionApi`. 
# Expect: No occurrences of using `JurisdictionApi`.
rg --type typescript -g '!node_modules' -g '!dist' $'JurisdictionApi'

Length of output: 299


Script:

#!/bin/bash
# Description: Verify the usage of `JurisdictionApi` in the codebase.

# Test 1: Search for the import of `JurisdictionApi`. 
# Expect: No occurrences of importing `JurisdictionApi` from this file.
rg --glob '*.ts' -g '!node_modules' -g '!dist' $'from \'@island.is/application/templates/driving-license/src/dataProviders\'' -A 5 | rg $'JurisdictionApi'

# Test 2: Search for the usage of `JurisdictionApi`. 
# Expect: No occurrences of using `JurisdictionApi`.
rg --glob '*.ts' -g '!node_modules' -g '!dist' $'JurisdictionApi'

Length of output: 879

libs/application/templates/driving-license/src/lib/drivingLicenseTemplate.ts (2)

Line range hint 1-1: Confirm adherence to the specified guidelines for files matching the pattern libs/**/*.

The provided code segment adheres to the guideline of using TypeScript for defining props and exporting types. However, there are no components or hooks present in this file, so their reusability across different NextJS apps cannot be determined.

Please provide more information about the following:

  1. Are there any components or hooks in this library that are designed to be reusable across different NextJS apps? If so, how is their reusability ensured?
  2. How are effective tree-shaking and bundling practices implemented in this library to optimize the application's performance?

Verify the impact of removing JurisdictionApi across the codebase.

The JurisdictionApi is still referenced in several files, indicating that its removal from drivingLicenseTemplate.ts might not be complete or consistent. Please verify the impact of this change and ensure that any dependencies on JurisdictionApi are addressed to maintain the application's functionality.

  • libs/application/types/src/lib/template-api/shared-api/shared-api-definitions/driving-license.ts
  • libs/application/templates/driving-license-duplicate/src/forms/applicationSections/sectionDataProviders.ts
  • libs/application/templates/driving-license-duplicate/src/lib/drivingLicenseDuplicateTemplate.ts
Analysis chain

Line range hint 1-1: Verify the impact of removing JurisdictionApi on the application's functionality.

The removal of JurisdictionApi from the import statements and the template declaration suggests a shift in dependencies. It is important to ensure that this change does not break any existing functionality and that any necessary adjustments have been made in other parts of the application that previously relied on this API.

Please provide more context on the reasoning behind removing JurisdictionApi and confirm that the application's functionality remains intact after this change. Additionally, run the following script to verify that there are no remaining references to JurisdictionApi in the codebase:

Also applies to: 50-50

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that there are no remaining references to `JurisdictionApi` in the codebase.

# Test: Search for references to `JurisdictionApi`. Expect: No occurrences found.
rg --type typescript 'JurisdictionApi'

Length of output: 73


Script:

#!/bin/bash
# Description: Verify that there are no remaining references to `JurisdictionApi` in the codebase.

# Test: Search for references to `JurisdictionApi` in all files. Expect: No occurrences found.
rg 'JurisdictionApi'

Length of output: 678

libs/application/templates/driving-license/src/lib/messages.ts (1)

430-439: Replace the placeholder text in the description.

The description for digitalLicenseInfoDescription uses a placeholder text:

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Please replace the placeholder text with an actual description that provides relevant information about the digital driving license.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0fa0872 and e6f55e3.

Files selected for processing (7)
  • libs/application/templates/driving-license/src/dataProviders/index.ts (1 hunks)
  • libs/application/templates/driving-license/src/forms/draft/draft.ts (2 hunks)
  • libs/application/templates/driving-license/src/forms/prerequisites/getForm.ts (3 hunks)
  • libs/application/templates/driving-license/src/forms/prerequisites/sectionDigitalLicenseInfo.ts (1 hunks)
  • libs/application/templates/driving-license/src/forms/prerequisites/sectionExternalData.ts (2 hunks)
  • libs/application/templates/driving-license/src/lib/drivingLicenseTemplate.ts (2 hunks)
  • libs/application/templates/driving-license/src/lib/messages.ts (3 hunks)
Files skipped from review due to trivial changes (1)
  • libs/application/templates/driving-license/src/forms/prerequisites/sectionExternalData.ts
Additional context used
Path-based instructions (6)
libs/application/templates/driving-license/src/dataProviders/index.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/driving-license/src/forms/prerequisites/sectionDigitalLicenseInfo.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/driving-license/src/forms/draft/draft.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/driving-license/src/forms/prerequisites/getForm.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/driving-license/src/lib/drivingLicenseTemplate.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/driving-license/src/lib/messages.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
Additional comments not posted (11)
libs/application/templates/driving-license/src/forms/prerequisites/sectionDigitalLicenseInfo.ts (2)

1-27: Great job on structuring the code and utilizing reusable components!

The code follows a modular structure by importing and utilizing reusable components from @island.is/application/core. This promotes code reusability and maintainability across the application.

The sectionDigitalLicenseInfo is built as a self-contained section using the buildSubSection function, which encapsulates the related fields and their configuration. This approach allows for easy reuse of the section across different parts of the application.


18-23: Effective use of conditional rendering for the alert message.

The code effectively utilizes conditional rendering to display different alert messages based on the user's applicationFor answer. This provides a personalized experience for the user and communicates relevant information based on their application type.

The buildAlertMessageField component is used to render the alert message, and the alertType is set to 'info' to visually indicate the nature of the message.

libs/application/templates/driving-license/src/forms/draft/draft.ts (2)

Line range hint 1-47: Removal of subSectionDelivery aligns with the PR objective.

The removal of the subSectionDelivery import and its exclusion from the info section of the form is consistent with the PR objective of addressing issues related to digital driving licenses with no physical pickup.


Line range hint 1-47: Code adheres to the additional instructions for the libs directory.

The code follows the guidelines for the libs directory:

  • The form is built using reusable components from the @island.is/application/core and @island.is/application/types libraries, promoting reusability across different NextJS apps.
  • TypeScript is used to define the type of the exported draft constant.
  • The modular structure of the code allows for effective tree-shaking and bundling practices.
libs/application/templates/driving-license/src/forms/prerequisites/getForm.ts (4)

10-10: LGTM!

The new import statement for sectionDigitalLicenseInfo follows the correct syntax and naming convention.


33-33: LGTM!

The conditional inclusion of sectionDigitalLicenseInfo based on the allowPickLicense flag is consistent with the import statement and allows for flexibility in the form structure.


48-48: LGTM!

The correction of the section ID from 'confim' to 'confirm' fixes a typo and ensures proper identification of the section within the form structure.


Line range hint 1-54: Confirmation: The code adheres to the additional instructions for files in the libs directory.

  • The code exports a reusable function getForm that can be used across different NextJS apps.
  • The code uses TypeScript for defining the props and return type of the exported function.
  • The code does not directly involve tree-shaking or bundling practices, but it follows a modular structure that can facilitate effective tree-shaking and bundling.
libs/application/templates/driving-license/src/lib/messages.ts (3)

430-454: LGTM!

The code changes are approved. The new message definitions related to digital driving licenses look good.


445-449: LGTM!

The code changes are approved. The message definition for the temporary digital driving license alert looks good.


450-454: LGTM!

The code changes are approved. The message definition for the full digital driving license alert looks good.

Copy link

codecov bot commented Sep 4, 2024

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Project coverage is 36.93%. Comparing base (0fa0872) to head (32f74bb).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...c/forms/prerequisites/sectionDigitalLicenseInfo.ts 0.00% 4 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #15881      +/-   ##
==========================================
- Coverage   36.93%   36.93%   -0.01%     
==========================================
  Files        6681     6681              
  Lines      136464   136465       +1     
  Branches    38749    38753       +4     
==========================================
  Hits        50401    50401              
- Misses      86063    86064       +1     
Flag Coverage Δ
api 3.39% <ø> (ø)
application-system-api 41.74% <ø> (ø)
application-template-api-modules 23.65% <ø> (-0.02%) ⬇️
application-templates-accident-notification 19.83% <ø> (ø)
application-ui-shell 21.17% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...mplates/driving-license/src/dataProviders/index.ts 100.00% <ø> (ø)
...templates/driving-license/src/forms/draft/draft.ts 0.00% <ø> (ø)
...driving-license/src/forms/prerequisites/getForm.ts 0.00% <ø> (ø)
...nse/src/forms/prerequisites/sectionExternalData.ts 0.00% <ø> (ø)
.../driving-license/src/lib/drivingLicenseTemplate.ts 9.67% <ø> (ø)
...tion/templates/driving-license/src/lib/messages.ts 100.00% <ø> (ø)
...c/forms/prerequisites/sectionDigitalLicenseInfo.ts 0.00% <0.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0fa0872...32f74bb. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Sep 4, 2024

Datadog Report

All test runs fb93e8b 🔗

5 Total Test Services: 0 Failed, 5 Passed
➡️ Test Sessions change in coverage: 8 no change

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
api 0 0 0 4 0 3.04s 1 no change Link
application-system-api 0 0 0 111 2 3m 32.52s 1 no change Link
application-template-api-modules 0 0 0 109 0 1m 56.29s 1 no change Link
application-templates-driving-license 0 0 0 13 0 17.55s 1 no change Link
application-ui-shell 0 0 0 74 0 37.26s 1 no change Link

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e6f55e3 and 0f60211.

Files selected for processing (2)
  • libs/application/templates/driving-license/src/forms/prerequisites/sectionDigitalLicenseInfo.ts (1 hunks)
  • libs/application/templates/driving-license/src/lib/messages.ts (3 hunks)
Files skipped from review as they are similar to previous changes (2)
  • libs/application/templates/driving-license/src/forms/prerequisites/sectionDigitalLicenseInfo.ts
  • libs/application/templates/driving-license/src/lib/messages.ts

@kodiakhq kodiakhq bot merged commit 9279407 into main Sep 4, 2024
39 checks passed
@kodiakhq kodiakhq bot deleted the driving_license_digital branch September 4, 2024 12:46
albinagu added a commit that referenced this pull request Sep 4, 2024
* fix(driving-license): digital license, no pickup

* chore: nx format:write update dirty files

---------

Co-authored-by: andes-it <builders@andes.is>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
kodiakhq bot added a commit that referenced this pull request Sep 5, 2024
* fix(driving-license): digital license, no pickup

* chore: nx format:write update dirty files

---------

Co-authored-by: andes-it <builders@andes.is>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
kodiakhq bot added a commit that referenced this pull request Sep 10, 2024
* fix(driving-license): digital license, no pickup (#15881)

* fix(driving-license): digital license, no pickup

* chore: nx format:write update dirty files

---------

Co-authored-by: andes-it <builders@andes.is>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* fix(driving-license): adding back JurisdictionApi check (#15938)

* fix(driving-license): adding back JurisdictionApi check

* chore: nx format:write update dirty files

---------

Co-authored-by: andes-it <builders@andes.is>

---------

Co-authored-by: andes-it <builders@andes.is>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
jonnigs pushed a commit that referenced this pull request Sep 12, 2024
* fix(driving-license): digital license, no pickup

* chore: nx format:write update dirty files

---------

Co-authored-by: andes-it <builders@andes.is>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants