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(inheritance-report): done screen and minor cleanup #16667

Merged
merged 4 commits into from
Oct 31, 2024
Merged

Conversation

albinagu
Copy link
Member

@albinagu albinagu commented Oct 31, 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 dynamic messages for the bottom button in the form based on application type.
    • Added new message definitions for user notifications related to accessing personal information.
    • Added a new API for marital status functionality.
  • Bug Fixes

    • Removed unused imports and components to streamline functionality.
  • Documentation

    • Enhanced documentation for parameters in the form conclusion section to clarify their purpose.
  • Chores

    • Removed redundant validation logic from the schema to simplify the codebase.

@albinagu albinagu requested review from a team as code owners October 31, 2024 11:19
Copy link
Contributor

coderabbitai bot commented Oct 31, 2024

Walkthrough

The pull request involves the deletion of the MaritalStatusProvider.ts file, which contained the MaritalStatusApi. This API is replaced with a new export in the index.ts file. Additionally, several components and forms are modified, including updates to the EstateAndVehiclesRepeater, done form, and heirs section, with changes primarily focusing on import statements, structural adjustments, and the addition of new properties and messages. Overall, the changes streamline the codebase while maintaining existing functionalities.

Changes

File Change Summary
libs/application/templates/inheritance-report/src/dataProviders/... Deleted MaritalStatusProvider.ts, removing MaritalStatusApi. Added new export for MaritalStatusApi in index.ts.
libs/application/templates/inheritance-report/src/fields/... Modified EstateAndVehiclesRepeater to remove unused Text import; core logic remains unchanged.
libs/application/templates/inheritance-report/src/forms/done.ts Added bottomButtonMessage property to buildFormConclusionSection function.
libs/application/templates/inheritance-report/src/forms/sections/... Adjusted heirs.ts structure, modified buildDescriptionField, and added new fields. Removed import in inheritance.ts.
libs/application/templates/inheritance-report/src/lib/dataSchema.ts Removed validateDebtBankAccount function, streamlining validation logic.
libs/application/templates/inheritance-report/src/lib/messages.ts Added new messages: bottomButtonMessagePrepaidEFS and bottomButtonMessageEFS.
libs/application/templates/inheritance-report/src/lib/utils/... Removed ESTATE_INHERITANCE import; existing utility functions unchanged.
libs/application/ui-forms/src/lib/formConclusionSection/... Modified import statements and updated Props type for bottomButtonMessage.

Possibly related PRs

Suggested reviewers

  • kksteini
  • Toti91

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 96adaca and 857f514.

📒 Files selected for processing (2)
  • libs/application/templates/inheritance-report/src/dataProviders/index.ts (1 hunks)
  • libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/heirs.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • libs/application/templates/inheritance-report/src/dataProviders/index.ts
  • libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/heirs.ts

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 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 Oct 31, 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: 3

🧹 Outside diff range and nitpick comments (4)
libs/application/templates/inheritance-report/src/dataProviders/index.ts (1)

8-10: Consider adding JSDoc documentation and type safety.

While the implementation is correct, consider these improvements for better maintainability and type safety:

+/** 
+ * API for retrieving marital status information.
+ * @returns Marital status data for the application
+ */
 export const MaritalStatusApi = defineTemplateApi({
-  action: 'maritalStatus',
+  action: 'maritalStatus' as const,
 })
libs/application/ui-forms/src/lib/formConclusionSection/formConclusionSection.ts (1)

Line range hint 33-47: Enhance JSDoc for alertType parameter.

The documentation for alertType could be more descriptive by explaining when to use each alert type.

Consider updating the JSDoc comment to:

- * @param  alertType The type of alert, can be success, warning, error, info. * JUST ADDED *
+ * @param  alertType The visual style of the alert:
+ *                   - 'success': For positive outcomes or completed actions
+ *                   - 'warning': For potential issues requiring attention
+ *                   - 'error': For critical issues or failures
+ *                   - 'info': For general informational messages
libs/application/templates/inheritance-report/src/lib/utils/helpers.ts (1)

