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

FEATURE/HCMPRE-1649 : help text and checklist create call order corrected #2071

Merged
merged 4 commits into from
Jan 29, 2025

Conversation

suryansh-egov
Copy link
Contributor

@suryansh-egov suryansh-egov commented Dec 24, 2024

Choose the appropriate template for your PR:

Feature PR

Feature Request

JIRA ID

Module

Description

Related Issues


Bugfix PR

Bugfix Request

JIRA ID

Module

Description

Root Cause

Related Issues


Release PR

Summary by CodeRabbit

  • New Features

    • Introduced a help text input field in the Create, Update, and View Checklist components.
    • Enhanced user interface to display and manage help text associated with checklists.
  • Bug Fixes

    • Updated error handling messages in the checklist creation process for improved clarity.
  • Improvements

    • Integrated help text into the payload for both checklist creation and updates, ensuring data consistency.
    • Adjusted layout for better presentation of help text within the checklist view.

@suryansh-egov suryansh-egov requested a review from a team as a code owner December 24, 2024 06:36
Copy link
Contributor

coderabbitai bot commented Dec 24, 2024

📝 Walkthrough

Walkthrough

The pull request introduces a new helpText feature across three components: CreateChecklist, UpdateChecklist, and ViewChecklist. The changes involve adding a state variable for help text, updating payload structures, and modifying UI components to include a text input field for help text. These modifications enable capturing, displaying, and managing additional contextual information for checklists across different stages of interaction.

Changes

File Change Summary
health/micro-ui/.../CreateChecklist.js - Added helpText state variable
- Included helpText in payload
- Added TextInput for help text
- Updated localization and error handling
health/micro-ui/.../UpdateChecklist.js - Added helpText state variable
- Populated helpText from API response
- Included helpText in payload
- Added TextInput for help text
health/micro-ui/.../ViewChecklist.js - Added helpText state variable
- Populated helpText from API response
- Added disabled TextInput to display help text

Possibly related PRs

  • checklist-bugs-localisation, search #1486: This PR modifies the UpdateChecklist component to include a new state variable helpText, similar to the main PR's addition of helpText in the CreateChecklist component, indicating a shared focus on managing help text in checklist functionalities.
  • error toast and checklist updates #1805: This PR updates the CreateChecklist component, including changes to the payloadData function that align with the main PR's modifications to how helpText is handled in the payload, suggesting a direct relationship in their functionalities.
  • FEATURE/HCMPRE-1624 : added alert, fixed localisation on checklist & added more date info on Hierarchy #2054: This PR includes changes to the UpdateChecklist component that involve renaming properties related to additional fields, which aligns with the main PR's focus on updating the payload structure to include helpText, indicating a connection in their data handling approaches.

Suggested Reviewers

  • jagankumar-egov
  • nabeelmd-eGov

Poem

🐰 A Rabbit's Ode to Help Text 🐰

In checklists where guidance was sparse,
A new field springs forth with such parse!
Help text whispers, clear and bright,
Illuminating the user's plight,
With context that makes complexity sparse! 🌟


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5bb6c9b and 7a3265c.

