-
Notifications
You must be signed in to change notification settings - Fork 61
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: remove steps and add fields to others #14821
Conversation
WalkthroughThe updates focus on enhancing the accident notification form by introducing new fields and validation checks, especially for sports-related accidents and employee conditions. Alert messages and labels have been added to guide users effectively through the form completion process. Additionally, a utility function has been included to determine whether a sports accident should be treated as a work-related incident. Some minor adjustments, such as logging and function call changes, were also implemented. Changes
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Datadog ReportAll test runs ✅ 101 Total Test Services: 0 Failed, 99 Passed Test ServicesThis report shows up to 10 services
🔻 Code Coverage Decreases vs Default Branch (3) |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #14821 +/- ##
==========================================
+ Coverage 36.92% 36.93% +0.01%
==========================================
Files 6322 6323 +1
Lines 128804 128789 -15
Branches 36758 36844 +86
==========================================
+ Hits 47557 47572 +15
+ Misses 81247 81217 -30
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 21 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice just a couple of comments
...emplates/accident-notification/src/forms/AccidentNotificationForm/aboutTheAccidentSection.ts
Show resolved
Hide resolved
...emplates/accident-notification/src/forms/AccidentNotificationForm/aboutTheAccidentSection.ts
Outdated
Show resolved
Hide resolved
...emplates/accident-notification/src/forms/AccidentNotificationForm/aboutTheAccidentSection.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Review Details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (9)
- libs/application/templates/accident-notification/src/fields/FormOverview/index.tsx (3 hunks)
- libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/aboutTheAccidentSection.ts (10 hunks)
- libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/whoIsTheNotificationForSection.ts (2 hunks)
- libs/application/templates/accident-notification/src/lib/dataSchema.ts (1 hunks)
- libs/application/templates/accident-notification/src/lib/messages/accidentDetails.ts (3 hunks)
- libs/application/templates/accident-notification/src/lib/messages/application.ts (2 hunks)
- libs/application/templates/accident-notification/src/lib/messages/injuredPersonInformation.ts (2 hunks)
- libs/application/templates/accident-notification/src/utils/isSportAccidentAndEmployee.spec.ts (1 hunks)
- libs/application/templates/accident-notification/src/utils/isSportAccidentAndEmployee.ts (1 hunks)
Files skipped from review due to trivial changes (1)
- libs/application/templates/accident-notification/src/utils/isSportAccidentAndEmployee.spec.ts
Additional Context Used
Path-based Instructions (8)
libs/application/templates/accident-notification/src/utils/isSportAccidentAndEmployee.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/accident-notification/src/lib/messages/application.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/accident-notification/src/lib/messages/injuredPersonInformation.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/accident-notification/src/lib/messages/accidentDetails.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/accident-notification/src/forms/AccidentNotificationForm/whoIsTheNotificationForSection.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/accident-notification/src/lib/dataSchema.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/accident-notification/src/fields/FormOverview/index.tsx (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/accident-notification/src/forms/AccidentNotificationForm/aboutTheAccidentSection.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 (14)
libs/application/templates/accident-notification/src/lib/messages/application.ts (1)
33-45
: LGTM! The new warning messages are clear and correctly formatted.libs/application/templates/accident-notification/src/lib/messages/injuredPersonInformation.ts (1)
28-38
: LGTM! The new job title messages are clear and correctly formatted.libs/application/templates/accident-notification/src/lib/messages/accidentDetails.ts (2)
29-40
: LGTM! The new alert messages are clear and correctly formatted.
58-67
: LGTM! The new symptom messages are clear and correctly formatted.libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/whoIsTheNotificationForSection.ts (1)
114-128
: LGTM! The new fields for job title information are correctly integrated into the form structure.libs/application/templates/accident-notification/src/lib/dataSchema.ts (1)
166-168
: LGTM! The newaccidentSymptoms
field is correctly added with appropriate validation.libs/application/templates/accident-notification/src/fields/FormOverview/index.tsx (2)
511-511
: LGTM! The change aligns with the new flow.
590-595
: LGTM! Ensure the new fields are properly handled in the rest of the codebase.libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/aboutTheAccidentSection.ts (6)
67-67
: Ensure the new importisSportAccidentAndEmployee
is used correctly.Verification successful
The new import
isSportAccidentAndEmployee
is used correctly in theaboutTheAccidentSection.ts
file.
libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/aboutTheAccidentSection.ts
: Lines where the function is used:
- Line 67:
condition: (formValue) => isSportAccidentAndEmployee(formValue)
- Line 69:
isSportAccidentAndEmployee(formValue)
- Line 71:
!isSportAccidentAndEmployee(formValue)
- Line 73:
isSportAccidentAndEmployee(formValue)
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the new import `isSportAccidentAndEmployee`. # Test: Search for the function usage. Expect: Only occurances of the new function. rg --type typescript $'isSportAccidentAndEmployee'Length of output: 84
Script:
#!/bin/bash # Description: Verify the usage of the new import `isSportAccidentAndEmployee`. # Test: Search for the function usage. Expect: Only occurrences of the new function. rg 'isSportAccidentAndEmployee'Length of output: 1863
129-145
: Ensure the new job title fields are correctly defined and used.Verification successful
The new job title fields
accidentDetails.descriptionField
andinjuredPersonInformation.jobTitle
are correctly defined and used in bothwhoIsTheNotificationForSection.ts
andaboutTheAccidentSection.ts
.
libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/whoIsTheNotificationForSection.ts
libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/aboutTheAccidentSection.ts
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the new job title fields. # Test: Search for the field IDs. Expect: Only occurances of the new fields. rg --type typescript $'accidentDetails.descriptionField' rg --type typescript $'injuredPersonInformation.jobTitle'Length of output: 182
Script:
#!/bin/bash # Description: Verify the usage of the new job title fields. # Test: Search for the field IDs. Expect: Only occurrences of the new fields. rg --type ts 'accidentDetails.descriptionField' rg --type ts 'injuredPersonInformation.jobTitle'Length of output: 937
Script:
#!/bin/bash # Description: Extract the relevant lines from the identified files to verify the context and correctness of the new fields. # Extract lines containing 'accidentDetails.descriptionField' and 'injuredPersonInformation.jobTitle' from the identified files. rg --type ts --context 5 'accidentDetails.descriptionField' libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/whoIsTheNotificationForSection.ts rg --type ts --context 5 'injuredPersonInformation.jobTitle' libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/whoIsTheNotificationForSection.tsLength of output: 1219
207-214
: Ensure the new alert message field for sports accidents is correctly defined and used.
560-568
: Ensure the new alert message field for accidents older than a year is correctly defined and used.Verification successful
The new alert message field for accidents older than a year is correctly defined and used.
moreThanAYearAlertTitle
is defined inlibs/application/templates/accident-notification/src/lib/messages/accidentDetails.ts
.moreThanAYearAlertMessage
is used inlibs/application/templates/accident-notification/src/forms/AccidentNotificationForm/aboutTheAccidentSection.ts
.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the new alert message field for accidents older than a year. # Test: Search for the field ID. Expect: Only occurances of the new field. rg --type typescript $'accidentDetails.moreThanAYearAlertMessage'Length of output: 99
Script:
#!/bin/bash # Description: Verify the usage of the new alert message field for accidents older than a year. # Test: Search for the field ID. Expect: Only occurrences of the new field. rg --type ts $'accidentDetails.moreThanAYearAlertMessage'Length of output: 230
Script:
#!/bin/bash # Description: Verify the definition and usage of the new alert message field for accidents older than a year. # Test: Search for the field ID and its definition. Expect: Correct definition and usage. rg --type ts $'accidentDetails.moreThanAYearAlertTitle' rg --type ts $'accidentDetails.moreThanAYearAlertMessage'Length of output: 285
Script:
#!/bin/bash # Description: Verify the definition and usage of the alert title for accidents older than a year. # Test: Search for similar identifiers to ensure there is no typo or missing definition. rg --type ts $'moreThanAYearAlertTitle'Length of output: 496
588-618
: Ensure the new fields for accident symptoms and doctor visit details are correctly defined and used.
266-268
: Ensure the new condition for general work accident location is correctly defined and used.Verification successful
The new condition
isSportAccidentAndEmployee
is correctly defined and used in multiple places within the codebase. Here are the relevant locations:
- Definition:
libs/application/templates/accident-notification/src/utils/isSportAccidentAndEmployee.ts
- Usage in tests:
libs/application/templates/accident-notification/src/utils/isSportAccidentAndEmployee.spec.ts
- Usage in form:
libs/application/templates/accident-notification/src/forms/AccidentNotificationForm/aboutTheAccidentSection.ts
The condition appears to be well-integrated and tested.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the new condition for general work accident location. # Test: Search for the condition. Expect: Only occurances of the new condition. rg --type typescript $'isSportAccidentAndEmployee'Length of output: 84
Script:
#!/bin/bash # Description: Verify the usage of the new condition for general work accident location. # Test: Search for the condition. Expect: Only occurrences of the new condition. rg --type ts $'isSportAccidentAndEmployee'Length of output: 1873
libs/application/templates/accident-notification/src/utils/isSportAccidentAndEmployee.ts
Outdated
Show resolved
Hide resolved
libs/application/templates/accident-notification/src/fields/FormOverview/index.tsx
Outdated
Show resolved
Hide resolved
…rmOverview/index.tsx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (1)
- libs/application/templates/accident-notification/src/fields/FormOverview/index.tsx (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- libs/application/templates/accident-notification/src/fields/FormOverview/index.tsx
…portAccidentAndEmployee.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (1)
- libs/application/templates/accident-notification/src/utils/isSportAccidentAndEmployee.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- libs/application/templates/accident-notification/src/utils/isSportAccidentAndEmployee.ts
* fix: remove steps and add fields to others * chore: nx format:write update dirty files * feat: jobtitle if self reporting * fix: pr comments * fix: remove unused function * feat: adjust overview screen for new flow and data * Update libs/application/templates/accident-notification/src/fields/FormOverview/index.tsx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update libs/application/templates/accident-notification/src/utils/isSportAccidentAndEmployee.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: andes-it <[email protected]> Co-authored-by: Ólafur Björn Magnússon <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Jónas G. Sigurðsson <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
* fix: remove steps and add fields to others * chore: nx format:write update dirty files * feat: jobtitle if self reporting * fix: pr comments * fix: remove unused function * feat: adjust overview screen for new flow and data * Update libs/application/templates/accident-notification/src/fields/FormOverview/index.tsx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update libs/application/templates/accident-notification/src/utils/isSportAccidentAndEmployee.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: andes-it <[email protected]> Co-authored-by: Ólafur Björn Magnússon <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Jónas G. Sigurðsson <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
...
Attach a link to issue if relevant
What
Why
The flow was redesigned and simplified
Screenshots / Gifs
Checklist:
Summary by CodeRabbit
New Features
Improvements
Bug Fixes
Utilities