Line range hint 1-270: Well-structured utility module with proper TypeScript usage.

The implementation follows best practices for a shared library:

  • Proper TypeScript types and interfaces
  • Pure, reusable functions
  • Named exports supporting tree-shaking
  • Clear separation of concerns

Consider splitting this file into smaller, more focused modules if it grows larger:

  • Validation utilities (email, phone, etc.)
  • Number formatting utilities
  • Application-specific helpers
    This would improve maintainability and allow for more granular imports.
libs/application/templates/inheritance-report/src/lib/messages.ts (1)

1739-1750: Consider adding descriptions to help translators.

The new message definitions follow the established pattern, but adding descriptions would help translators understand the context and purpose of these messages.

Apply this diff to add helpful descriptions:

  bottomButtonMessagePrepaidEFS: {
    id: 'ir.application:bottomButtonMessagePrepaidEFS',
    defaultMessage:
      'Inni á Mínum síðum og í Ísland.is appinu hefur þú aðgang að þínum upplýsingum og Stafrænu pósthólfi.',
-    description: '',
+    description: 'Message shown at the bottom of the prepaid inheritance report completion screen, informing users about accessing their information.',
  },
  bottomButtonMessageEFS: {
    id: 'ir.application:bottomButtonMessageEFS',
    defaultMessage:
      'Inni á Mínum síðum og í Ísland.is appinu hefur þú aðgang að þínum upplýsingum og Stafrænu pósthólfi.',
-    description: '',
+    description: 'Message shown at the bottom of the inheritance report completion screen, informing users about accessing their information.',
  },
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between bda8f93 and 96adaca.

📒 Files selected for processing (10)
  • libs/application/templates/inheritance-report/src/dataProviders/MaritalStatusProvider.ts (0 hunks)
  • libs/application/templates/inheritance-report/src/dataProviders/index.ts (1 hunks)
  • libs/application/templates/inheritance-report/src/fields/EstateAndVehiclesRepeater/index.tsx (1 hunks)
  • libs/application/templates/inheritance-report/src/forms/done.ts (1 hunks)
  • libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/heirs.ts (2 hunks)
  • libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/inheritance.ts (0 hunks)
  • libs/application/templates/inheritance-report/src/lib/dataSchema.ts (0 hunks)
  • libs/application/templates/inheritance-report/src/lib/messages.ts (1 hunks)
  • libs/application/templates/inheritance-report/src/lib/utils/helpers.ts (1 hunks)
  • libs/application/ui-forms/src/lib/formConclusionSection/formConclusionSection.ts (2 hunks)
💤 Files with no reviewable changes (3)
  • libs/application/templates/inheritance-report/src/dataProviders/MaritalStatusProvider.ts
  • libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/inheritance.ts
  • libs/application/templates/inheritance-report/src/lib/dataSchema.ts
✅ Files skipped from review due to trivial changes (1)
  • libs/application/templates/inheritance-report/src/fields/EstateAndVehiclesRepeater/index.tsx
🧰 Additional context used
📓 Path-based instructions (6)
libs/application/templates/inheritance-report/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/inheritance-report/src/forms/done.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/inheritance-report/src/forms/sections/prepaidInheritance/heirs.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/inheritance-report/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."
libs/application/templates/inheritance-report/src/lib/utils/helpers.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/ui-forms/src/lib/formConclusionSection/formConclusionSection.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 (6)
libs/application/templates/inheritance-report/src/dataProviders/index.ts (1)

3-10: Verify persistence requirements for APIs.

The EstateOnEntryApi uses shouldPersistToExternalData: true while MaritalStatusApi doesn't. Please verify if this difference is intentional and if MaritalStatusApi should also persist its data.

✅ Verification successful

Let me analyze the usage patterns to understand if the difference in persistence is intentional.


Based on the analysis of the code, I can now provide a definitive response about the persistence requirements.