📒 Files selected for processing (3)
  • health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/CreateChecklist.js (4 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/UpdateChecklist.js (6 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewChecklist.js (3 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/CreateChecklist.js (1)

Pattern **/*.js: check

health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewChecklist.js (1)

Pattern **/*.js: check

health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/UpdateChecklist.js (1)

Pattern **/*.js: check

🪛 Biome (1.9.4)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/CreateChecklist.js

[error] 456-456: This let declares a variable that is only assigned once.

'roleTemp' is never reassigned.

Safe fix: Use const instead.

(lint/style/useConst)


[error] 457-457: This let declares a variable that is only assigned once.

'helpTextCode' is never reassigned.

Safe fix: Use const instead.

(lint/style/useConst)

health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/UpdateChecklist.js

[error] 405-405: This let declares a variable that is only assigned once.

'helpTextCode' is never reassigned.

Safe fix: Use const instead.

(lint/style/useConst)

🔇 Additional comments (5)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewChecklist.js (1)

259-273: Correct typos in className and placeholder.

The implementation looks good, but there are minor typos that should be fixed:

Apply this diff to fix the typos:

-      className="tetxinput-example"
+      className="textinput-example"
-      placeholder={t("CHECKLIST_HELP_TEXT_PALCEHOLDER")}
+      placeholder={t("CHECKLIST_HELP_TEXT_PLACEHOLDER")}
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/CreateChecklist.js (2)

456-457: Use const for variables that aren't reassigned.

These variables are never reassigned after initialization.

Apply this diff:

- let roleTemp = role.toUpperCase().replace(/ /g, "_");
- let helpTextCode = helpText.toUpperCase().replace(/ /g, "_");
+ const roleTemp = role.toUpperCase().replace(/ /g, "_");
+ const helpTextCode = helpText.toUpperCase().replace(/ /g, "_");
🧰 Tools
🪛 Biome (1.9.4)

[error] 456-456: This let declares a variable that is only assigned once.

'roleTemp' is never reassigned.

Safe fix: Use const instead.

(lint/style/useConst)


[error] 457-457: This let declares a variable that is only assigned once.

'helpTextCode' is never reassigned.

Safe fix: Use const instead.

(lint/style/useConst)


626-638: Correct typos in className and placeholder.

The implementation looks good, but there are minor typos that should be fixed:

Apply this diff:

-      className="tetxinput-example"
+      className="textinput-example"
-      placeholder={t("CHECKLIST_HELP_TEXT_PALCEHOLDER")}
+      placeholder={t("CHECKLIST_HELP_TEXT_PLACEHOLDER")}
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/UpdateChecklist.js (2)

405-405: Use const for variables that aren't reassigned.

This variable is never reassigned after initialization.

Apply this diff:

- let helpTextCode = helpText.toUpperCase().replace(/ /g, "_");
+ const helpTextCode = helpText.toUpperCase().replace(/ /g, "_");
🧰 Tools
🪛 Biome (1.9.4)

[error] 405-405: This let declares a variable that is only assigned once.

'helpTextCode' is never reassigned.

Safe fix: Use const instead.

(lint/style/useConst)


547-561: Correct typos in className and placeholder.

The implementation looks good, but there are minor typos that should be fixed:

Apply this diff:

-      className="tetxinput-example"
+      className="textinput-example"
-      placeholder={t("CHECKLIST_HELP_TEXT_PALCEHOLDER")}
+      placeholder={t("CHECKLIST_HELP_TEXT_PLACEHOLDER")}
✨ 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.

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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1071972 and 13a67bb.

📒 Files selected for processing (3)
  • health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/CreateChecklist.js (5 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/UpdateChecklist.js (6 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewChecklist.js (3 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewChecklist.js (1)

Pattern **/*.js: check

health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/CreateChecklist.js (1)

Pattern **/*.js: check

health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/UpdateChecklist.js (1)

Pattern **/*.js: check

🪛 Biome (1.9.4)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/CreateChecklist.js

[error] 455-455: This let declares a variable that is only assigned once.

'roleTemp' is never reassigned.

Safe fix: Use const instead.

(lint/style/useConst)


[error] 456-456: This let declares a variable that is only assigned once.

'helpTextCode' is never reassigned.

Safe fix: Use const instead.

(lint/style/useConst)

health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/UpdateChecklist.js

[error] 404-404: This let declares a variable that is only assigned once.

'helpTextCode' is never reassigned.

Safe fix: Use const instead.

(lint/style/useConst)

🔇 Additional comments (7)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewChecklist.js (2)

27-27: Use of new state variable looks good.
No issues found in introducing the new helpText state variable.


47-47: Optional fallback check for deeply nested attributes.
While this snippet uses optional chaining, consider gracefully handling scenarios where the fields array may be empty or undefined, to avoid potential runtime errors.

health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/CreateChecklist.js (2)

46-46: Help text state initialization is fine.
This addition aligns well with the new help text functionality.


432-433: Inclusion of helpText in payload is consistent with requirements.
Good job ensuring the help text is persisted in the checklist data structure.

health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/UpdateChecklist.js (3)

41-41: Help text state initialization is valid.
No issues found with introducing helpText in the component state.


77-77: Optional fallback for deeply nested property.
Similar to other components, consider a defensive check to prevent potential errors if additionalFields or fields are missing.


380-381: Consistency in payload structure.
Ensuring helpText is included here maintains consistency with the creation flow.

@jagankumar-egov jagankumar-egov changed the title help text and checklist create call order corrected FEATURE/HCMPRE-1649 : help text and checklist create call order corrected Jan 29, 2025
@jagankumar-egov jagankumar-egov merged commit ed448fc into console Jan 29, 2025
3 of 6 checks passed
@jagankumar-egov jagankumar-egov deleted the FEATURE-1649 branch January 29, 2025 12:16
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.

2 participants