The difference in persistence configuration is intentional and correct.

The EstateOnEntryApi with shouldPersistToExternalData: true is used to store estate information that needs to be referenced throughout the application lifecycle, including:

  • Estate case numbers
  • Deceased person's information
  • Estate members and their relationships
  • Estate assets and vehicles

The MaritalStatusApi without persistence is used only for collecting marital status information during form submission, and this data doesn't need to be persisted as it's used as a one-time validation/collection step.

This pattern is consistent with other APIs in the codebase where:

  • APIs that store reference data needed throughout the application lifecycle use shouldPersistToExternalData: true
  • APIs that only validate or collect data during form submission don't persist their data
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for usage patterns of both APIs to understand their persistence requirements
echo "Searching for EstateOnEntryApi usage patterns..."
rg -A 5 "EstateOnEntryApi" 

echo "Searching for MaritalStatusApi usage patterns..."
rg -A 5 "MaritalStatusApi"

Length of output: 14640


Script:

#!/bin/bash
# Let's look for the action implementations to understand their purposes
echo "Searching for syslumennOnEntry action implementation..."
rg -A 10 "syslumennOnEntry"

echo "Searching for maritalStatus action implementation..."
rg -A 10 "action: 'maritalStatus'"

# Let's also check if there are any other APIs with persistence flags
echo "Searching for other APIs with persistence flags..."
rg "shouldPersistToExternalData"

Length of output: 66470

libs/application/templates/inheritance-report/src/forms/done.ts (1)

32-35: LGTM! Well-structured addition following established patterns.

The new bottomButtonMessage property is implemented consistently with other conditional messages in the form, maintaining the same pattern of checking applicationFor against PREPAID_INHERITANCE. The code demonstrates good practices with:

  • Type-safe form configuration
  • Reusable form building blocks
  • Externalized messages for maintainability
  • Clean imports supporting effective tree-shaking
libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/heirs.ts (1)

105-109: LGTM! Good documentation addition

The new description field improves user experience by providing clear guidelines for file uploads.

libs/application/ui-forms/src/lib/formConclusionSection/formConclusionSection.ts (2)

10-10: LGTM! Import optimization improves tree-shaking.

The removal of unused Application type import helps reduce the bundle size through better tree-shaking.


30-30: Verify all usages of bottomButtonMessage are updated.

The type change from StaticText to FormText enables dynamic messaging but requires verification of all consuming code.

✅ Verification successful

No updates needed for bottomButtonMessage usages

Based on the search results, all usages of bottomButtonMessage are already providing compatible FormText values:

  • In income-plan/messages.ts: Using message descriptor object
  • In OldAgePensionForm.ts: Using message reference
  • In IncomePlanForm.ts: Using message reference
  • In AdditionalSupportForTheElderlyForm.ts: Using message reference
  • In inheritance-report/forms/done.ts: Using conditional message reference
  • In id-card/forms/Approved.ts: Using message reference
  • In id-card/forms/Rejected.ts: Using message reference

Since FormText is a superset of StaticText (as seen in the type definition in application/types/src/lib/Form.ts), all existing usages are compatible with the new type and no updates are required.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for all usages of bottomButtonMessage to ensure they provide FormText
rg -A 5 "bottomButtonMessage.*:" --type typescript

Length of output: 87


Script:

#!/bin/bash
# Search for all usages of bottomButtonMessage using ripgrep without file type restriction
rg -A 5 "bottomButtonMessage.*:"

# Also search for potential imports or references to FormText and StaticText
rg "FormText|StaticText"

Length of output: 33619

libs/application/templates/inheritance-report/src/lib/utils/helpers.ts (1)

13-13: Verify removal of ESTATE_INHERITANCE constant.

The removal of the ESTATE_INHERITANCE import suggests it's no longer used. Let's verify there are no remaining references to this constant.

@datadog-island-is
Copy link

Datadog Report

All test runs a45c44b 🔗

6 Total Test Services: 0 Failed, 6 Passed
➡️ Test Sessions change in coverage: 19 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 2.31s 1 no change Link
application-api-files 0 0 0 12 0 5.72s 1 no change Link
application-template-api-modules 0 0 0 63 0 0s N/A Link
application-templates-accident-notification 0 0 0 148 0 15.17s 1 no change Link
application-templates-criminal-record 0 0 0 2 0 10.05s 1 no change Link
application-templates-driving-license 0 0 0 13 0 13.06s 1 no change Link

Copy link

codecov bot commented Oct 31, 2024

Codecov Report

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

Project coverage is 36.67%. Comparing base (ed88ed8) to head (857f514).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...ion/templates/inheritance-report/src/forms/done.ts 0.00% 3 Missing ⚠️
...ates/inheritance-report/src/dataProviders/index.ts 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #16667   +/-   ##
=======================================
  Coverage   36.67%   36.67%           
=======================================
  Files        6859     6858    -1     
  Lines      142769   142769           
  Branches    40685    40687    +2     
=======================================
  Hits        52364    52364           
  Misses      90405    90405           
Flag Coverage Δ
api 3.37% <ø> (ø)
application-api-files 56.78% <ø> (ø)
application-system-api 41.33% <ø> (ø)
application-template-api-modules 27.79% <ø> (-0.02%) ⬇️
application-templates-accident-notification 29.24% <ø> (ø)
application-templates-car-recycling 3.12% <ø> (ø)
application-templates-criminal-record 26.30% <ø> (ø)
application-templates-driving-license 18.40% <ø> (ø)
application-templates-example-payment 25.20% <ø> (ø)
application-templates-inheritance-report 6.51% <0.00%> (ø)
application-templates-marriage-conditions 15.18% <ø> (ø)
application-templates-mortgage-certificate 43.55% <ø> (ø)
application-templates-parental-leave 29.94% <ø> (ø)
application-ui-shell 21.22% <ø> (ø)

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

Files with missing lines Coverage Δ
...ort/src/fields/EstateAndVehiclesRepeater/index.tsx 0.00% <ø> (ø)
...ort/src/forms/sections/prepaidInheritance/heirs.ts 0.00% <ø> (ø)
...c/forms/sections/prepaidInheritance/inheritance.ts 0.00% <ø> (ø)
...templates/inheritance-report/src/lib/dataSchema.ts 0.00% <ø> (ø)
...n/templates/inheritance-report/src/lib/messages.ts 100.00% <ø> (ø)
...plates/inheritance-report/src/lib/utils/helpers.ts 30.61% <ø> (ø)
...lib/formConclusionSection/formConclusionSection.ts 14.28% <ø> (ø)
...ates/inheritance-report/src/dataProviders/index.ts 0.00% <0.00%> (ø)
...ion/templates/inheritance-report/src/forms/done.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 bda8f93...857f514. Read the comment docs.

@kodiakhq kodiakhq bot merged commit d058250 into main Oct 31, 2024
56 checks passed
@kodiakhq kodiakhq bot deleted the efs_minor_cleanup branch October 31, 2024 11:40
albinagu added a commit that referenced this pull request Oct 31, 2024
* fix(inheritance-report): done screen and minor cleanup

* unused

* provider

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
kodiakhq bot added a commit that referenced this pull request Oct 31, 2024
* fix(admin): already signed message & create collection available (#16537)

* fix(admin): already signed message & create collection available

* tweak allowedToProcess

---------

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

* fix(admin): compare lists always visible (#16528)

* fix(admin): Signatures - display address (#16641)

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

* fix(inheritance-report): text adjustments (#16649)

* fix(inheritance-report): text adjustments

* chore: nx format:write update dirty files

---------

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

* fix(inheritance-report): done screen and minor cleanup (#16667)

* fix(inheritance-report): done screen and minor cleanup

* unused

* provider

---------

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

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: andes-it <[email protected]>
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.

4 participants