-
Notifications
You must be signed in to change notification settings - Fork 46
Console v0.5 #2965
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
base: master
Are you sure you want to change the base?
Console v0.5 #2965
Conversation
📝 WalkthroughWalkthroughPropagates a new parentState prop through app-configuration wrappers; adds DependentFieldsWrapper and FiltersRenderer; extends DrawerFieldComposer and RenderConditionalField to handle visibility expressions and filters; restructures config flattening to include visibility/autoFill/conditional navigation; updates template/filter UI, scanner button behavior, and minor CSS/formatting fixes. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Drawer as DrawerFieldComposer
participant RCF as RenderConditionalField
participant DFW as DependentFieldsWrapper
User->>Drawer: Open field settings
Drawer->>RCF: Render with parentState, handleExpressionChange, screenConfig, selectedField
RCF->>DFW: Render dependencyFieldWrapper with props
User->>DFW: Select page/field/operator/value
DFW-->>RCF: onExpressionChange(expressionString)
RCF-->>Drawer: handleExpressionChange(expressionString)
Drawer->>Drawer: Update drawerState.visibilityCondition.expression (if changed)
Note right of Drawer: Expression persisted in drawerState.visibilityCondition
sequenceDiagram
autonumber
actor User
participant FR as FiltersRenderer
participant MDMS as Digit.Hooks.useCustomMDMS
participant State as drawerState
User->>FR: Select schema from Dropdown
FR->>MDMS: fetch(moduleName, masterName, schemaCode=FILTERSDROPDOWNLIST)
MDMS-->>FR: Return mdmsOptions
FR->>FR: Initialize localActiveOptions from mdmsOptions (active=true)
FR->>State: Set enums to active MDMS objects
loop Toggle options
User->>FR: Toggle Switch(code)
FR->>FR: Update localActiveOptions
FR->>State: Sync enums with active selections
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
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: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (6)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/AppPreview.js
(1 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
(2 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/HCMMyCampaignRowCard.js
(1 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
(3 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/NewCampaignCreate/CampaignDetails.js
(3 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.js
⚙️ CodeRabbit Configuration File
check
Files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/AppPreview.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/HCMMyCampaignRowCard.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/NewCampaignCreate/CampaignDetails.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js
🧠 Learnings (33)
📓 Common learnings
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#741
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/Module.js:15-15
Timestamp: 2024-10-08T20:11:12.539Z
Learning: When adding a new module code like "campaignmanager" to `moduleCode`, ensure that it is properly handled in all relevant conditional checks and function parameters across the codebase.
📚 Learning: in `health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/viewvillage...
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1770
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/viewVillage.js:320-322
Timestamp: 2024-11-07T11:02:33.520Z
Learning: In `health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/viewVillage.js`, the `data?.additionalFields` object is guaranteed to be defined, so checking for its existence before accessing its keys is unnecessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/AppPreview.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/HCMMyCampaignRowCard.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/NewCampaignCreate/CampaignDetails.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js
📚 Learning: the `addresourcestofiltereddatatoshow` function in `micro-ui/web/micro-ui-internals/packages/modules...
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#606
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js:276-276
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The `addResourcesToFilteredDataToShow` function in `micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js` now includes checks for data integrity, such as validation of `previewData`, the common column, and `resources`, along with error logging for invalid data formats.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/AppPreview.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/HCMMyCampaignRowCard.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js
📚 Learning: in the `downloadtemplate` function of `health/micro-ui/web/micro-ui-internals/packages/modules/micro...
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1925
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserUpload.js:267-269
Timestamp: 2024-11-28T11:34:27.480Z
Learning: In the `downloadTemplate` function of `health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserUpload.js`, the scenario where `state?.hierarchyType` is undefined will not occur.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/AppPreview.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js
📚 Learning: in the sandbox productdetailscomponentupdated.js component, string concatenation is intentionally us...
Learnt from: Hari-egov
PR: egovernments/DIGIT-Frontend#2644
File: micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/ProductDetails/ProductDetailsComponentUpdated.js:279-280
Timestamp: 2025-06-26T10:21:42.619Z
Learning: In the sandbox ProductDetailsComponentUpdated.js component, string concatenation is intentionally used for translation keys (e.g., `t(`${module}` + "_SECTION1_ROLE_1")`) instead of template literals for easier config identification and to make the key structure more explicit.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/AppPreview.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/NewCampaignCreate/CampaignDetails.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js
📚 Learning: in the `jsonreader` function within `health/micro-ui/web/micro-ui-internals/packages/modules/campaig...
Learnt from: Bhavya-egov
PR: egovernments/DIGIT-Frontend#2013
File: health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/jsonReader.js:24-27
Timestamp: 2024-12-12T05:38:22.901Z
Learning: In the `jsonReader` function within `health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/jsonReader.js`, generic error handling is sufficient, and enhancing error handling with specific error types is not necessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/AppPreview.js
📚 Learning: in `mycampaign.js`, when suggesting code improvements for the `onclickrow` function, keep suggestion...
Learnt from: jagankumar-egov
PR: egovernments/DIGIT-Frontend#1763
File: health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/MyCampaign.js:65-75
Timestamp: 2024-11-07T07:17:27.636Z
Learning: In `MyCampaign.js`, when suggesting code improvements for the `onClickRow` function, keep suggestions simple and avoid unnecessary complexity.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/HCMMyCampaignRowCard.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/NewCampaignCreate/CampaignDetails.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
📚 Learning: the `onstepclick` logic in `createmicroplan.js` is intentionally commented out to allow developers t...
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#0
File: :0-0
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The `onStepClick` logic in `CreateMicroplan.js` is intentionally commented out to allow developers to navigate between screens during development, even though not all screens are made yet.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/HCMMyCampaignRowCard.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/NewCampaignCreate/CampaignDetails.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
📚 Learning: in the `viewhierarchy.js` component of the campaign manager module, the hierarchy name should be dis...
Learnt from: suryansh-egov
PR: egovernments/DIGIT-Frontend#1794
File: health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewHierarchy.js:361-361
Timestamp: 2024-11-11T11:39:57.295Z
Learning: In the `ViewHierarchy.js` component of the campaign manager module, the hierarchy name should be displayed as is, without concatenating translation keys with variables.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/HCMMyCampaignRowCard.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
📚 Learning: in the `timelinepopupwrapper` component in `timelinepopupwrapper.js`, the `action` property of `inst...
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1770
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/timelinePopUpWrapper.js:36-36
Timestamp: 2024-11-07T11:00:11.847Z
Learning: In the `TimelinePopUpWrapper` component in `timelinePopUpWrapper.js`, the `action` property of `instance` is a required field and will always be defined; thus, checks for undefined values for `instance.action` are unnecessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/HCMMyCampaignRowCard.js
📚 Learning: the button component from `@egovernments/digit-ui-components` has compatibility issues with the acti...
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#0
File: :0-0
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The Button component from `egovernments/digit-ui-components` has compatibility issues with the ActionBar, leading to the preference for using the Button from `egovernments/digit-ui-react-components` in certain scenarios.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/HCMMyCampaignRowCard.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
📚 Learning: in the employee login component (micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/emp...
Learnt from: jagankumar-egov
PR: egovernments/DIGIT-Frontend#2488
File: micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/Login/login.js:152-152
Timestamp: 2025-06-04T04:08:48.234Z
Learning: In the employee login component (micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/Login/login.js), prefer using a `defaultTenant` variable to store `Digit.ULBService.getStateId()` instead of calling the function multiple times inline in the `defaultValue` object. This improves code readability and avoids function call duplication.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/HCMMyCampaignRowCard.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js
📚 Learning: in the `usegenerateidcampaign` function, auto assignment of default parameter values is needed in pa...
Learnt from: ashish-egov
PR: egovernments/DIGIT-Frontend#1441
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/hooks/useGenerateIdCampaign.js:1-1
Timestamp: 2024-09-30T05:45:14.549Z
Learning: In the `useGenerateIdCampaign` function, auto assignment of default parameter values is needed in parameter destructuring.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/NewCampaignCreate/CampaignDetails.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
📚 Learning: in loginsignupselector component, the url checking using window.location.href.includes("sandbox-ui/u...
Learnt from: Hari-egov
PR: egovernments/DIGIT-Frontend#2644
File: micro-ui/web/micro-ui-internals/packages/modules/core/src/components/LoginSignupSelector.js:24-24
Timestamp: 2025-06-26T09:43:00.597Z
Learning: In LoginSignupSelector component, the URL checking using window.location.href.includes("sandbox-ui/user/sign-up") is intentional for URL validation purposes, not navigation. The team prefers this approach over React Router's useLocation hook for specific URL checking needs.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/NewCampaignCreate/CampaignDetails.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: in `activitycard.js`, `react.fragment` is used in the code....
Learnt from: Ramkrishna-egov
PR: egovernments/DIGIT-Frontend#1545
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/ActivityCard.js:1-1
Timestamp: 2024-10-17T11:59:00.327Z
Learning: In `ActivityCard.js`, `React.Fragment` is used in the code.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/NewCampaignCreate/CampaignDetails.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
📚 Learning: the logic for the data change save check in the `ruleengine.js` file has been shifted elsewhere for ...
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#698
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/RuleEngine.js:55-57
Timestamp: 2024-10-08T20:11:07.772Z
Learning: The logic for the data change save check in the `RuleEngine.js` file has been shifted elsewhere for more global checks.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/NewCampaignCreate/CampaignDetails.js
📚 Learning: the privacycomponent in `micro-ui/web/micro-ui-internals/packages/modules/core/src/components/privac...
Learnt from: Hari-egov
PR: egovernments/DIGIT-Frontend#2644
File: micro-ui/web/micro-ui-internals/packages/modules/core/src/components/PrivacyComponent.js:0-0
Timestamp: 2025-06-27T05:52:33.156Z
Learning: The PrivacyComponent in `micro-ui/web/micro-ui-internals/packages/modules/core/src/components/PrivacyComponent.js` is mostly used in login and signup pages, especially in formcomposer where the UI is stable, making layout changes less likely to cause regressions.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/NewCampaignCreate/CampaignDetails.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
📚 Learning: in the digit-frontend codebase, translations within formcomposer are handled internally by the compo...
Learnt from: Tulika-eGov
PR: egovernments/DIGIT-Frontend#2188
File: micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/employee/new-inbox.js:34-47
Timestamp: 2025-02-05T10:18:29.947Z
Learning: In the DIGIT-Frontend codebase, translations within FormComposer are handled internally by the component itself, so the translation function 't' does not need to be added to useMemo dependency arrays even when used within the memoized function that generates form configurations.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/NewCampaignCreate/CampaignDetails.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: the imports in `microplanpreview.js` are from different libraries: `@egovernments/digit-ui-component...
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#698
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanPreview.js:1-1
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The imports in `MicroplanPreview.js` are from different libraries: `egovernments/digit-ui-components` and `egovernments/digit-ui-react-components`.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/NewCampaignCreate/CampaignDetails.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: in pgr's usecomplaintsubtype hook, the translation function 't' must be included in the useeffect de...
Learnt from: Tulika-eGov
PR: egovernments/DIGIT-Frontend#2188
File: micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/pgr/useComplaintSubType.js:14-14
Timestamp: 2025-02-05T10:05:37.433Z
Learning: In PGR's useComplaintSubType hook, the translation function 't' must be included in the useEffect dependency array to ensure complaint types are updated when the language changes.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/NewCampaignCreate/CampaignDetails.js
📚 Learning: in uselocalities hook, the language parameter is used in the query key to trigger react query cache ...
Learnt from: Tulika-eGov
PR: egovernments/DIGIT-Frontend#2188
File: micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/useLocalities.js:5-6
Timestamp: 2025-02-05T10:06:57.846Z
Learning: In useLocalities hook, the language parameter is used in the query key to trigger React Query cache invalidation when language changes, while actual translation is handled by the 't' function parameter.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/NewCampaignCreate/CampaignDetails.js
📚 Learning: the user prefers the `useeffect` hook to run only when `checkdatacompletion` changes in the `navigat...
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#720
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Nagivator.js:46-56
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The user prefers the `useEffect` hook to run only when `checkDataCompletion` changes in the `Navigator` component.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/NewCampaignCreate/CampaignDetails.js
📚 Learning: the `usegenerateidcampaign` hook is planned to be used in the upload section in the future....
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#606
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/hooks/index.js:19-19
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The `useGenerateIdCampaign` hook is planned to be used in the Upload section in the future.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/NewCampaignCreate/CampaignDetails.js
📚 Learning: if the `boundarydatageneration` function in `upload.js` fails, it indicates that there is no data fo...
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#803
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js:300-341
Timestamp: 2024-06-10T19:25:42.992Z
Learning: If the `boundaryDataGeneration` function in `Upload.js` fails, it indicates that there is no data for that campaign, and this is an acceptable outcome. Retrying the operation is unnecessary as it would yield the same result.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/NewCampaignCreate/CampaignDetails.js
📚 Learning: the `customscalecontrol` component in the `micro-ui/web/micro-ui-internals/packages/modules/hcm-micr...
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#876
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/CustomScaleControl.js:3-39
Timestamp: 2024-06-14T14:10:20.359Z
Learning: The `CustomScaleControl` component in the `micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/CustomScaleControl.js` file should not include a "loading map" message as there is another component handling this functionality to avoid redundancy.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
📚 Learning: in the hrms module (micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pagecompone...
Learnt from: Hari-egov
PR: egovernments/DIGIT-Frontend#2788
File: micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js:26-26
Timestamp: 2025-07-15T04:58:30.634Z
Learning: In the HRMS module (micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js), the team has moved away from using MDMS hooks for boundary data fetching and now uses direct API calls to the boundary service endpoint `/boundary-service/boundary-relationships/_search` instead of the `useHrmsMDMS` hook with "FetchBoundaries" parameter.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: classes related to interactive elements in the microplan preview section are mostly passed to higher...
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#876
File: micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss:1940-2392
Timestamp: 2024-06-14T14:10:38.086Z
Learning: Classes related to interactive elements in the microplan preview section are mostly passed to Higher Order Components (HOCs), and ARIA attributes for non-HOC elements will be managed directly by adding them where necessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
📚 Learning: in the digit-frontend project, when reviewing the `uicustomizations.js` file, avoid suggesting refac...
Learnt from: nabeelmd-eGov
PR: egovernments/DIGIT-Frontend#1680
File: health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js:1032-1094
Timestamp: 2024-10-26T15:11:49.938Z
Learning: In the DIGIT-Frontend project, when reviewing the `UICustomizations.js` file, avoid suggesting refactoring of repetitive rendering logic in switch cases into helper functions, unless explicitly requested.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: in our codebase, the 'card' component is commonly used by passing children via the 'children' prop....
Learnt from: Ramkrishna-egov
PR: egovernments/DIGIT-Frontend#1545
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/ActivityCard.js:30-35
Timestamp: 2024-10-17T12:00:51.749Z
Learning: In our codebase, the 'Card' component is commonly used by passing children via the 'children' prop.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: in micro-ui/web/micro-ui-internals/packages/modules/workbench/src/pages/employee/mdmsaddv2.js, alway...
Learnt from: jagankumar-egov
PR: egovernments/DIGIT-Frontend#2089
File: micro-ui/web/micro-ui-internals/packages/modules/workbench/src/pages/employee/MDMSAddV2.js:111-111
Timestamp: 2025-01-02T04:41:15.957Z
Learning: In micro-ui/web/micro-ui-internals/packages/modules/workbench/src/pages/employee/MDMSAddV2.js, always use "mdms[0].uniqueIdentifier" for the jsonPath instead of differentiating between "SOR" and other masters.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js
📚 Learning: the error message in the `checkforerrorinuploadedfile` function within `upload.js` is being localize...
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#204
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/Upload.js:468-481
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The error message in the `checkForErrorInUploadedFile` function within `Upload.js` is being localized and improved for better user experience, as clarified by the user.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js
📚 Learning: in `excelvalidations.js`, the variables `locationdatacolumns`, `errors`, `hasdataerrors`, `missingco...
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#720
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/excelValidations.js:7-7
Timestamp: 2024-06-10T19:25:42.992Z
Learning: In `excelValidations.js`, the variables `locationDataColumns`, `errors`, `hasDataErrors`, `missingColumnsList`, and `errorMessages` are reassigned later in the code, making the use of `let` appropriate.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js
📚 Learning: in `jsonpreviewinexcelform.js`, the variables `headername` and `error` are only assigned once within...
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#720
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/JsonPreviewInExcelForm.js:48-49
Timestamp: 2024-10-08T20:11:07.772Z
Learning: In `JsonPreviewInExcelForm.js`, the variables `headerName` and `error` are only assigned once within the scope of the `map` function, making the use of `const` appropriate.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js
🔇 Additional comments (9)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/AppPreview.js (1)
140-140
: LGTM! Field type mapping correction.The change correctly maps the input field type
"textArea"
to the output type"textarea"
, ensuring consistency with therenderField
function which properly handles the"textarea"
case.health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js (1)
398-398
: LGTM! Improved null safety.The change adds defensive programming by defaulting
locS
to an empty array when it's undefined or null, preventing potential runtime errors when calling.find()
.health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/NewCampaignCreate/CampaignDetails.js (1)
5-5
: LGTM! Consistent navigation state handling.The implementation properly extracts the draft campaign flag from React Router's location state and passes it down to
ViewDetailComponent
with appropriate fallback handling. This aligns with the broader pattern across the module of using location state instead of URL parameters.Also applies to: 147-148, 328-328
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js (1)
6-6
: LGTM! Proper state propagation through navigation.The component now accepts and forwards the
isDraftCampaign
flag via React Router's location state, enabling consistent draft campaign status handling across navigation flows.Also applies to: 22-22
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/HCMMyCampaignRowCard.js (1)
181-181
: LGTM! Improved navigation state management.The change correctly passes the draft campaign status through React Router's location state instead of URL parameters, providing cleaner URLs and better state encapsulation. The logic properly determines draft status by checking
rowData?.status === "drafted"
.health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js (4)
5-5
: Import statement looks good.The
Chip
component import is properly added and used in the conditional rendering below.
11-13
: Navigation hooks and state extraction implemented correctly.The
useLocation
anduseHistory
hooks are properly imported and used. TheisDraftCampaign
flag extraction from location state follows React Router patterns correctly.
14-14
: Hook usage is appropriate.The
useQueryParams
custom hook is correctly used to extract query parameters needed for the API call.
176-185
: Conditional UI rendering implemented correctly.The flex layout and conditional rendering of the Cancel Campaign chip is well implemented. The styling and component usage follow established patterns.
...i-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
Outdated
Show resolved
Hide resolved
...i-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
Outdated
Show resolved
Hide resolved
...i-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
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: 1
♻️ Duplicate comments (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js (1)
141-150
: Extract API endpoint as constant for better maintainability.Consider extracting the API endpoint as a constant for better maintainability and reusability.
+const CANCEL_CAMPAIGN_ENDPOINT = "/project-factory/v1/project-type/cancel-campaign"; + const Template = { - url: "/project-factory/v1/project-type/cancel-campaign", + url: CANCEL_CAMPAIGN_ENDPOINT, body: { CampaignDetails: { tenantId: tenantId, campaignId: queryParams?.id, } }, };
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
(3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.js
⚙️ CodeRabbit Configuration File
check
Files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
🧠 Learnings (31)
📓 Common learnings
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#741
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/Module.js:15-15
Timestamp: 2024-10-08T20:11:12.539Z
Learning: When adding a new module code like "campaignmanager" to `moduleCode`, ensure that it is properly handled in all relevant conditional checks and function parameters across the codebase.
📚 Learning: in `mycampaign.js`, when suggesting code improvements for the `onclickrow` function, keep suggestion...
Learnt from: jagankumar-egov
PR: egovernments/DIGIT-Frontend#1763
File: health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/MyCampaign.js:65-75
Timestamp: 2024-11-07T07:17:27.636Z
Learning: In `MyCampaign.js`, when suggesting code improvements for the `onClickRow` function, keep suggestions simple and avoid unnecessary complexity.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: the `customscalecontrol` component in the `micro-ui/web/micro-ui-internals/packages/modules/hcm-micr...
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#876
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/CustomScaleControl.js:3-39
Timestamp: 2024-06-14T14:10:20.359Z
Learning: The `CustomScaleControl` component in the `micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/CustomScaleControl.js` file should not include a "loading map" message as there is another component handling this functionality to avoid redundancy.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: in the hrms module (micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pagecompone...
Learnt from: Hari-egov
PR: egovernments/DIGIT-Frontend#2788
File: micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js:26-26
Timestamp: 2025-07-15T04:58:30.634Z
Learning: In the HRMS module (micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js), the team has moved away from using MDMS hooks for boundary data fetching and now uses direct API calls to the boundary service endpoint `/boundary-service/boundary-relationships/_search` instead of the `useHrmsMDMS` hook with "FetchBoundaries" parameter.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: in loginsignupselector component, the url checking using window.location.href.includes("sandbox-ui/u...
Learnt from: Hari-egov
PR: egovernments/DIGIT-Frontend#2644
File: micro-ui/web/micro-ui-internals/packages/modules/core/src/components/LoginSignupSelector.js:24-24
Timestamp: 2025-06-26T09:43:00.597Z
Learning: In LoginSignupSelector component, the URL checking using window.location.href.includes("sandbox-ui/user/sign-up") is intentional for URL validation purposes, not navigation. The team prefers this approach over React Router's useLocation hook for specific URL checking needs.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: the privacycomponent in `micro-ui/web/micro-ui-internals/packages/modules/core/src/components/privac...
Learnt from: Hari-egov
PR: egovernments/DIGIT-Frontend#2644
File: micro-ui/web/micro-ui-internals/packages/modules/core/src/components/PrivacyComponent.js:0-0
Timestamp: 2025-06-27T05:52:33.156Z
Learning: The PrivacyComponent in `micro-ui/web/micro-ui-internals/packages/modules/core/src/components/PrivacyComponent.js` is mostly used in login and signup pages, especially in formcomposer where the UI is stable, making layout changes less likely to cause regressions.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: in `activitycard.js`, `react.fragment` is used in the code....
Learnt from: Ramkrishna-egov
PR: egovernments/DIGIT-Frontend#1545
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/ActivityCard.js:1-1
Timestamp: 2024-10-17T11:59:00.327Z
Learning: In `ActivityCard.js`, `React.Fragment` is used in the code.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: classes related to interactive elements in the microplan preview section are mostly passed to higher...
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#876
File: micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss:1940-2392
Timestamp: 2024-06-14T14:10:38.086Z
Learning: Classes related to interactive elements in the microplan preview section are mostly passed to Higher Order Components (HOCs), and ARIA attributes for non-HOC elements will be managed directly by adding them where necessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: the `onstepclick` logic in `createmicroplan.js` is intentionally commented out to allow developers t...
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#0
File: :0-0
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The `onStepClick` logic in `CreateMicroplan.js` is intentionally commented out to allow developers to navigate between screens during development, even though not all screens are made yet.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: in the sandbox productdetailscomponentupdated.js component, string concatenation is intentionally us...
Learnt from: Hari-egov
PR: egovernments/DIGIT-Frontend#2644
File: micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/ProductDetails/ProductDetailsComponentUpdated.js:279-280
Timestamp: 2025-06-26T10:21:42.619Z
Learning: In the sandbox ProductDetailsComponentUpdated.js component, string concatenation is intentionally used for translation keys (e.g., `t(`${module}` + "_SECTION1_ROLE_1")`) instead of template literals for easier config identification and to make the key structure more explicit.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: the `addresourcestofiltereddatatoshow` function in `micro-ui/web/micro-ui-internals/packages/modules...
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#606
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js:276-276
Timestamp: 2024-10-08T20:11:07.772Z
Learning: The `addResourcesToFilteredDataToShow` function in `micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js` now includes checks for data integrity, such as validation of `previewData`, the common column, and `resources`, along with error logging for invalid data formats.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: in `health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/viewvillage...
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1770
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/viewVillage.js:320-322
Timestamp: 2024-11-07T11:02:33.520Z
Learning: In `health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/viewVillage.js`, the `data?.additionalFields` object is guaranteed to be defined, so checking for its existence before accessing its keys is unnecessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: in the digit-frontend project, when reviewing the `uicustomizations.js` file, avoid suggesting refac...
Learnt from: nabeelmd-eGov
PR: egovernments/DIGIT-Frontend#1680
File: health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js:1032-1094
Timestamp: 2024-10-26T15:11:49.938Z
Learning: In the DIGIT-Frontend project, when reviewing the `UICustomizations.js` file, avoid suggesting refactoring of repetitive rendering logic in switch cases into helper functions, unless explicitly requested.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: in the `timelinepopupwrapper` component in `timelinepopupwrapper.js`, the `action` property of `inst...
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1770
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/timelinePopUpWrapper.js:36-36
Timestamp: 2024-11-07T11:00:11.847Z
Learning: In the `TimelinePopUpWrapper` component in `timelinePopUpWrapper.js`, the `action` property of `instance` is a required field and will always be defined; thus, checks for undefined values for `instance.action` are unnecessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: in the `downloadtemplate` function of `health/micro-ui/web/micro-ui-internals/packages/modules/micro...
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1925
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserUpload.js:267-269
Timestamp: 2024-11-28T11:34:27.480Z
Learning: In the `downloadTemplate` function of `health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserUpload.js`, the scenario where `state?.hierarchyType` is undefined will not occur.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: in the `jsonreader` function within `health/micro-ui/web/micro-ui-internals/packages/modules/campaig...
Learnt from: Bhavya-egov
PR: egovernments/DIGIT-Frontend#2013
File: health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/jsonReader.js:24-27
Timestamp: 2024-12-12T05:38:22.901Z
Learning: In the `jsonReader` function within `health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/jsonReader.js`, generic error handling is sufficient, and enhancing error handling with specific error types is not necessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: in `planinbox.js`, the variable `planwithcensus?.statuscount[selectedfilter]` is always defined in t...
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1847
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PlanInbox.js:308-314
Timestamp: 2024-11-18T04:35:51.535Z
Learning: In `PlanInbox.js`, the variable `planWithCensus?.StatusCount[selectedFilter]` is always defined in the given context, so null checks are unnecessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: in the employee login component (micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/emp...
Learnt from: jagankumar-egov
PR: egovernments/DIGIT-Frontend#2488
File: micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/Login/login.js:152-152
Timestamp: 2025-06-04T04:08:48.234Z
Learning: In the employee login component (micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/Login/login.js), prefer using a `defaultTenant` variable to store `Digit.ULBService.getStateId()` instead of calling the function multiple times inline in the `defaultValue` object. This improves code readability and avoids function call duplication.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: in the hrms module (micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pagecompone...
Learnt from: Hari-egov
PR: egovernments/DIGIT-Frontend#2788
File: micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js:43-74
Timestamp: 2025-07-15T06:49:28.898Z
Learning: In the HRMS module (micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js), the current error handling approach in the `fetchDetailsForSelectedOption` function is considered sufficient by the team. Enhanced error handling with user notifications and fallback behavior is not required for the boundary service API call.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: in the `usegenerateidcampaign` function, auto assignment of default parameter values is needed in pa...
Learnt from: ashish-egov
PR: egovernments/DIGIT-Frontend#1441
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/hooks/useGenerateIdCampaign.js:1-1
Timestamp: 2024-09-30T05:45:14.549Z
Learning: In the `useGenerateIdCampaign` function, auto assignment of default parameter values is needed in parameter destructuring.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: if the `boundarydatageneration` function in `upload.js` fails, it indicates that there is no data fo...
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#803
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js:300-341
Timestamp: 2024-06-10T19:25:42.992Z
Learning: If the `boundaryDataGeneration` function in `Upload.js` fails, it indicates that there is no data for that campaign, and this is an acceptable outcome. Retrying the operation is unnecessary as it would yield the same result.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: in `popinbox.js`, when integrating the `confirmationpopup` component, error handling for api failure...
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1832
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PopInbox.js:592-594
Timestamp: 2024-11-14T12:48:23.023Z
Learning: In `PopInbox.js`, when integrating the `ConfirmationPopUp` component, error handling for API failures is managed internally within the component, so explicitly passing an `onError` prop is not necessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: in `popinbox.js`, error handling for the `onerror` callback in `workflowcommentpopup` is handled wit...
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1837
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PopInbox.js:559-561
Timestamp: 2024-11-15T10:15:57.369Z
Learning: In `PopInbox.js`, error handling for the `onError` callback in `WorkflowCommentPopUp` is handled within the component, so explicit error handling in the parent component is unnecessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: error handling for the `convertgeojsontoexcelsinglesheet` function in the `micro-ui/web/micro-ui-int...
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#478
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js:80-99
Timestamp: 2024-06-10T19:25:42.992Z
Learning: Error handling for the `convertGeojsonToExcelSingleSheet` function in the `micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js` file is managed elsewhere in the codebase.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: the error message in the `checkforerrorinuploadedfile` function within `upload.js` is being localize...
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#204
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/Upload.js:468-481
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The error message in the `checkForErrorInUploadedFile` function within `Upload.js` is being localized and improved for better user experience, as clarified by the user.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: in the digit-frontend codebase, translations within formcomposer are handled internally by the compo...
Learnt from: Tulika-eGov
PR: egovernments/DIGIT-Frontend#2188
File: micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/employee/new-inbox.js:34-47
Timestamp: 2025-02-05T10:18:29.947Z
Learning: In the DIGIT-Frontend codebase, translations within FormComposer are handled internally by the component itself, so the translation function 't' does not need to be added to useMemo dependency arrays even when used within the memoized function that generates form configurations.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: the button component from `@egovernments/digit-ui-components` has compatibility issues with the acti...
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#0
File: :0-0
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The Button component from `egovernments/digit-ui-components` has compatibility issues with the ActionBar, leading to the preference for using the Button from `egovernments/digit-ui-react-components` in certain scenarios.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: the imports in `microplanpreview.js` are from different libraries: `@egovernments/digit-ui-component...
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#698
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanPreview.js:1-1
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The imports in `MicroplanPreview.js` are from different libraries: `egovernments/digit-ui-components` and `egovernments/digit-ui-react-components`.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: in the hrms module (micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pagecompone...
Learnt from: Hari-egov
PR: egovernments/DIGIT-Frontend#2788
File: micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js:157-162
Timestamp: 2025-07-15T06:50:54.535Z
Learning: In the HRMS module (micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js), localization is already working correctly when using `ele.hierarchyType` directly in the `gethierarchylistdata()` function. The suggested locale conversion using `Digit.Utils.locale.convertToLocale(ele.hierarchyType, 'EGOV_LOCATION_BOUNDARYTYPE')` is not needed as the current implementation already provides proper localization.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: in our codebase, the 'card' component is commonly used by passing children via the 'children' prop....
Learnt from: Ramkrishna-egov
PR: egovernments/DIGIT-Frontend#1545
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/ActivityCard.js:30-35
Timestamp: 2024-10-17T12:00:51.749Z
Learning: In our codebase, the 'Card' component is commonly used by passing children via the 'children' prop.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: in the `viewhierarchy.js` component of the campaign manager module, the hierarchy name should be dis...
Learnt from: suryansh-egov
PR: egovernments/DIGIT-Frontend#1794
File: health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewHierarchy.js:361-361
Timestamp: 2024-11-11T11:39:57.295Z
Learning: In the `ViewHierarchy.js` component of the campaign manager module, the hierarchy name should be displayed as is, without concatenating translation keys with variables.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
⏰ Context from checks skipped due to timeout of 10000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js (2)
3-3
: LGTM! Clean import additions and state extraction.The router hooks and Chip component imports are correctly added, and the isDraftCampaign flag extraction from location state follows standard React Router patterns.
Also applies to: 5-5, 11-14
188-197
: LGTM! Well-structured conditional UI rendering.The flex layout properly positions the campaign name tag and cancel button, and the conditional rendering based on
isDraftCampaign
flag is implemented correctly. The Chip component usage is appropriate with proper event handling.
...i-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
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: 1
🔭 Outside diff range comments (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js (1)
260-270
: Missing import forCardText
CardText
is referenced at Line 267 but isn’t in the imports list, causing a runtime reference error.-import { AlertCard, Stepper, TextBlock, Tag, Card, HeaderComponent, Loader, PopUp, Button, Chip } from "@egovernments/digit-ui-components"; +import { AlertCard, Stepper, TextBlock, Tag, Card, HeaderComponent, Loader, PopUp, Button, Chip, CardText } from "@egovernments/digit-ui-components";
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
(1 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
(5 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.js
⚙️ CodeRabbit Configuration File
check
Files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
🧠 Learnings (32)
📓 Common learnings
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#741
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/Module.js:15-15
Timestamp: 2024-10-08T20:11:12.539Z
Learning: When adding a new module code like "campaignmanager" to `moduleCode`, ensure that it is properly handled in all relevant conditional checks and function parameters across the codebase.
📚 Learning: 2025-07-15T04:58:30.634Z
Learnt from: Hari-egov
PR: egovernments/DIGIT-Frontend#2788
File: micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js:26-26
Timestamp: 2025-07-15T04:58:30.634Z
Learning: In the HRMS module (micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js), the team has moved away from using MDMS hooks for boundary data fetching and now uses direct API calls to the boundary service endpoint `/boundary-service/boundary-relationships/_search` instead of the `useHrmsMDMS` hook with "FetchBoundaries" parameter.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2024-11-07T07:17:27.636Z
Learnt from: jagankumar-egov
PR: egovernments/DIGIT-Frontend#1763
File: health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/MyCampaign.js:65-75
Timestamp: 2024-11-07T07:17:27.636Z
Learning: In `MyCampaign.js`, when suggesting code improvements for the `onClickRow` function, keep suggestions simple and avoid unnecessary complexity.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
📚 Learning: 2024-06-14T14:10:20.359Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#876
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/CustomScaleControl.js:3-39
Timestamp: 2024-06-14T14:10:20.359Z
Learning: The `CustomScaleControl` component in the `micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/CustomScaleControl.js` file should not include a "loading map" message as there is another component handling this functionality to avoid redundancy.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2024-06-10T19:25:42.992Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#698
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanPreview.js:1-1
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The imports in `MicroplanPreview.js` are from different libraries: `egovernments/digit-ui-components` and `egovernments/digit-ui-react-components`.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
📚 Learning: 2024-10-26T15:11:49.938Z
Learnt from: nabeelmd-eGov
PR: egovernments/DIGIT-Frontend#1680
File: health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js:1032-1094
Timestamp: 2024-10-26T15:11:49.938Z
Learning: In the DIGIT-Frontend project, when reviewing the `UICustomizations.js` file, avoid suggesting refactoring of repetitive rendering logic in switch cases into helper functions, unless explicitly requested.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2024-06-10T19:25:42.992Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#606
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js:276-276
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The `addResourcesToFilteredDataToShow` function in `micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js` now includes checks for data integrity, such as validation of `previewData`, the common column, and `resources`, along with error logging for invalid data formats.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2024-06-10T19:25:42.992Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#0
File: :0-0
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The Button component from `egovernments/digit-ui-components` has compatibility issues with the ActionBar, leading to the preference for using the Button from `egovernments/digit-ui-react-components` in certain scenarios.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2024-11-14T12:48:23.023Z
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1832
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PopInbox.js:592-594
Timestamp: 2024-11-14T12:48:23.023Z
Learning: In `PopInbox.js`, when integrating the `ConfirmationPopUp` component, error handling for API failures is managed internally within the component, so explicitly passing an `onError` prop is not necessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2024-11-07T11:02:33.520Z
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1770
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/viewVillage.js:320-322
Timestamp: 2024-11-07T11:02:33.520Z
Learning: In `health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/viewVillage.js`, the `data?.additionalFields` object is guaranteed to be defined, so checking for its existence before accessing its keys is unnecessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
📚 Learning: 2024-11-07T11:00:11.847Z
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1770
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/timelinePopUpWrapper.js:36-36
Timestamp: 2024-11-07T11:00:11.847Z
Learning: In the `TimelinePopUpWrapper` component in `timelinePopUpWrapper.js`, the `action` property of `instance` is a required field and will always be defined; thus, checks for undefined values for `instance.action` are unnecessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2024-11-28T11:34:27.480Z
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1925
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserUpload.js:267-269
Timestamp: 2024-11-28T11:34:27.480Z
Learning: In the `downloadTemplate` function of `health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserUpload.js`, the scenario where `state?.hierarchyType` is undefined will not occur.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2024-12-12T05:38:22.901Z
Learnt from: Bhavya-egov
PR: egovernments/DIGIT-Frontend#2013
File: health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/jsonReader.js:24-27
Timestamp: 2024-12-12T05:38:22.901Z
Learning: In the `jsonReader` function within `health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/jsonReader.js`, generic error handling is sufficient, and enhancing error handling with specific error types is not necessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2024-11-18T04:35:51.535Z
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1847
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PlanInbox.js:308-314
Timestamp: 2024-11-18T04:35:51.535Z
Learning: In `PlanInbox.js`, the variable `planWithCensus?.StatusCount[selectedFilter]` is always defined in the given context, so null checks are unnecessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2025-06-26T10:21:42.619Z
Learnt from: Hari-egov
PR: egovernments/DIGIT-Frontend#2644
File: micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/ProductDetails/ProductDetailsComponentUpdated.js:279-280
Timestamp: 2025-06-26T10:21:42.619Z
Learning: In the sandbox ProductDetailsComponentUpdated.js component, string concatenation is intentionally used for translation keys (e.g., `t(`${module}` + "_SECTION1_ROLE_1")`) instead of template literals for easier config identification and to make the key structure more explicit.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
📚 Learning: 2025-06-04T04:08:48.234Z
Learnt from: jagankumar-egov
PR: egovernments/DIGIT-Frontend#2488
File: micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/Login/login.js:152-152
Timestamp: 2025-06-04T04:08:48.234Z
Learning: In the employee login component (micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/Login/login.js), prefer using a `defaultTenant` variable to store `Digit.ULBService.getStateId()` instead of calling the function multiple times inline in the `defaultValue` object. This improves code readability and avoids function call duplication.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2025-07-15T06:49:28.898Z
Learnt from: Hari-egov
PR: egovernments/DIGIT-Frontend#2788
File: micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js:43-74
Timestamp: 2025-07-15T06:49:28.898Z
Learning: In the HRMS module (micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js), the current error handling approach in the `fetchDetailsForSelectedOption` function is considered sufficient by the team. Enhanced error handling with user notifications and fallback behavior is not required for the boundary service API call.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2024-09-30T05:45:14.549Z
Learnt from: ashish-egov
PR: egovernments/DIGIT-Frontend#1441
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/hooks/useGenerateIdCampaign.js:1-1
Timestamp: 2024-09-30T05:45:14.549Z
Learning: In the `useGenerateIdCampaign` function, auto assignment of default parameter values is needed in parameter destructuring.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
📚 Learning: 2024-10-08T20:11:12.539Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#803
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js:300-341
Timestamp: 2024-10-08T20:11:12.539Z
Learning: If the `boundaryDataGeneration` function in `Upload.js` fails, it indicates that there is no data for that campaign, and this is an acceptable outcome. Retrying the operation is unnecessary as it would yield the same result.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2024-11-15T10:15:57.369Z
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1837
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PopInbox.js:559-561
Timestamp: 2024-11-15T10:15:57.369Z
Learning: In `PopInbox.js`, error handling for the `onError` callback in `WorkflowCommentPopUp` is handled within the component, so explicit error handling in the parent component is unnecessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2024-10-08T20:11:12.539Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#478
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js:80-99
Timestamp: 2024-10-08T20:11:12.539Z
Learning: Error handling for the `convertGeojsonToExcelSingleSheet` function in the `micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js` file is managed elsewhere in the codebase.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2024-06-10T19:25:42.992Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#204
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/Upload.js:468-481
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The error message in the `checkForErrorInUploadedFile` function within `Upload.js` is being localized and improved for better user experience, as clarified by the user.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2024-06-10T19:25:42.992Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#0
File: :0-0
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The `onStepClick` logic in `CreateMicroplan.js` is intentionally commented out to allow developers to navigate between screens during development, even though not all screens are made yet.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
📚 Learning: 2025-02-05T10:18:29.947Z
Learnt from: Tulika-eGov
PR: egovernments/DIGIT-Frontend#2188
File: micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/employee/new-inbox.js:34-47
Timestamp: 2025-02-05T10:18:29.947Z
Learning: In the DIGIT-Frontend codebase, translations within FormComposer are handled internally by the component itself, so the translation function 't' does not need to be added to useMemo dependency arrays even when used within the memoized function that generates form configurations.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
📚 Learning: 2024-10-08T20:11:12.539Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#691
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js:16-17
Timestamp: 2024-10-08T20:11:12.539Z
Learning: The components `Loader`, `Toast`, and `Modal` are from different libraries in the DIGIT-Frontend project, as clarified by the user.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2024-10-17T11:59:00.327Z
Learnt from: Ramkrishna-egov
PR: egovernments/DIGIT-Frontend#1545
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/ActivityCard.js:1-1
Timestamp: 2024-10-17T11:59:00.327Z
Learning: In `ActivityCard.js`, `React.Fragment` is used in the code.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
📚 Learning: 2025-06-27T05:52:33.156Z
Learnt from: Hari-egov
PR: egovernments/DIGIT-Frontend#2644
File: micro-ui/web/micro-ui-internals/packages/modules/core/src/components/PrivacyComponent.js:0-0
Timestamp: 2025-06-27T05:52:33.156Z
Learning: The PrivacyComponent in `micro-ui/web/micro-ui-internals/packages/modules/core/src/components/PrivacyComponent.js` is mostly used in login and signup pages, especially in formcomposer where the UI is stable, making layout changes less likely to cause regressions.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
📚 Learning: 2024-06-14T14:10:38.086Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#876
File: micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss:1940-2392
Timestamp: 2024-06-14T14:10:38.086Z
Learning: Classes related to interactive elements in the microplan preview section are mostly passed to Higher Order Components (HOCs), and ARIA attributes for non-HOC elements will be managed directly by adding them where necessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
📚 Learning: 2024-10-08T20:11:12.539Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#675
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Mapping.js:675-675
Timestamp: 2024-10-08T20:11:12.539Z
Learning: The modal component from the external library used in `Mapping.js` does not support the `className` property, and thus styles cannot be refactored into a CSS module.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2024-06-10T19:25:42.992Z
Learnt from: nitish-egov
PR: egovernments/DIGIT-Frontend#0
File: :0-0
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The `boundaryData` null check is performed at a higher level before calling the `getDataSheetReady` function in `utilities/project-factory/src/server/utils/genericUtils.ts`.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2024-06-10T19:25:42.992Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#720
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Nagivator.js:46-56
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The user prefers the `useEffect` hook to run only when `checkDataCompletion` changes in the `Navigator` component.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2024-11-11T11:39:57.295Z
Learnt from: suryansh-egov
PR: egovernments/DIGIT-Frontend#1794
File: health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewHierarchy.js:361-361
Timestamp: 2024-11-11T11:39:57.295Z
Learning: In the `ViewHierarchy.js` component of the campaign manager module, the hierarchy name should be displayed as is, without concatenating translation keys with variables.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
🪛 Biome (2.1.2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
[error] 150-150: This variable is used before its declaration.
The variable is declared here:
(lint/correctness/noInvalidUseBeforeDeclaration)
⏰ Context from checks skipped due to timeout of 10000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (actions)
🔇 Additional comments (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js (1)
6-6
: Style-only change looks goodWhitespace tweak is harmless; no further action needed.
...i-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
Outdated
Show resolved
Hide resolved
* Added template screen for referral flow * FEATURE/HCMPRE-2958 : Added dependency field wrapper
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: 15
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (9)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js
(1 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js
(3 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppLocalisationWrapper.js
(2 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DependentFieldsWrapper.js
(1 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DrawerFieldComposer.js
(5 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/ImpelComponentWrapper.js
(3 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js
(3 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
(2 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.js
⚙️ CodeRabbit Configuration File
check
Files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppLocalisationWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/ImpelComponentWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DependentFieldsWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DrawerFieldComposer.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
🧠 Learnings (25)
📓 Common learnings
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#606
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js:276-276
Timestamp: 2024-10-08T20:11:07.772Z
Learning: The `addResourcesToFilteredDataToShow` function in `micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js` now includes checks for data integrity, such as validation of `previewData`, the common column, and `resources`, along with error logging for invalid data formats.
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#606
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js:276-276
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The `addResourcesToFilteredDataToShow` function in `micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js` now includes checks for data integrity, such as validation of `previewData`, the common column, and `resources`, along with error logging for invalid data formats.
Learnt from: Hari-egov
PR: egovernments/DIGIT-Frontend#2644
File: micro-ui/web/micro-ui-internals/packages/modules/core/src/components/PrivacyComponent.js:0-0
Timestamp: 2025-06-27T05:52:33.156Z
Learning: The PrivacyComponent in `micro-ui/web/micro-ui-internals/packages/modules/core/src/components/PrivacyComponent.js` is mostly used in login and signup pages, especially in formcomposer where the UI is stable, making layout changes less likely to cause regressions.
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#876
File: micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss:1940-2392
Timestamp: 2024-06-14T14:10:38.086Z
Learning: Classes related to interactive elements in the microplan preview section are mostly passed to Higher Order Components (HOCs), and ARIA attributes for non-HOC elements will be managed directly by adding them where necessary.
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#698
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/RuleEngine.js:55-57
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The logic for the data change save check in the `RuleEngine.js` file has been shifted elsewhere for more global checks.
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#698
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/RuleEngine.js:55-57
Timestamp: 2024-10-08T20:11:07.772Z
Learning: The logic for the data change save check in the `RuleEngine.js` file has been shifted elsewhere for more global checks.
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1770
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/viewVillage.js:320-322
Timestamp: 2024-11-07T11:02:33.520Z
Learning: In `health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/viewVillage.js`, the `data?.additionalFields` object is guaranteed to be defined, so checking for its existence before accessing its keys is unnecessary.
Learnt from: jagankumar-egov
PR: egovernments/DIGIT-Frontend#2342
File: health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents.js/DateSelection.js:41-47
Timestamp: 2025-04-21T05:15:36.122Z
Learning: In React components, prefer using state setters directly in event handlers rather than creating wrapper functions that only call the setter without additional logic.
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1832
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PopInbox.js:592-594
Timestamp: 2024-11-14T12:48:23.023Z
Learning: In `PopInbox.js`, when integrating the `ConfirmationPopUp` component, error handling for API failures is managed internally within the component, so explicitly passing an `onError` prop is not necessary.
Learnt from: Hari-egov
PR: egovernments/DIGIT-Frontend#2644
File: micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/ProductDetails/ProductDetailsComponentUpdated.js:279-280
Timestamp: 2025-06-26T10:21:42.619Z
Learning: In the sandbox ProductDetailsComponentUpdated.js component, string concatenation is intentionally used for translation keys (e.g., `t(`${module}` + "_SECTION1_ROLE_1")`) instead of template literals for easier config identification and to make the key structure more explicit.
📚 Learning: 2025-06-26T10:21:42.619Z
Learnt from: Hari-egov
PR: egovernments/DIGIT-Frontend#2644
File: micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/ProductDetails/ProductDetailsComponentUpdated.js:279-280
Timestamp: 2025-06-26T10:21:42.619Z
Learning: In the sandbox ProductDetailsComponentUpdated.js component, string concatenation is intentionally used for translation keys (e.g., `t(`${module}` + "_SECTION1_ROLE_1")`) instead of template literals for easier config identification and to make the key structure more explicit.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppLocalisationWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/ImpelComponentWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DependentFieldsWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DrawerFieldComposer.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js
📚 Learning: 2024-11-07T11:02:33.520Z
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1770
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/viewVillage.js:320-322
Timestamp: 2024-11-07T11:02:33.520Z
Learning: In `health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/viewVillage.js`, the `data?.additionalFields` object is guaranteed to be defined, so checking for its existence before accessing its keys is unnecessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppLocalisationWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/ImpelComponentWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DependentFieldsWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DrawerFieldComposer.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
📚 Learning: 2025-06-04T04:08:48.234Z
Learnt from: jagankumar-egov
PR: egovernments/DIGIT-Frontend#2488
File: micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/Login/login.js:152-152
Timestamp: 2025-06-04T04:08:48.234Z
Learning: In the employee login component (micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/Login/login.js), prefer using a `defaultTenant` variable to store `Digit.ULBService.getStateId()` instead of calling the function multiple times inline in the `defaultValue` object. This improves code readability and avoids function call duplication.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppLocalisationWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js
📚 Learning: 2025-06-27T05:52:33.156Z
Learnt from: Hari-egov
PR: egovernments/DIGIT-Frontend#2644
File: micro-ui/web/micro-ui-internals/packages/modules/core/src/components/PrivacyComponent.js:0-0
Timestamp: 2025-06-27T05:52:33.156Z
Learning: The PrivacyComponent in `micro-ui/web/micro-ui-internals/packages/modules/core/src/components/PrivacyComponent.js` is mostly used in login and signup pages, especially in formcomposer where the UI is stable, making layout changes less likely to cause regressions.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppLocalisationWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/ImpelComponentWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DependentFieldsWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DrawerFieldComposer.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js
📚 Learning: 2025-04-21T05:15:36.122Z
Learnt from: jagankumar-egov
PR: egovernments/DIGIT-Frontend#2342
File: health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents.js/DateSelection.js:41-47
Timestamp: 2025-04-21T05:15:36.122Z
Learning: In React components, prefer using state setters directly in event handlers rather than creating wrapper functions that only call the setter without additional logic.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppLocalisationWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/ImpelComponentWrapper.js
📚 Learning: 2024-10-08T20:11:12.539Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#691
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js:16-17
Timestamp: 2024-10-08T20:11:12.539Z
Learning: The components `Loader`, `Toast`, and `Modal` are from different libraries in the DIGIT-Frontend project, as clarified by the user.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppLocalisationWrapper.js
📚 Learning: 2024-10-08T20:11:07.772Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#606
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js:276-276
Timestamp: 2024-10-08T20:11:07.772Z
Learning: The `addResourcesToFilteredDataToShow` function in `micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js` now includes checks for data integrity, such as validation of `previewData`, the common column, and `resources`, along with error logging for invalid data formats.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DependentFieldsWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DrawerFieldComposer.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
📚 Learning: 2024-11-28T11:34:27.480Z
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1925
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserUpload.js:267-269
Timestamp: 2024-11-28T11:34:27.480Z
Learning: In the `downloadTemplate` function of `health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserUpload.js`, the scenario where `state?.hierarchyType` is undefined will not occur.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js
📚 Learning: 2024-10-26T15:11:49.938Z
Learnt from: nabeelmd-eGov
PR: egovernments/DIGIT-Frontend#1680
File: health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js:1032-1094
Timestamp: 2024-10-26T15:11:49.938Z
Learning: In the DIGIT-Frontend project, when reviewing the `UICustomizations.js` file, avoid suggesting refactoring of repetitive rendering logic in switch cases into helper functions, unless explicitly requested.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DependentFieldsWrapper.js
📚 Learning: 2024-06-14T14:10:20.359Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#876
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/CustomScaleControl.js:3-39
Timestamp: 2024-06-14T14:10:20.359Z
Learning: The `CustomScaleControl` component in the `micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/CustomScaleControl.js` file should not include a "loading map" message as there is another component handling this functionality to avoid redundancy.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js
📚 Learning: 2024-12-12T05:38:22.901Z
Learnt from: Bhavya-egov
PR: egovernments/DIGIT-Frontend#2013
File: health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/jsonReader.js:24-27
Timestamp: 2024-12-12T05:38:22.901Z
Learning: In the `jsonReader` function within `health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/jsonReader.js`, generic error handling is sufficient, and enhancing error handling with specific error types is not necessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
📚 Learning: 2024-10-08T20:11:12.539Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#741
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/Module.js:15-15
Timestamp: 2024-10-08T20:11:12.539Z
Learning: When adding a new module code like "campaignmanager" to `moduleCode`, ensure that it is properly handled in all relevant conditional checks and function parameters across the codebase.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
📚 Learning: 2025-02-05T10:18:29.947Z
Learnt from: Tulika-eGov
PR: egovernments/DIGIT-Frontend#2188
File: micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/employee/new-inbox.js:34-47
Timestamp: 2025-02-05T10:18:29.947Z
Learning: In the DIGIT-Frontend codebase, translations within FormComposer are handled internally by the component itself, so the translation function 't' does not need to be added to useMemo dependency arrays even when used within the memoized function that generates form configurations.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DependentFieldsWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DrawerFieldComposer.js
📚 Learning: 2024-06-10T19:25:42.992Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#698
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/RuleEngine.js:55-57
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The logic for the data change save check in the `RuleEngine.js` file has been shifted elsewhere for more global checks.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
📚 Learning: 2025-02-05T10:05:37.433Z
Learnt from: Tulika-eGov
PR: egovernments/DIGIT-Frontend#2188
File: micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/pgr/useComplaintSubType.js:14-14
Timestamp: 2025-02-05T10:05:37.433Z
Learning: In PGR's useComplaintSubType hook, the translation function 't' must be included in the useEffect dependency array to ensure complaint types are updated when the language changes.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js
📚 Learning: 2024-11-07T11:00:11.847Z
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1770
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/timelinePopUpWrapper.js:36-36
Timestamp: 2024-11-07T11:00:11.847Z
Learning: In the `TimelinePopUpWrapper` component in `timelinePopUpWrapper.js`, the `action` property of `instance` is a required field and will always be defined; thus, checks for undefined values for `instance.action` are unnecessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/ImpelComponentWrapper.js
📚 Learning: 2024-06-14T14:10:38.086Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#876
File: micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss:1940-2392
Timestamp: 2024-06-14T14:10:38.086Z
Learning: Classes related to interactive elements in the microplan preview section are mostly passed to Higher Order Components (HOCs), and ARIA attributes for non-HOC elements will be managed directly by adding them where necessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/ImpelComponentWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DependentFieldsWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js
📚 Learning: 2024-06-10T19:25:42.992Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#698
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanPreview.js:1-1
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The imports in `MicroplanPreview.js` are from different libraries: `egovernments/digit-ui-components` and `egovernments/digit-ui-react-components`.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/ImpelComponentWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DependentFieldsWrapper.js
📚 Learning: 2024-10-17T12:00:51.749Z
Learnt from: Ramkrishna-egov
PR: egovernments/DIGIT-Frontend#1545
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/ActivityCard.js:30-35
Timestamp: 2024-10-17T12:00:51.749Z
Learning: In our codebase, the 'Card' component is commonly used by passing children via the 'children' prop.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/ImpelComponentWrapper.js
📚 Learning: 2024-10-08T20:11:07.772Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#720
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/JsonPreviewInExcelForm.js:48-49
Timestamp: 2024-10-08T20:11:07.772Z
Learning: In `JsonPreviewInExcelForm.js`, the variables `headerName` and `error` are only assigned once within the scope of the `map` function, making the use of `const` appropriate.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js
📚 Learning: 2024-06-10T19:25:42.992Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#720
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/excelValidations.js:7-7
Timestamp: 2024-06-10T19:25:42.992Z
Learning: In `excelValidations.js`, the variables `locationDataColumns`, `errors`, `hasDataErrors`, `missingColumnsList`, and `errorMessages` are reassigned later in the code, making the use of `let` appropriate.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
📚 Learning: 2024-10-25T09:24:29.878Z
Learnt from: Ramkrishna-egov
PR: egovernments/DIGIT-Frontend#1670
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserAccessMgmtTableWrapper.js:156-160
Timestamp: 2024-10-25T09:24:29.878Z
Learning: In the `UserAccessMgmtTableWrapper` component, since the `ShowMoreWrapper` is rendered within the cell, additional checks or row-specific state management are not required.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js
📚 Learning: 2024-06-10T19:25:42.992Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#0
File: :0-0
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The `onStepClick` logic in `CreateMicroplan.js` is intentionally commented out to allow developers to navigate between screens during development, even though not all screens are made yet.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js
📚 Learning: 2024-06-10T19:25:42.992Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#478
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js:80-99
Timestamp: 2024-06-10T19:25:42.992Z
Learning: Error handling for the `convertGeojsonToExcelSingleSheet` function in the `micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js` file is managed elsewhere in the codebase.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
🧬 Code Graph Analysis (5)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppLocalisationWrapper.js (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js (2)
localeModule
(66-66)parentState
(60-60)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js (3)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js (1)
parentState
(60-60)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DrawerFieldComposer.js (1)
handleExpressionChange
(411-421)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DependentFieldsWrapper.js (1)
selectedField
(44-44)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/ImpelComponentWrapper.js (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js (1)
parentState
(60-60)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js (1)
parentState
(60-60)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DrawerFieldComposer.js (2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js (1)
parentState
(60-60)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DependentFieldsWrapper.js (1)
selectedField
(44-44)
🔇 Additional comments (13)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js (1)
300-303
: Remove redundant Acknowledgement cases in getTemplateRendererIn getTemplateRenderer, the early
if (templateName?.includes('Acknowledgement')) { return responsePanelComponent; }already covers all acknowledgement templates, so the explicit switch cases for
"BeneficiaryAcknowledgement"
and"HouseholdAcknowledgement"
are redundant.File: health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
Lines: 300–306Suggested diff:
if (templateName?.includes('Acknowledgement')) { return responsePanelComponent; } - switch (templateName) { - case "BeneficiaryAcknowledgement": - case "HouseholdAcknowledgement": - return responsePanelComponent; + switch (templateName) {• Remove the two specific cases under the switch (they’re covered by the early return).
• After removal, ensure any remaining switch branches are still aligned correctly.Please confirm there aren’t any other templateName values that include “Acknowledgement” but shouldn’t render this component. If you require case-insensitive matching, switch to:
templateName?.toLowerCase().includes("acknowledgement")health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js (1)
482-482
: Verify downstream support forparentState
ImpelComponentWrapper correctly acceptsparentState
and passes it into<AppLocalisationWrapper>
, but we can’t confirm here whether that component (from@egovernments/digit-ui-components
) consumes and forwards it as intended. Please double-check.• health/micro-ui/.../ImpelComponentWrapper.js
– Line 9: function signature includesparentState
– Line 203: JSX<AppLocalisationWrapper … parentState={parentState}>
Ensure
AppLocalisationWrapper
’s props includeparentState
and that it propagates it down.health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppLocalisationWrapper.js (1)
132-132
: Forward parentState to AppConfigurationWrapper — OKProp threading is consistent. No other logic changes.
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js (3)
290-290
: Accept parentState in wrapper — OKSignature update aligns with parent components. Ensure any memoization/React.memo considerations include this prop if it affects rendering.
398-399
: Null-safety improvement in localisation lookup — LGTMUsing
(locS || [])?.find(...)
prevents crashes when localisation data is absent.
636-637
: Prop Interface Verified:DrawerFieldComposer
Accepts New Props
- DrawerFieldComposer.js now declares
function DrawerFieldComposer({ parentState, screenConfig, selectedField })
and forwards these into its children.- AppConfigurationWrapper.js (lines 634–636) correctly passes
parentState
,screenConfig
, andselectedField={state?.drawerField}
toDrawerFieldComposer
.
No other usages ofDrawerFieldComposer
were found—interfaces are aligned and no further updates are needed.health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/ImpelComponentWrapper.js (1)
203-203
: LGTM:parentState
forwarded to AppLocalisationWrapper.This aligns with the broader prop propagation across the redesign.
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js (2)
6-6
: Import is correct for default export.
DependentFieldsWrapper
is a default export; import usage matches the new component file.
18-21
: Confirmed only one usage
Verified viarg -n "<RenderConditionalField"
: only invoked in
- health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DrawerFieldComposer.js (around line 158)
Please ensure this instance now passes the newly widened props—
parentState
,handleExpressionChange
,screenConfig
, andselectedField
.health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DrawerFieldComposer.js (4)
78-78
: Prop threading into RenderField acknowledged.Extending
RenderField
signature aligns with new dependency wrapper flow.
169-173
: LGTM: passing required props to RenderConditionalField.
parentState
,handleExpressionChange
,screenConfig
, andselectedField
are correctly forwarded.
496-499
: LGTM: props forwarded from Drawer to RenderField.Propagation path is consistent end-to-end.
388-388
: No missing props – all call-sites updated
The only JSX usage of<DrawerFieldComposer>
is inAppConfigurationWrapper.js
(line 636), and it already passesparentState
,screenConfig
, andselectedField
. No further callers found; the widened signature is fully satisfied.
...dules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppLocalisationWrapper.js
Outdated
Show resolved
Hide resolved
function parseExpression(expression = "") { | ||
for (const operator of OPERATORS) { | ||
const idx = expression.indexOf(operator); | ||
if (idx !== -1) { | ||
const [field, value] = [ | ||
expression.slice(0, idx), | ||
expression.slice(idx + operator.length) | ||
]; | ||
const [selectedPage, selectedField] = field.split("."); | ||
return { | ||
selectedPage: { code: selectedPage, name: selectedPage } || "", | ||
selectedField: { code: selectedField, name: selectedField } || "", | ||
comparisonType: { code: operator, name: operator }, | ||
fieldValue: value || "" | ||
}; | ||
} | ||
} | ||
// Fallback: if no operator found | ||
return { | ||
selectedPage: {}, | ||
selectedField: {}, | ||
comparisonType: {}, | ||
fieldValue: "" | ||
}; | ||
} |
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.
Fix parsing of field path with nested dots; split only on the first dot.
Current field.split(".")
drops deeper segments in jsonPath
(e.g., page.a.b.c
becomes page
/a
). Split at the first dot to preserve the full field path.
Apply:
- const [selectedPage, selectedField] = field.split(".");
- return {
- selectedPage: { code: selectedPage, name: selectedPage } || "",
- selectedField: { code: selectedField, name: selectedField } || "",
+ const dotIdx = field.indexOf(".");
+ const pagePart = dotIdx >= 0 ? field.slice(0, dotIdx) : field;
+ const fieldPart = dotIdx >= 0 ? field.slice(dotIdx + 1) : "";
+ return {
+ selectedPage: pagePart ? { code: pagePart, name: pagePart } : {},
+ selectedField: fieldPart ? { code: fieldPart, name: fieldPart } : {},
comparisonType: { code: operator, name: operator },
fieldValue: value || ""
};
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
function parseExpression(expression = "") { | |
for (const operator of OPERATORS) { | |
const idx = expression.indexOf(operator); | |
if (idx !== -1) { | |
const [field, value] = [ | |
expression.slice(0, idx), | |
expression.slice(idx + operator.length) | |
]; | |
const [selectedPage, selectedField] = field.split("."); | |
return { | |
selectedPage: { code: selectedPage, name: selectedPage } || "", | |
selectedField: { code: selectedField, name: selectedField } || "", | |
comparisonType: { code: operator, name: operator }, | |
fieldValue: value || "" | |
}; | |
} | |
} | |
// Fallback: if no operator found | |
return { | |
selectedPage: {}, | |
selectedField: {}, | |
comparisonType: {}, | |
fieldValue: "" | |
}; | |
} | |
function parseExpression(expression = "") { | |
for (const operator of OPERATORS) { | |
const idx = expression.indexOf(operator); | |
if (idx !== -1) { | |
const [field, value] = [ | |
expression.slice(0, idx), | |
expression.slice(idx + operator.length) | |
]; | |
const dotIdx = field.indexOf("."); | |
const pagePart = dotIdx >= 0 ? field.slice(0, dotIdx) : field; | |
const fieldPart = dotIdx >= 0 ? field.slice(dotIdx + 1) : ""; | |
return { | |
selectedPage: pagePart ? { code: pagePart, name: pagePart } : {}, | |
selectedField: fieldPart ? { code: fieldPart, name: fieldPart } : {}, | |
comparisonType: { code: operator, name: operator }, | |
fieldValue: value || "" | |
}; | |
} | |
} | |
// Fallback: if no operator found | |
return { | |
selectedPage: {}, | |
selectedField: {}, | |
comparisonType: {}, | |
fieldValue: "" | |
}; | |
} |
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DependentFieldsWrapper.js
between lines 12 and 36, the parseExpression function incorrectly splits the
field string on every dot, losing nested path segments. Modify the split logic
to split only on the first dot, extracting the selectedPage as the substring
before the first dot and selectedField as the remainder after it, preserving the
full nested field path.
const pageOptions = useMemo(() => { | ||
const currentIndex = currentTemplate.findIndex((p) => p.name === currentPage); | ||
return currentTemplate.slice(0, currentIndex + 1).map((p) => ({ | ||
code: p.name, | ||
name: p.name, | ||
})); | ||
}, [currentTemplate, currentPage]); |
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.
Guard against undefined currentTemplate
to prevent runtime errors.
If parentState.currentTemplate
is undefined, .findIndex()
/.slice()
will throw. Default to an empty array.
Apply:
- const pageOptions = useMemo(() => {
- const currentIndex = currentTemplate.findIndex((p) => p.name === currentPage);
- return currentTemplate.slice(0, currentIndex + 1).map((p) => ({
+ const pageOptions = useMemo(() => {
+ const template = Array.isArray(currentTemplate) ? currentTemplate : [];
+ const currentIndex = template.findIndex((p) => p.name === currentPage);
+ return template.slice(0, currentIndex + 1).map((p) => ({
code: p.name,
name: p.name,
}));
- }, [currentTemplate, currentPage]);
+ }, [currentTemplate, currentPage]);
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const pageOptions = useMemo(() => { | |
const currentIndex = currentTemplate.findIndex((p) => p.name === currentPage); | |
return currentTemplate.slice(0, currentIndex + 1).map((p) => ({ | |
code: p.name, | |
name: p.name, | |
})); | |
}, [currentTemplate, currentPage]); | |
const pageOptions = useMemo(() => { | |
const template = Array.isArray(currentTemplate) ? currentTemplate : []; | |
const currentIndex = template.findIndex((p) => p.name === currentPage); | |
return template.slice(0, currentIndex + 1).map((p) => ({ | |
code: p.name, | |
name: p.name, | |
})); | |
}, [currentTemplate, currentPage]); |
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DependentFieldsWrapper.js
around lines 50 to 56, the code uses currentTemplate without checking if it is
undefined, which can cause runtime errors when calling findIndex or slice. Fix
this by defaulting currentTemplate to an empty array if it is undefined before
using it in useMemo, ensuring safe calls to findIndex and slice.
const fieldOptions = useMemo(() => { | ||
const pageObj = currentTemplate.find((p) => p.name === selectedPage?.code)?.cards?.[0]; | ||
if (!pageObj) return []; | ||
return pageObj.fields.map((f) => ({ | ||
code: f.jsonPath, | ||
name: f.jsonPath, | ||
format: f.format, | ||
enums: f.dropDownOptions || [], | ||
})); | ||
}, [parentState?.currentTemplate, selectedPage?.code]); |
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.
Also null-safe fieldOptions
and align useMemo deps with referenced vars.
Use the local currentTemplate
(null-safe) and avoid errors when page is not found.
Apply:
- const fieldOptions = useMemo(() => {
- const pageObj = currentTemplate.find((p) => p.name === selectedPage?.code)?.cards?.[0];
+ const fieldOptions = useMemo(() => {
+ const template = Array.isArray(currentTemplate) ? currentTemplate : [];
+ const pageObj = template.find((p) => p.name === selectedPage?.code)?.cards?.[0];
if (!pageObj) return [];
return pageObj.fields.map((f) => ({
code: f.jsonPath,
name: f.jsonPath,
format: f.format,
enums: f.dropDownOptions || [],
}));
- }, [parentState?.currentTemplate, selectedPage?.code]);
+ }, [currentTemplate, selectedPage?.code]);
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const fieldOptions = useMemo(() => { | |
const pageObj = currentTemplate.find((p) => p.name === selectedPage?.code)?.cards?.[0]; | |
if (!pageObj) return []; | |
return pageObj.fields.map((f) => ({ | |
code: f.jsonPath, | |
name: f.jsonPath, | |
format: f.format, | |
enums: f.dropDownOptions || [], | |
})); | |
}, [parentState?.currentTemplate, selectedPage?.code]); | |
const fieldOptions = useMemo(() => { | |
const template = Array.isArray(currentTemplate) ? currentTemplate : []; | |
const pageObj = template.find((p) => p.name === selectedPage?.code)?.cards?.[0]; | |
if (!pageObj) return []; | |
return pageObj.fields.map((f) => ({ | |
code: f.jsonPath, | |
name: f.jsonPath, | |
format: f.format, | |
enums: f.dropDownOptions || [], | |
})); | |
}, [currentTemplate, selectedPage?.code]); |
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DependentFieldsWrapper.js
around lines 58 to 67, the useMemo hook references parentState?.currentTemplate
in dependencies but uses local currentTemplate variable inside, which can cause
stale values or errors. Fix this by updating the dependency array to include
currentTemplate instead of parentState?.currentTemplate, and add null checks to
ensure currentTemplate and selectedPage are valid before accessing their
properties to prevent runtime errors when pageObj is not found.
})); | ||
}, [parentState?.currentTemplate, selectedPage?.code]); | ||
|
||
const selectedFieldObj = fieldOptions.find((f) => f.code === selectedField); |
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.
Fix selected field lookup; compare against selectedField.code
.
selectedField
is an object; comparing to it directly fails.
Apply:
- const selectedFieldObj = fieldOptions.find((f) => f.code === selectedField);
+ const selectedFieldObj = fieldOptions.find((f) => f.code === selectedField?.code);
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const selectedFieldObj = fieldOptions.find((f) => f.code === selectedField); | |
const selectedFieldObj = fieldOptions.find((f) => f.code === selectedField?.code); |
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DependentFieldsWrapper.js
at line 69, the code compares fieldOptions' code to selectedField directly, but
selectedField is an object. Fix this by comparing fieldOptions' code to
selectedField.code instead to correctly find the matching field object.
@@ -6,7 +6,7 @@ import { AppLocalisationWrapper, Loader, useCustomT } from "@egovernments/digit- | |||
//development mode | |||
import AppPreview from "../../../components/AppPreview"; | |||
|
|||
function ImpelComponentWrapper({ variant, screenConfig, submit, back, showBack, parentDispatch, localeModule, pageTag, ...props }) { | |||
function ImpelComponentWrapper({ variant, screenConfig, submit, back, showBack, parentDispatch, localeModule, pageTag, parentState,...props }) { |
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.
💡 Verification agent
🧩 Analysis chain
Prop added to wrapper signature looks fine; ensure all callers are updated.
Adding parentState
here is consistent with the redesign. Verify upstream callers pass it everywhere to avoid undefined access downstream.
Run to find all ImpelComponentWrapper
usages and verify parentState
is passed:
🏁 Script executed:
#!/bin/bash
rg -n "ImpelComponentWrapper" -A3 -B1
Length of output: 3324
Missing parentState
Prop in ImpelComponentWrapper
Call
The only caller of ImpelComponentWrapper
in
AppConfigurationParentLayer.js
(around line 473) isn’t passing the newly added parentState
prop. This will lead to undefined
downstream. Please update the invocation:
<ImpelComponentWrapper
variant={variant}
screenConfig={currentScreen}
submit={submit}
+ parentState={parentState}
back={back}
showBack={showBack}
parentDispatch={parentDispatch}
localeModule={localeModule}
pageTag={pageTag}
{...props}
/>
• File: packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js
• Location: around line 473
Ensure any other usages (if added later) also include parentState
.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
function ImpelComponentWrapper({ variant, screenConfig, submit, back, showBack, parentDispatch, localeModule, pageTag, parentState,...props }) { | |
<ImpelComponentWrapper | |
variant={variant} | |
screenConfig={currentScreen} | |
submit={submit} | |
parentState={parentState} | |
back={back} | |
showBack={showBack} | |
parentDispatch={parentDispatch} | |
localeModule={localeModule} | |
pageTag={pageTag} | |
{...props} | |
/> |
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js
around line 473, the call to ImpelComponentWrapper is missing the newly added
parentState prop. Update the invocation of ImpelComponentWrapper to include the
parentState prop by passing the appropriate parentState value from the current
component's state or props. Also, verify any other usages of
ImpelComponentWrapper to ensure they include the parentState prop to avoid
undefined errors downstream.
...odules/campaign-manager/src/pages/employee/appConfigurationRedesign/ImpelComponentWrapper.js
Show resolved
Hide resolved
...dules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js
Outdated
Show resolved
Hide resolved
// function flattenValidationsToField(validationsArray) { | ||
// const result = {}; | ||
|
||
// if (!Array.isArray(validationsArray)) return {}; | ||
|
||
// for (const rule of validationsArray) { | ||
// if (!rule || typeof rule !== "object") continue; | ||
// const { type, value, message } = rule; | ||
|
||
// if (!type || value === undefined || value === null) continue; | ||
|
||
if (!Array.isArray(validationsArray)) return {}; | ||
// result[`toArray.${type}`] = value; | ||
// if (message !== undefined && message !== null) { | ||
// result[`toArray.${type}.message`] = message; | ||
// } | ||
// } | ||
|
||
// return result; | ||
// } |
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.
🧹 Nitpick (assertive)
Delete commented legacy flatten function to reduce noise
The old flattenValidationsToField
block is commented-out and no longer used. Remove it to keep the file lean and avoid future confusion.
-// function flattenValidationsToField(validationsArray) {
-// const result = {};
-// if (!Array.isArray(validationsArray)) return {};
-// for (const rule of validationsArray) {
-// if (!rule || typeof rule !== "object") continue;
-// const { type, value, message } = rule;
-// if (!type || value === undefined || value === null) continue;
-// result[`toArray.${type}`] = value;
-// if (message !== undefined && message !== null) {
-// result[`toArray.${type}.message`] = message;
-// }
-// }
-// return result;
-// }
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
// function flattenValidationsToField(validationsArray) { | |
// const result = {}; | |
// if (!Array.isArray(validationsArray)) return {}; | |
// for (const rule of validationsArray) { | |
// if (!rule || typeof rule !== "object") continue; | |
// const { type, value, message } = rule; | |
// if (!type || value === undefined || value === null) continue; | |
if (!Array.isArray(validationsArray)) return {}; | |
// result[`toArray.${type}`] = value; | |
// if (message !== undefined && message !== null) { | |
// result[`toArray.${type}.message`] = message; | |
// } | |
// } | |
// return result; | |
// } |
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
between lines 115 and 133, remove the entire commented-out legacy function
flattenValidationsToField as it is no longer used. This will reduce code clutter
and prevent confusion in the future.
...ro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
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: 1
🔭 Outside diff range comments (2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js (2)
112-120
: Restrict-selection effect only ever sets true; make it derive from hasUploads and narrow depsCurrently it never resets to false when uploads are cleared and reruns on any sessionData identity change.
-useEffect(() => { - if ( - props?.props?.sessionData?.HCM_CAMPAIGN_UPLOAD_BOUNDARY_DATA?.uploadBoundary?.uploadedFile?.length > 0 || - props?.props?.sessionData?.HCM_CAMPAIGN_UPLOAD_FACILITY_DATA?.uploadFacility?.uploadedFile?.length > 0 || - props?.props?.sessionData?.HCM_CAMPAIGN_UPLOAD_USER_DATA?.uploadUser?.uploadedFile?.length > 0 - ) { - setRestrictSelection(true); - } -}, [props?.props?.sessionData]); +useEffect(() => { + const hasUploads = Boolean( + props?.props?.sessionData?.HCM_CAMPAIGN_UPLOAD_BOUNDARY_DATA?.uploadBoundary?.uploadedFile?.length || + props?.props?.sessionData?.HCM_CAMPAIGN_UPLOAD_FACILITY_DATA?.uploadFacility?.uploadedFile?.length || + props?.props?.sessionData?.HCM_CAMPAIGN_UPLOAD_USER_DATA?.uploadUser?.uploadedFile?.length + ); + setRestrictSelection(hasUploads); +}, [ + props?.props?.sessionData?.HCM_CAMPAIGN_UPLOAD_BOUNDARY_DATA?.uploadBoundary?.uploadedFile?.length, + props?.props?.sessionData?.HCM_CAMPAIGN_UPLOAD_FACILITY_DATA?.uploadFacility?.uploadedFile?.length, + props?.props?.sessionData?.HCM_CAMPAIGN_UPLOAD_USER_DATA?.uploadUser?.uploadedFile?.length, +]);
83-102
: Consolidate redundant onSelect effects in SelectingBoundariesDuplicate.jsAll three of your
onSelect("boundaryType", …)
calls in separateuseEffect
hooks are firing multiple times—once unconditionally, once conditionally, and then up to 5 extra times via the render-loop effect. You can simplify to a single effect that always runs when its dependencies change:• File:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
• Remove the effects at lines ~83–90 (unconditional), ~87–97 (conditional), and ~97–103 (render-loop).
• Add one consolidated effect:- useEffect(() => { - onSelect("boundaryType", { selectedData, boundaryData: boundaryOptions, updateBoundary: !restrictSelection }); - }, [selectedData, boundaryOptions, restrictSelection]); - - useEffect(() => { - if (selectedData?.length > 0 || Object.keys(boundaryOptions || {}).length) { - onSelect("boundaryType", { - selectedData, - boundaryData: boundaryOptions, - updateBoundary: !restrictSelection, - }); - } - }, [selectedData, boundaryOptions, restrictSelection]); - - useEffect(() => { - if (executionCount < 5) { - onSelect("boundaryType", { selectedData, boundaryData: boundaryOptions, updateBoundary: !restrictSelection }); - setExecutionCount((prev) => prev + 1); - } - }); + useEffect(() => { + onSelect("boundaryType", { + selectedData, + boundaryData: boundaryOptions, + updateBoundary: !restrictSelection, + }); + }, [selectedData, boundaryOptions, restrictSelection]);After applying, add a
console.count("boundaryType select")
inside youronSelect
handler to confirm exactly one call per dependency change.
♻️ Duplicate comments (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js (1)
154-176
: Extract endpoint constant and add user-facing error feedback for cancel actionEndpoint literal inside Template reduces maintainability, and users get no feedback on failure. Prior review suggested both.
+ const CANCEL_CAMPAIGN_ENDPOINT = "/project-factory/v1/project-type/cancel-campaign"; const Template = { - url: "/project-factory/v1/project-type/cancel-campaign", + url: CANCEL_CAMPAIGN_ENDPOINT, body: { CampaignDetails: { tenantId: tenantId, campaignId: queryParams?.id, } }, }; @@ onError: (error, result) => { const errorCode = error?.response?.data?.Errors?.[0]?.code; console.error(errorCode); + // Optional user feedback + try { + Digit?.Utils?.toast?.error?.(errorCode || t("COMMON_ERROR")); + } catch (e) { + /* no-op if toast util is unavailable */ + } },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
(4 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.js
⚙️ CodeRabbit Configuration File
check
Files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
🧠 Learnings (6)
📚 Learning: 2024-11-07T07:17:27.636Z
Learnt from: jagankumar-egov
PR: egovernments/DIGIT-Frontend#1763
File: health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/MyCampaign.js:65-75
Timestamp: 2024-11-07T07:17:27.636Z
Learning: In `MyCampaign.js`, when suggesting code improvements for the `onClickRow` function, keep suggestions simple and avoid unnecessary complexity.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2025-07-15T06:49:28.898Z
Learnt from: Hari-egov
PR: egovernments/DIGIT-Frontend#2788
File: micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js:43-74
Timestamp: 2025-07-15T06:49:28.898Z
Learning: In the HRMS module (micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js), the current error handling approach in the `fetchDetailsForSelectedOption` function is considered sufficient by the team. Enhanced error handling with user notifications and fallback behavior is not required for the boundary service API call.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2024-11-14T12:48:23.023Z
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1832
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PopInbox.js:592-594
Timestamp: 2024-11-14T12:48:23.023Z
Learning: In `PopInbox.js`, when integrating the `ConfirmationPopUp` component, error handling for API failures is managed internally within the component, so explicitly passing an `onError` prop is not necessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2024-12-12T05:38:22.901Z
Learnt from: Bhavya-egov
PR: egovernments/DIGIT-Frontend#2013
File: health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/jsonReader.js:24-27
Timestamp: 2024-12-12T05:38:22.901Z
Learning: In the `jsonReader` function within `health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/jsonReader.js`, generic error handling is sufficient, and enhancing error handling with specific error types is not necessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2024-06-10T19:25:42.992Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#698
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanPreview.js:1-1
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The imports in `MicroplanPreview.js` are from different libraries: `egovernments/digit-ui-components` and `egovernments/digit-ui-react-components`.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2024-10-08T20:11:12.539Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#803
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js:300-341
Timestamp: 2024-10-08T20:11:12.539Z
Learning: If the `boundaryDataGeneration` function in `Upload.js` fails, it indicates that there is no data for that campaign, and this is an acceptable outcome. Retrying the operation is unnecessary as it would yield the same result.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
⏰ Context from checks skipped due to timeout of 10000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js (2)
81-81
: API hook usage looks fineThe guarded fetch (enabled: !!campaignNumber) and select transformer are appropriate here.
194-197
: Minor style tweak looks fineThe margin style normalization to "0rem" on the tag container is fine.
@@ -2,7 +2,7 @@ import React, { useState, useMemo, Fragment, useEffect } from "react"; | |||
import { useTranslation } from "react-i18next"; | |||
import { useLocation, useHistory } from "react-router-dom"; | |||
import { Wrapper } from "./SelectingBoundaryComponent"; | |||
import { AlertCard, Stepper, TextBlock, Tag, Card, HeaderComponent, Loader,Chip } from "@egovernments/digit-ui-components"; | |||
import { AlertCard, Stepper, TextBlock, Tag, Card, HeaderComponent, Loader, PopUp, Button, Chip } from "@egovernments/digit-ui-components"; |
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.
CardText used but not imported — will crash at runtime
You render inside PopUp, but it isn’t imported. Either import CardText or replace it with the already-imported TextBlock.
Apply this minimal fix:
-import { AlertCard, Stepper, TextBlock, Tag, Card, HeaderComponent, Loader, PopUp, Button, Chip } from "@egovernments/digit-ui-components";
+import { AlertCard, Stepper, TextBlock, Tag, Card, HeaderComponent, Loader, PopUp, Button, Chip, CardText } from "@egovernments/digit-ui-components";
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
import { AlertCard, Stepper, TextBlock, Tag, Card, HeaderComponent, Loader, PopUp, Button, Chip } from "@egovernments/digit-ui-components"; | |
-import { AlertCard, Stepper, TextBlock, Tag, Card, HeaderComponent, Loader, PopUp, Button, Chip } from "@egovernments/digit-ui-components"; | |
+import { AlertCard, Stepper, TextBlock, Tag, Card, HeaderComponent, Loader, PopUp, Button, Chip, CardText } from "@egovernments/digit-ui-components"; |
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
around line 5, the JSX renders <CardText> but CardText is not imported causing a
runtime crash; replace any <CardText> usage with the already-imported TextBlock
(or alternatively add CardText to the named import list from
"@egovernments/digit-ui-components") so the component reference matches an
imported symbol.
* GIT-2888:: Features/ Prperties Config * Added filter component to support Enums * Removed console logs * GIT-2888 :: Features/properties Config --------- Co-authored-by: nabeelmd-eGov <[email protected]>
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: 4
🔭 Outside diff range comments (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/GenericTemplateScreen.js (1)
94-106
: Fix React key on mapped elements to avoid list reconciliation warningsKey is on Button instead of the returned wrapper div. Move key to the outer div to prevent warnings and ensure stable reconciliation.
- {buttonFields.map((field, index) => ( - <div className={`${selectedField?.jsonPath === field.jsonPath ? "app-preview-field-pair app-preview-selected" : ""}`}> - <Button - key={index} + {buttonFields.map((field, index) => ( + <div + key={field.jsonPath || index} + className={`${selectedField?.jsonPath === field.jsonPath ? "app-preview-field-pair app-preview-selected" : ""}`} + > + <Button variation={field.jsonPath === "SecondaryButton" || field.jsonPath === "scanner" ? "secondary" : "primary"} label={t(field?.label)} onClick={() => { }} style={{ minWidth: "100%" }} icon={field.jsonPath === "scanner" ? "QrCodeScanner" : null} /> </div> ))}
♻️ Duplicate comments (2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DrawerFieldComposer.js (1)
412-422
: Prevent crash when visibilityCondition is undefined (duplicate of prior review, still applicable)Spreading prev.visibilityCondition throws if it’s undefined. Default it to {}.
const handleExpressionChange = (expressionString) => { if (drawerState.visibilityCondition?.expression !== expressionString) { setDrawerState(prev => ({ ...prev, visibilityCondition: { - ...prev.visibilityCondition, + ...(prev.visibilityCondition || {}), expression: expressionString } })); } };health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js (1)
235-241
: Remove unused/invalid propcurrentPage
; DependentFieldsWrapper derives it internallyAs previously noted, passing
currentPage="beneficiaryLocation"
is misleading and unused. The wrapper computescurrentPage
fromscreenConfig
.<DependentFieldsWrapper - currentPage="beneficiaryLocation" t={t} parentState={parentState} onExpressionChange={handleExpressionChange} screenConfig={screenConfig} selectedFieldItem={selectedField} />
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (6)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/FiltersRenderer.js
(1 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/GenericTemplateScreen.js
(2 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DrawerFieldComposer.js
(6 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js
(7 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
(3 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/health-hrms/src/pages/employee/createEmployee.js
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.js
⚙️ CodeRabbit Configuration File
check
Files:
health/micro-ui/web/micro-ui-internals/packages/modules/health-hrms/src/pages/employee/createEmployee.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/GenericTemplateScreen.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/FiltersRenderer.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DrawerFieldComposer.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js
🧠 Learnings (6)
📚 Learning: 2024-11-07T11:02:33.520Z
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1770
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/viewVillage.js:320-322
Timestamp: 2024-11-07T11:02:33.520Z
Learning: In `health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/viewVillage.js`, the `data?.additionalFields` object is guaranteed to be defined, so checking for its existence before accessing its keys is unnecessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/health-hrms/src/pages/employee/createEmployee.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js
📚 Learning: 2024-06-10T19:25:42.992Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#0
File: :0-0
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The `Toast` component's styling is managed internally within the component, ensuring consistency and adaptability across different contexts without the need for additional external styling.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/health-hrms/src/pages/employee/createEmployee.js
📚 Learning: 2025-06-27T05:52:33.156Z
Learnt from: Hari-egov
PR: egovernments/DIGIT-Frontend#2644
File: micro-ui/web/micro-ui-internals/packages/modules/core/src/components/PrivacyComponent.js:0-0
Timestamp: 2025-06-27T05:52:33.156Z
Learning: The PrivacyComponent in `micro-ui/web/micro-ui-internals/packages/modules/core/src/components/PrivacyComponent.js` is mostly used in login and signup pages, especially in formcomposer where the UI is stable, making layout changes less likely to cause regressions.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
📚 Learning: 2024-06-10T19:25:42.992Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#698
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanPreview.js:1-1
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The imports in `MicroplanPreview.js` are from different libraries: `egovernments/digit-ui-components` and `egovernments/digit-ui-react-components`.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
📚 Learning: 2024-06-10T19:25:42.992Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#0
File: :0-0
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The Button component from `egovernments/digit-ui-components` has compatibility issues with the ActionBar, leading to the preference for using the Button from `egovernments/digit-ui-react-components` in certain scenarios.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
📚 Learning: 2024-10-17T11:59:00.327Z
Learnt from: Ramkrishna-egov
PR: egovernments/DIGIT-Frontend#1545
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/ActivityCard.js:1-1
Timestamp: 2024-10-17T11:59:00.327Z
Learning: In `ActivityCard.js`, `React.Fragment` is used in the code.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js
🧬 Code Graph Analysis (5)
health/micro-ui/web/micro-ui-internals/packages/modules/health-hrms/src/pages/employee/createEmployee.js (2)
health/micro-ui/web/micro-ui-internals/packages/modules/health-hrms/src/components/pageComponents/DeactivatePopUp.js (1)
showToast
(13-13)health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PlanInbox.js (1)
showToast
(49-49)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js (2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js (1)
showPopUp
(297-297)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/RenderSelectionField.js (1)
RenderSelectionField
(4-46)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/FiltersRenderer.js (1)
micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/Dropdown.js (1)
Dropdown
(94-281)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DrawerFieldComposer.js (2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js (1)
parentState
(60-60)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DependentFieldsWrapper.js (1)
selectedField
(44-44)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js (5)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DrawerFieldComposer.js (4)
projectType
(84-84)projectType
(394-394)drawerState
(395-397)handleExpressionChange
(412-422)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js (2)
projectType
(56-56)parentState
(60-60)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js (1)
state
(293-293)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/FiltersRenderer.js (1)
FiltersRenderer
(4-95)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DependentFieldsWrapper.js (1)
selectedField
(44-44)
🪛 Biome (2.1.2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
[error] 43-43: Alternative text title element cannot be empty
For accessibility purposes, SVGs should have an alternative text, provided via title element. If the svg element has role="img", you should add the aria-label or aria-labelledby attribute.
(lint/a11y/noSvgWithoutTitle)
[error] 43-43: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event.
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
(lint/a11y/useKeyWithClickEvents)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js
[error] 155-155: Unsafe usage of optional chaining.
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
(lint/correctness/noUnsafeOptionalChaining)
⏰ Context from checks skipped due to timeout of 10000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (6)
health/micro-ui/web/micro-ui-internals/packages/modules/health-hrms/src/pages/employee/createEmployee.js (2)
388-388
: Toast type prop is consistent with error/success usageSetting type based on showToast?.key aligns with existing error flag and will render appropriate variants when success toasts are introduced.
386-395
: Update Toast prop spelling and consistency
- Correct the
isDleteBtn
typo toisDeleteBtn
so the close button renders.- Use optional chaining on
error
for consistency withtype
.Suggested change:
<Toast - type={showToast?.key ? "error" : "success"} - error={showToast.key} - isDleteBtn="true" + type={showToast?.key ? "error" : "success"} + error={showToast?.key} + isDeleteBtn={true} label={t(showToast.label)} onClose={() => setShowToast(null)} />Please confirm this matches the Toast component’s API.
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/GenericTemplateScreen.js (1)
22-27
: Including “scanner” in buttonFields is sensibleTreating the scanner control as a footer button makes sense with the existing Primary/Secondary grouping.
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DrawerFieldComposer.js (2)
169-173
: Prop drilling for conditional renderers looks correctForwarding parentState, handleExpressionChange, screenConfig, and selectedField enables centralized expression management without breaking existing paths.
179-244
: Adding “number” to text input path is appropriateReusing FieldV1 with type “number” alongside “text” maintains consistency and reduces duplication.
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js (1)
222-231
: FiltersRenderer integration looks correctProps mapping matches the component’s expected interface; MDMS-driven enums will land in
drawerState.enums
as intended.
<Dropdown | ||
variant={""} | ||
t={t} | ||
disabled={disabled} | ||
option={cField?.mdmsOptions || []} | ||
optionKey={"schemaCode"} | ||
selected={localSelectedSchema || {}} | ||
select={(value) => { | ||
setLocalSelectedSchema(value); | ||
setLocalActiveOptions([]); // reset active when schema changes | ||
setDrawerState((prev) => ({ ...prev, enums: [] })); // reset enums | ||
}} | ||
/> |
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.
Dropdown uses prop “disable”, not “disabled” — current control won’t disable
The shared Dropdown component checks props.disable, so passing disabled has no effect. Update to disable to ensure the dropdown can be disabled.
- <Dropdown
+ <Dropdown
variant={""}
t={t}
- disabled={disabled}
+ disable={disabled}
option={cField?.mdmsOptions || []}
optionKey={"schemaCode"}
selected={localSelectedSchema || {}}
select={(value) => {
setLocalSelectedSchema(value);
setLocalActiveOptions([]); // reset active when schema changes
setDrawerState((prev) => ({ ...prev, enums: [] })); // reset enums
}}
/>
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
<Dropdown | |
variant={""} | |
t={t} | |
disabled={disabled} | |
option={cField?.mdmsOptions || []} | |
optionKey={"schemaCode"} | |
selected={localSelectedSchema || {}} | |
select={(value) => { | |
setLocalSelectedSchema(value); | |
setLocalActiveOptions([]); // reset active when schema changes | |
setDrawerState((prev) => ({ ...prev, enums: [] })); // reset enums | |
}} | |
/> | |
<Dropdown | |
variant={""} | |
t={t} | |
disable={disabled} | |
option={cField?.mdmsOptions || []} | |
optionKey={"schemaCode"} | |
selected={localSelectedSchema || {}} | |
select={(value) => { | |
setLocalSelectedSchema(value); | |
setLocalActiveOptions([]); // reset active when schema changes | |
setDrawerState((prev) => ({ ...prev, enums: [] })); // reset enums | |
}} | |
/> |
🤖 Prompt for AI Agents
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/FiltersRenderer.js
lines 60-72: the Dropdown is passed disabled={disabled} but the shared component
reads prop disable, so the control never disables; change the prop name to
disable={disabled} (ensuring a boolean) so the Dropdown receives the expected
prop and remains disabled when appropriate, and keep the existing state-reset
logic inside the select callback unchanged.
drawerState?.jsonPath || drawerState?.id | ||
}`, | ||
: `${projectType}_${state?.currentScreen?.parent}_${state?.currentScreen?.name}_${cField.bindTo}_${drawerState?.jsonPath || drawerState?.id | ||
}`, | ||
Digit?.SessionStorage.get("locale") || Digit?.SessionStorage.get("initData")?.selectedLanguage, |
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.
Fix unsafe optional chaining on SessionStorage access to prevent TypeError
Biome is right: Digit?.SessionStorage.get(...)
will throw if Digit?.SessionStorage
is undefined. Chain .get
too.
Apply:
- Digit?.SessionStorage.get("locale") || Digit?.SessionStorage.get("initData")?.selectedLanguage,
+ Digit?.SessionStorage?.get("locale") || Digit?.SessionStorage?.get("initData")?.selectedLanguage,
And:
- Digit?.SessionStorage.get("locale") || Digit?.SessionStorage.get("initData")?.selectedLanguage,
+ Digit?.SessionStorage?.get("locale") || Digit?.SessionStorage?.get("initData")?.selectedLanguage,
Also applies to: 101-101
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js
around lines 56 and 101, the code uses Digit?.SessionStorage.get(...) which will
throw if SessionStorage is undefined; update both occurrences to safely chain
the get method as Digit?.SessionStorage?.get(...) (e.g.,
Digit?.SessionStorage?.get("locale") ||
Digit?.SessionStorage?.get("initData")?.selectedLanguage) so the .get call is
only invoked when SessionStorage exists, and verify the fallback order remains
correct.
code: crypto.randomUUID(), | ||
name: "", | ||
}, | ||
] | ||
: [ | ||
{ | ||
code: crypto.randomUUID(), | ||
name: "", | ||
}, | ||
], | ||
{ | ||
code: crypto.randomUUID(), | ||
name: "", | ||
}, | ||
], |
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.
🧹 Nitpick (assertive)
Avoid relying solely on crypto.randomUUID; add a safe fallback for broader compatibility and SSR
crypto.randomUUID()
isn’t available in all browsers and may be undefined in SSR. Use a small helper with a graceful fallback.
Change usages:
- code: crypto.randomUUID(),
+ code: safeRandomId(),
and
- code: crypto.randomUUID(),
+ code: safeRandomId(),
Add this helper near the top of the file (after imports):
// Prefer native crypto.randomUUID; fallback for older browsers/SSR
const safeRandomId = () =>
(typeof crypto !== "undefined" && typeof crypto.randomUUID === "function")
? crypto.randomUUID()
: `${Date.now()}-${Math.random().toString(16).slice(2)}`;
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js
around lines 157 to 166, the code calls crypto.randomUUID() directly which can
be unavailable in some browsers and SSR; add a small safeRandomId helper after
the imports that prefers crypto.randomUUID but falls back to a timestamp+random
hex string, then replace all direct crypto.randomUUID() usages in this file with
safeRandomId() to ensure broader compatibility and avoid runtime errors in
environments without crypto.randomUUID.
const FilterIcon = (props) => ( | ||
<svg onClick={props?.onClick} width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path d="M0.250666 1.61C2.27067 4.2 6.00067 9 6.00067 9V15C6.00067 15.55 6.45067 16 7.00067 16H9.00067C9.55067 16 10.0007 15.55 10.0007 15V9C10.0007 9 13.7207 4.2 15.7407 1.61C16.2507 0.95 15.7807 0 14.9507 0H1.04067C0.210666 0 -0.259334 0.95 0.250666 1.61Z" fill="#C84C0E" /> | ||
</svg> |
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.
Fix accessibility for clickable SVG (title, keyboard events, semantics)
Static analysis flagged missing title and keyboard support. Make the SVG operable via keyboard and provide accessible name.
-const FilterIcon = (props) => (
- <svg onClick={props?.onClick} width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+const FilterIcon = (props) => (
+ <svg
+ role="button"
+ tabIndex="0"
+ aria-label={props?.ariaLabel || "Filter"}
+ onClick={props?.onClick}
+ onKeyDown={(e) => {
+ if (e.key === "Enter" || e.key === " ") {
+ e.preventDefault();
+ props?.onClick?.(e);
+ }
+ }}
+ width="16"
+ height="16"
+ viewBox="0 0 16 16"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <title>{props?.ariaLabel || "Filter"}</title>
<path d="M0.250666 1.61C2.27067 4.2 6.00067 9 6.00067 9V15C6.00067 15.55 6.45067 16 7.00067 16H9.00067C9.55067 16 10.0007 15.55 10.0007 15V9C10.0007 9 13.7207 4.2 15.7407 1.61C16.2507 0.95 15.7807 0 14.9507 0H1.04067C0.210666 0 -0.259334 0.95 0.250666 1.61Z" fill="#C84C0E" />
</svg>
);
- <FilterIcon onClick={() => setShowPopUp(true)} />
+ <FilterIcon onClick={() => setShowPopUp(true)} ariaLabel={props.t("FILTER")} />
This resolves:
- Missing alternative text/title for SVG
- Keyboard accessibility parity with onClick
Also applies to: 53-55
🧰 Tools
🪛 Biome (2.1.2)
[error] 43-43: Alternative text title element cannot be empty
For accessibility purposes, SVGs should have an alternative text, provided via title element. If the svg element has role="img", you should add the aria-label or aria-labelledby attribute.
(lint/a11y/noSvgWithoutTitle)
[error] 43-43: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event.
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
(lint/a11y/useKeyWithClickEvents)
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
around lines 42-45 (and similarly for 53-55), the SVG lacks an accessible name
and keyboard operability; update the component to accept a title or aria-label
prop, render a <title> inside the SVG using that prop, add role="button" and
tabIndex="0" to make it focusable, and implement an onKeyDown handler that calls
the same onClick handler when Enter or Space is pressed (also forward any
provided aria-label to the SVG for screen readers).
…in reverse restructuring of form config
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
♻️ Duplicate comments (6)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js (2)
42-45
: Fix accessibility for clickable SVG (title, keyboard events, semantics)The SVG is clickable but lacks keyboard support and an accessible name. This violates a11y rules flagged by tooling (noSvgWithoutTitle, useKeyWithClickEvents). Add role, tabIndex, keyboard activation, and a title/aria-label.
Apply this diff:
-const FilterIcon = (props) => ( - <svg onClick={props?.onClick} width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> +const FilterIcon = (props) => ( + <svg + role="button" + tabIndex="0" + aria-label={props?.ariaLabel || "Filter"} + onClick={props?.onClick} + onKeyDown={(e) => { + if (e.key === "Enter" || e.key === " ") { + e.preventDefault(); + props?.onClick?.(e); + } + }} + width="16" + height="16" + viewBox="0 0 16 16" + fill="none" + xmlns="http://www.w3.org/2000/svg" + > + <title>{props?.ariaLabel || "Filter"}</title> <path d="M0.250666 1.61C2.27067 4.2 6.00067 9 6.00067 9V15C6.00067 15.55 6.45067 16 7.00067 16H9.00067C9.55067 16 10.0007 15.55 10.0007 15V9C10.0007 9 13.7207 4.2 15.7407 1.61C16.2507 0.95 15.7807 0 14.9507 0H1.04067C0.210666 0 -0.259334 0.95 0.250666 1.61Z" fill="#C84C0E" /> </svg> )
53-55
: Forward accessible label to FilterIconPass an ariaLabel so the icon has a non-empty title/accessible name.
- <FilterIcon onClick={() => setShowPopUp(true)} /> + <FilterIcon onClick={() => setShowPopUp(true)} ariaLabel={props.t("FILTER")} /> <span className="digit-search-text">{props.t(props.field.label) || "LABEL"}</span>health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js (4)
115-133
: Remove commented legacy functionThe old
flattenValidationsToField
function is commented out and no longer used. Remove it to keep the codebase clean.-// function flattenValidationsToField(validationsArray) { -// const result = {}; -// -// if (!Array.isArray(validationsArray)) return {}; -// -// for (const rule of validationsArray) { -// if (!rule || typeof rule !== "object") continue; -// const { type, value, message } = rule; -// -// if (!type || value === undefined || value === null) continue; - -// result[`toArray.${type}`] = value; -// if (message !== undefined && message !== null) { -// result[`toArray.${type}.message`] = message; -// } -// } -// -// return result; -// }
136-151
: Critical: Validation data will be lost during round-trip operationsThe new
flattenValidationsToField2
function groups validations under a nested key (e.g.,{ validations: { required: true } }
), but thereverseRestructure
function still expects the oldtoArray.*
format. This mismatch will cause validation data to be lost when saving or submitting forms.To fix this, update the
addToArrayFields
function (lines 260-285) to handle the new nested structure:function addToArrayFields(field) { const validationMap = {}; if (!field || typeof field !== "object") return []; + // Handle new nested validation structure + const validationGroup = field.validations || field.validation; + if (validationGroup && typeof validationGroup === "object") { + Object.keys(validationGroup).forEach((key) => { + if (key.endsWith(".message")) return; + const value = validationGroup[key]; + if (value === undefined || value === null) return; + const message = validationGroup[`${key}.message`]; + validationMap[key] = { + type: key, + value, + ...(message !== undefined ? { message } : {}) + }; + }); + } + // Backward compatibility: parse toArray.* keys for (const key in field) { if (!Object.prototype.hasOwnProperty.call(field, key)) continue; if (key.startsWith("toArray.")) { const parts = key.split("."); const type = parts[1]; if (!type) continue; if (!validationMap[type]) validationMap[type] = { type }; if (parts.length === 2) { validationMap[type].value = field[key]; } else if (parts.length === 3 && parts[2] === "message") { validationMap[type].message = field[key]; } } } return Object.values(validationMap).filter((v) => v.value !== undefined && v.value !== null); }
152-163
: Improve robustness and avoid prototype chain iterationThe function should use
Object.entries()
to avoid iterating over the prototype chain, handle empty arrays early, and merge results more safely.function flattenConfigArrays(configObj) { const result = {}; - for (const key in configObj) { - const value = configObj[key]; + for (const [key, value] of Object.entries(configObj)) { + if (!Array.isArray(value) || value.length === 0) continue; // Handle array of {type, value} objects (like validations) - if (Array.isArray(value) && value.every((v) => typeof v === "object" && v.type)) { + const isTypedObjArr = value.every((v) => v && typeof v === "object" && "type" in v); + if (isTypedObjArr) { const flattened = flattenValidationsToField2(value, key); - Object.assign(result, flattened); // Only merged part (e.g., { validations: { ... } }) + // Safe merge per key to prevent overwrites + result[key] = { ...(result[key] || {}), ...(flattened[key] || {}) }; } } - return result; // :white_check_mark: Only changed keys + return result; }
184-186
: Update reverse conversion to handle nested validation groupsThe
restructure
function now usesflattenConfigArrays
which creates nested validation groups, but the reverse path still only handlestoArray.*
keys. This breaks round-trip compatibility.See the fix provided in the comment for lines 136-151 above, which updates
addToArrayFields
to handle both the new nested format and the legacytoArray.*
format.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
(3 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
(3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.js
⚙️ CodeRabbit Configuration File
check
Files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
🧠 Learnings (2)
📚 Learning: 2024-06-10T19:25:42.992Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#698
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanPreview.js:1-1
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The imports in `MicroplanPreview.js` are from different libraries: `egovernments/digit-ui-components` and `egovernments/digit-ui-react-components`.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
📚 Learning: 2024-06-10T19:25:42.992Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#0
File: :0-0
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The Button component from `egovernments/digit-ui-components` has compatibility issues with the ActionBar, leading to the preference for using the Button from `egovernments/digit-ui-react-components` in certain scenarios.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
🧬 Code Graph Analysis (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js (2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js (1)
showPopUp
(297-297)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/RenderSelectionField.js (1)
RenderSelectionField
(4-46)
🪛 Biome (2.1.2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
[error] 43-43: Alternative text title element cannot be empty
For accessibility purposes, SVGs should have an alternative text, provided via title element. If the svg element has role="img", you should add the aria-label or aria-labelledby attribute.
(lint/a11y/noSvgWithoutTitle)
[error] 43-43: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event.
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
(lint/a11y/useKeyWithClickEvents)
⏰ Context from checks skipped due to timeout of 10000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (4)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js (3)
1-2
: Imports update aligns with new Filter popup flowPopUp and React hooks are correctly introduced and used later in the file.
4-4
: RenderSelectionField import is correct and used in Filter popupNo issues found.
332-334
: Early return for Acknowledgement templates is correctThe contains-check makes the renderer resilient to both Beneficiary and Household acknowledgement variants without changing the public API.
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js (1)
315-315
: Good addition for conditional field visibilityAdding
visibilityCondition
to the reverse structure enables proper handling of conditional field visibility in the UI layer.
<FilterIcon onClick={() => setShowPopUp(true)} /> | ||
<span className="digit-search-text">{props.t(props.field.label) || "LABEL"}</span> | ||
|
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.
🧹 Nitpick (assertive)
Defensive access for field label
If Filter is ever rendered without field, accessing props.field.label will throw. Use optional chaining.
- <span className="digit-search-text">{props.t(props.field.label) || "LABEL"}</span>
+ <span className="digit-search-text">{props.t(props?.field?.label) || "LABEL"}</span>
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
<FilterIcon onClick={() => setShowPopUp(true)} /> | |
<span className="digit-search-text">{props.t(props.field.label) || "LABEL"}</span> | |
<FilterIcon onClick={() => setShowPopUp(true)} /> | |
<span className="digit-search-text">{props.t(props?.field?.label) || "LABEL"}</span> |
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
around lines 53 to 55, the code accesses props.field.label directly which will
throw if props.field is undefined; update the access to use optional chaining
(e.g., props.field?.label) when calling the translation function and keep the
existing fallback string so the component safely renders when field is missing.
{showPopUp && ( | ||
<PopUp | ||
className={"custom-popup-filter"} | ||
type={"default"} | ||
heading={props.t("SELECT_FILTER")} | ||
onClose={() => setShowPopUp(false)} | ||
style={{ | ||
width: "100%", // Full width popup | ||
maxWidth: "100%", // Prevents shrinking | ||
height: "auto", | ||
margin: 0, | ||
padding: 0 | ||
}} | ||
footerChildren={[ | ||
]} | ||
sortFooterChildren={true} | ||
> |
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.
🧹 Nitpick (assertive)
Minor cleanup: remove no-op props and inline style comments
- footerChildren is an empty array and sortFooterChildren has no effect without footer content; consider omitting both.
- Inline comments inside style objects add noise; prefer className-based styling aligned with the design system.
Also applies to: 73-81
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
around lines 56-72 (and similarly 73-81), remove the no-op props footerChildren
(empty array) and sortFooterChildren (has no effect without footer content), and
replace the inline style object (including its inline comments) by applying a
className and moving those styles into the component stylesheet or design-system
CSS; keep the PopUp usage otherwise unchanged and ensure the new CSS class
preserves full-width/max-width/height/margin/padding behavior.
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: 6
🔭 Outside diff range comments (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js (1)
261-286
: Fix reverse path to parse nested validations group (prevent data loss)Extend addToArrayFields to also read field.validations (and field.validation) alongside legacy toArray.* keys.
function addToArrayFields(field) { const validationMap = {}; if (!field || typeof field !== "object") return []; - for (const key in field) { + for (const key in field) { if (!Object.prototype.hasOwnProperty.call(field, key)) continue; if (key.startsWith("toArray.")) { //TODO @nabeel @jagan right now key is toArray. but we should have a object called toArray :{ all attributes to be set inside this} const parts = key.split("."); const type = parts[1]; if (!type) continue; if (!validationMap[type]) validationMap[type] = { type }; if (parts.length === 2) { validationMap[type].value = field[key]; } else if (parts.length === 3 && parts[2] === "message") { validationMap[type].message = field[key]; } } } + // New shape: parse nested validations group (backward-compatible) + const group = field.validations || field.validation; + if (group && typeof group === "object") { + Object.keys(group).forEach((k) => { + if (k.endsWith(".message")) return; + const value = group[k]; + if (value === undefined || value === null) return; + const message = group[`${k}.message`]; + if (!validationMap[k]) validationMap[k] = { type: k }; + validationMap[k].value = value; + if (message !== undefined) validationMap[k].message = message; + }); + } + return Object.values(validationMap).filter((v) => v.value !== undefined && v.value !== null); }
♻️ Duplicate comments (5)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js (3)
42-45
: Fix accessibility for clickable SVG (title, keyboard events, semantics) — breaks a11y lintClickable SVG lacks an accessible name and keyboard support (Biome a11y errors). Make it operable via keyboard and provide an accessible label/title.
Apply this diff:
-const FilterIcon = (props) => ( - <svg onClick={props?.onClick} width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> - <path d="M0.250666 1.61C2.27067 4.2 6.00067 9 6.00067 9V15C6.00067 15.55 6.45067 16 7.00067 16H9.00067C9.55067 16 10.0007 15.55 10.0007 15V9C10.0007 9 13.7207 4.2 15.7407 1.61C16.2507 0.95 15.7807 0 14.9507 0H1.04067C0.210666 0 -0.259334 0.95 0.250666 1.61Z" fill="#C84C0E" /> - </svg> -); +const FilterIcon = (props) => ( + <svg + role="button" + tabIndex="0" + aria-label={props?.ariaLabel || "Filter"} + onClick={props?.onClick} + onKeyDown={(e) => { + if (e.key === "Enter" || e.key === " ") { + e.preventDefault(); + props?.onClick?.(e); + } + }} + width="16" + height="16" + viewBox="0 0 16 16" + fill="none" + xmlns="http://www.w3.org/2000/svg" + > + <title>{props?.ariaLabel || "Filter"}</title> + <path d="M0.250666 1.61C2.27067 4.2 6.00067 9 6.00067 9V15C6.00067 15.55 6.45067 16 7.00067 16H9.00067C9.55067 16 10.0007 15.55 10.0007 15V9C10.0007 9 13.7207 4.2 15.7407 1.61C16.2507 0.95 15.7807 0 14.9507 0H1.04067C0.210666 0 -0.259334 0.95 0.250666 1.61Z" fill="#C84C0E" /> + </svg> +);
53-55
: Defensive access for field label and provide ariaLabel to FilterIconPrevent a potential crash when field is undefined, and wire an accessible name to the icon.
Apply this diff:
- <FilterIcon onClick={() => setShowPopUp(true)} /> - <span className="digit-search-text" style={{color: "#C84C0E"}}>{props.t(props.field.label) || "LABEL"}</span> + <FilterIcon onClick={() => setShowPopUp(true)} ariaLabel={props.t("FILTER")} /> + <span className="digit-search-text" style={{ color: "#C84C0E" }}> + {props.t(props?.field?.label) || "LABEL"} + </span>
56-72
: Remove no-op PopUp props and inline style comments (keep styles or move to CSS)footerChildren (empty) and sortFooterChildren do nothing here. Inline comments inside style objects add noise. Clean these up.
Apply these diffs:
- <PopUp + <PopUp className={"custom-popup-filter"} type={"default"} heading={props.t("SELECT_FILTER")} onClose={() => setShowPopUp(false)} style={{ - width: "100%", // Full width popup - maxWidth: "100%", // Prevents shrinking + width: "100%", + maxWidth: "100%", height: "auto", margin: 0, padding: 0 }} - footerChildren={[ - ]} - sortFooterChildren={true} >- <div style={{ - width: "100%", // Take full popup width - padding: "1rem", - boxSizing: "border-box" - }}> + <div style={{ width: "100%", padding: "1rem", boxSizing: "border-box" }}>Optional: move these styles to a CSS class (e.g., add "full-width-popup" to className) and drop the inline style entirely.
Also applies to: 73-77
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js (2)
115-133
: Delete commented-out legacy function to reduce noiseThis legacy block is no longer used. Keeping it commented invites confusion and merge conflicts.
-// function flattenValidationsToField(validationsArray) { -// const result = {}; -// -// if (!Array.isArray(validationsArray)) return {}; -// -// for (const rule of validationsArray) { -// if (!rule || typeof rule !== "object") continue; -// const { type, value, message } = rule; -// -// if (!type || value === undefined || value === null) continue; -// result[`toArray.${type}`] = value; -// if (message !== undefined && message !== null) { -// result[`toArray.${type}.message`] = message; -// } -// } -// -// return result; -// }
152-163
: Harden flattener: avoid for..in, skip empty arrays, and safely merge per-keyThis makes the helper safer (no prototype iteration), avoids work on empty arrays, and prevents accidental overwrites.
-function flattenConfigArrays(configObj) { - const result = {}; - for (const key in configObj) { - const value = configObj[key]; - // Handle array of {type, value} objects (like validations) - if (Array.isArray(value) && value.every((v) => typeof v === "object" && v.type)) { - const flattened = flattenValidationsToField2(value, key); - Object.assign(result, flattened); // Only merged part (e.g., { validations: { ... } }) - } - } - return result; // :white_check_mark: Only changed keys -} +function flattenConfigArrays(configObj) { + const result = {}; + for (const [key, value] of Object.entries(configObj || {})) { + if (!Array.isArray(value) || value.length === 0) continue; + const isTypedObjArr = value.every((v) => v && typeof v === "object" && "type" in v); + if (!isTypedObjArr) continue; + const flattened = flattenValidationsToField2(value, key); // { [key]: {...} } + result[key] = { ...(result[key] || {}), ...(flattened[key] || {}) }; + } + return result; +}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
(4 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
(7 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.js
⚙️ CodeRabbit Configuration File
check
Files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
🧠 Learnings (3)
📚 Learning: 2025-06-27T05:52:33.156Z
Learnt from: Hari-egov
PR: egovernments/DIGIT-Frontend#2644
File: micro-ui/web/micro-ui-internals/packages/modules/core/src/components/PrivacyComponent.js:0-0
Timestamp: 2025-06-27T05:52:33.156Z
Learning: The PrivacyComponent in `micro-ui/web/micro-ui-internals/packages/modules/core/src/components/PrivacyComponent.js` is mostly used in login and signup pages, especially in formcomposer where the UI is stable, making layout changes less likely to cause regressions.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
📚 Learning: 2024-06-10T19:25:42.992Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#698
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanPreview.js:1-1
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The imports in `MicroplanPreview.js` are from different libraries: `egovernments/digit-ui-components` and `egovernments/digit-ui-react-components`.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
📚 Learning: 2024-06-10T19:25:42.992Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#0
File: :0-0
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The Button component from `egovernments/digit-ui-components` has compatibility issues with the ActionBar, leading to the preference for using the Button from `egovernments/digit-ui-react-components` in certain scenarios.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
🧬 Code Graph Analysis (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js (2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js (1)
showPopUp
(297-297)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/RenderSelectionField.js (1)
RenderSelectionField
(4-46)
🪛 Biome (2.1.2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
[error] 43-43: Alternative text title element cannot be empty
For accessibility purposes, SVGs should have an alternative text, provided via title element. If the svg element has role="img", you should add the aria-label or aria-labelledby attribute.
(lint/a11y/noSvgWithoutTitle)
[error] 43-43: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event.
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
(lint/a11y/useKeyWithClickEvents)
⏰ Context from checks skipped due to timeout of 10000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Build application arm64
- GitHub Check: Build application amd64
🔇 Additional comments (4)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js (3)
1-4
: Imports expansion looks appropriateNew imports (PopUp, SVG, RenderSelectionField, useState) align with the new popup-based Filter UX and are used in this file.
341-343
: New mapping for complaintInbox looks goodSimpleSearchFilterRow is appropriately returned for complaintInbox.
334-336
: ConstrainAcknowledgement
match to suffix and guardtemplateName
To avoid matching unrelated names, update the check in
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
(lines 334–336):- if (templateName?.includes('Acknowledgement')) { + if (typeof templateName === "string" && /Acknowledgement$/i.test(templateName)) { return responsePanelComponent; }• Location: RegistrationComponents.js:334–336
• Please confirm that every acknowledgement template currently passed intogetTemplateRenderer
ends with “Acknowledgement” so this stricter check doesn’t skip any valid cases.health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js (1)
212-212
: LGTM: visibilityCondition surfaced in forward structureExposing visibilityCondition on the forward path makes sense for the new conditional rendering. Ensure reverse uses the same sentinel (null vs {}), see below.
function flattenValidationsToField2(validationsArray, groupKey = "validation") { | ||
const result = {}; | ||
if (!Array.isArray(validationsArray)) return result; | ||
for (const rule of validationsArray) { | ||
if (!rule || typeof rule !== "object") continue; | ||
const { type, value, message } = rule; | ||
|
||
if (!type || value === undefined || value === null) continue; | ||
|
||
result[`toArray.${type}`] = value; | ||
if (!result[groupKey]) result[groupKey] = {}; | ||
result[groupKey][type] = value; | ||
if (message !== undefined && message !== null) { | ||
result[`toArray.${type}.message`] = message; | ||
result[groupKey][`${type}.message`] = message; | ||
} | ||
} | ||
|
||
return result; | ||
} |
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.
🧹 Nitpick (assertive)
Default group key should be plural to match usage
Use "validations" as the default to avoid introducing a stray "validation" group if the helper is ever called without an explicit key.
-function flattenValidationsToField2(validationsArray, groupKey = "validation") {
+function flattenValidationsToField2(validationsArray, groupKey = "validations") {
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
function flattenValidationsToField2(validationsArray, groupKey = "validation") { | |
const result = {}; | |
if (!Array.isArray(validationsArray)) return result; | |
for (const rule of validationsArray) { | |
if (!rule || typeof rule !== "object") continue; | |
const { type, value, message } = rule; | |
if (!type || value === undefined || value === null) continue; | |
result[`toArray.${type}`] = value; | |
if (!result[groupKey]) result[groupKey] = {}; | |
result[groupKey][type] = value; | |
if (message !== undefined && message !== null) { | |
result[`toArray.${type}.message`] = message; | |
result[groupKey][`${type}.message`] = message; | |
} | |
} | |
return result; | |
} | |
function flattenValidationsToField2(validationsArray, groupKey = "validations") { | |
const result = {}; | |
if (!Array.isArray(validationsArray)) return result; | |
for (const rule of validationsArray) { | |
if (!rule || typeof rule !== "object") continue; | |
const { type, value, message } = rule; | |
if (!type || value === undefined || value === null) continue; | |
if (!result[groupKey]) result[groupKey] = {}; | |
result[groupKey][type] = value; | |
if (message !== undefined && message !== null) { | |
result[groupKey][`${type}.message`] = message; | |
} | |
} | |
return result; | |
} |
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
around lines 136-151, change the default parameter value from "validation" to
"validations" (groupKey = "validations") so the helper emits the plural group by
default; update any callers or tests that assume the old default "validation" to
use "validations" or pass an explicit key, then run unit tests to verify no
regressions.
@@ -281,6 +313,7 @@ | |||
enums: field?.dropDownOptions, | |||
validations: toArrayFields, | |||
helpText: typeof field?.helpText === "string" ? field.helpText : "", | |||
visibilityCondition: field?.visibilityCondition || {}, |
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.
🧹 Nitpick (assertive)
Unify visibilityCondition default (use null to match forward path)
Forward adds visibilityCondition: null (Line 212), but reverse emits {} which is truthy and may trigger conditional logic unexpectedly. Align to null for symmetry and safer checks.
- visibilityCondition: field?.visibilityCondition || {},
+ visibilityCondition: field?.visibilityCondition || null,
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
visibilityCondition: field?.visibilityCondition || {}, | |
visibilityCondition: field?.visibilityCondition || null, |
🤖 Prompt for AI Agents
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
lines 316-316: the code currently defaults visibilityCondition to an empty
object which is truthy and can trigger downstream conditionals; change the
default to null to match the forward path by replacing the fallback value (empty
object) with null and use a null-coalescing style fallback so that when
field.visibilityCondition is absent it becomes null rather than {}.
display: "flex", alignItems: "center", minWidth: "100vh", paddingBottom: "1rem" | ||
}} |
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.
🛠️ Refactor suggestion
Avoid horizontal overflow: don’t use minWidth: 100vh
100vh ties width to viewport height and commonly causes horizontal overflow. Use width: "100%" (or remove the constraint) instead.
Apply this diff:
- display: "flex", alignItems: "center", minWidth: "100vh", paddingBottom: "1rem"
+ display: "flex", alignItems: "center", width: "100%", paddingBottom: "1rem"
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
display: "flex", alignItems: "center", minWidth: "100vh", paddingBottom: "1rem" | |
}} | |
display: "flex", alignItems: "center", width: "100%", paddingBottom: "1rem" |
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
around lines 192 to 193, the style uses minWidth: "100vh" which ties width to
viewport height and can produce horizontal overflow; replace minWidth: "100vh"
with width: "100%" (or remove the constraint) so the container respects viewport
width and prevents horizontal scrolling, keeping the rest of the style
properties unchanged.
{detailsCard?.hidden != true && <DetailsCardSection t={t} field={detailsCard} />} | ||
|
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.
🧹 Nitpick (assertive)
Avoid loose inequality for hidden check
Use strict inequality or a boolean negation to avoid type coercion pitfalls.
Apply this diff:
- {detailsCard?.hidden != true && <DetailsCardSection t={t} field={detailsCard} />}
+ {detailsCard?.hidden !== true && <DetailsCardSection t={t} field={detailsCard} />}
Alternatively:
- {detailsCard?.hidden != true && <DetailsCardSection t={t} field={detailsCard} />}
+ {!detailsCard?.hidden && <DetailsCardSection t={t} field={detailsCard} />}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
{detailsCard?.hidden != true && <DetailsCardSection t={t} field={detailsCard} />} | |
{detailsCard?.hidden !== true && <DetailsCardSection t={t} field={detailsCard} />} |
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
around lines 396-397, the conditional uses loose inequality (detailsCard?.hidden
!= true); replace it with a strict check or boolean negation to avoid type
coercion — e.g., use detailsCard?.hidden !== true or !detailsCard?.hidden in the
JSX conditional so the hidden state is evaluated reliably.
|
||
/** | ||
* SimpleSearchFilterRow | ||
* A minimal row with: [ Search icon + label ] | [ Filter ] | [ Sort icon ] | ||
* | ||
* Uses your existing <Filter />, <SVG.Search />, and <SVG.Sort /> components. | ||
*/ | ||
const SimpleSearchFilterRow = ({ | ||
components = [], t | ||
// t, | ||
// label = "Search", | ||
// primaryColor = "currentColor", | ||
// size = "20px", | ||
// onSearchClick, | ||
// onSortClick, | ||
// // Pass anything your <Filter /> needs via this prop | ||
// filterProps = {}, | ||
}) => { | ||
const formatMap = {}; | ||
components.forEach((item) => { | ||
formatMap[item.jsonPath] = item; | ||
}); | ||
|
||
const searchIcon = formatMap["searchComplaints"] || { label: "", hidden: true }; | ||
const filter = formatMap["filter"] || {}; | ||
const sortIcon = formatMap["sortComplaints"] || {}; | ||
|
||
const cellStyle = { | ||
minWidth: 0, | ||
display: "flex", | ||
alignItems: "center", | ||
gap: "0.375rem", // tighter gap between icon and label | ||
color: "inherit", | ||
}; | ||
|
||
return ( | ||
<div | ||
style={{ | ||
display: "grid", | ||
gridTemplateColumns: "repeat(3, minmax(0, 1fr))", // equal widths | ||
columnGap: "0.5rem", // smaller overall gap | ||
rowGap: "0.5rem", | ||
alignItems: "center", | ||
width: "100%" //allow responsive wrap | ||
}} | ||
> | ||
{/* Left: Search icon + label */} | ||
<div | ||
style={cellStyle} | ||
> | ||
{/* Use currentColor so it won't disappear on white backgrounds */} | ||
<SVG.Search width={"20px"} height={"20px"} fill={"#C84C0E"} /> | ||
<span style={{ whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", color: "#C84C0E" }}> | ||
{t?.(searchIcon?.label || "")} | ||
</span> | ||
</div> | ||
|
||
{/* Middle: Filter (full-width inside its cell) */} | ||
<div style={{ minWidth: 0 }}> | ||
<div style={{ width: "100%" }}> | ||
<Filter field={filter} t={t} /> | ||
</div> | ||
</div> | ||
|
||
{/* Right: Sort icon + label (optional) */} | ||
<div | ||
style={cellStyle} | ||
> | ||
<SVG.ArrowDownward width={"20px"} height={"20px"} fill={"#C84C0E"} /> | ||
{sortIcon?.label ? ( | ||
<span style={{ whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" , color: "#C84C0E"}}> | ||
{t?.(sortIcon?.label || "")} | ||
</span> | ||
) : null} | ||
</div> | ||
</div> | ||
); | ||
} |
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.
🧹 Nitpick (assertive)
Overall LGTM; minor a11y polish for decorative icons
SimpleSearchFilterRow structure is clean. Consider hiding purely decorative SVGs from screen readers.
Apply this diff:
- <SVG.Search width={"20px"} height={"20px"} fill={"#C84C0E"} />
+ <SVG.Search width={"20px"} height={"20px"} fill={"#C84C0E"} aria-hidden={true} focusable="false" />
- <SVG.ArrowDownward width={"20px"} height={"20px"} fill={"#C84C0E"} />
+ <SVG.ArrowDownward width={"20px"} height={"20px"} fill={"#C84C0E"} aria-hidden={true} focusable="false" />
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
/** | |
* SimpleSearchFilterRow | |
* A minimal row with: [ Search icon + label ] | [ Filter ] | [ Sort icon ] | |
* | |
* Uses your existing <Filter />, <SVG.Search />, and <SVG.Sort /> components. | |
*/ | |
const SimpleSearchFilterRow = ({ | |
components = [], t | |
// t, | |
// label = "Search", | |
// primaryColor = "currentColor", | |
// size = "20px", | |
// onSearchClick, | |
// onSortClick, | |
// // Pass anything your <Filter /> needs via this prop | |
// filterProps = {}, | |
}) => { | |
const formatMap = {}; | |
components.forEach((item) => { | |
formatMap[item.jsonPath] = item; | |
}); | |
const searchIcon = formatMap["searchComplaints"] || { label: "", hidden: true }; | |
const filter = formatMap["filter"] || {}; | |
const sortIcon = formatMap["sortComplaints"] || {}; | |
const cellStyle = { | |
minWidth: 0, | |
display: "flex", | |
alignItems: "center", | |
gap: "0.375rem", // tighter gap between icon and label | |
color: "inherit", | |
}; | |
return ( | |
<div | |
style={{ | |
display: "grid", | |
gridTemplateColumns: "repeat(3, minmax(0, 1fr))", // equal widths | |
columnGap: "0.5rem", // smaller overall gap | |
rowGap: "0.5rem", | |
alignItems: "center", | |
width: "100%" //allow responsive wrap | |
}} | |
> | |
{/* Left: Search icon + label */} | |
<div | |
style={cellStyle} | |
> | |
{/* Use currentColor so it won't disappear on white backgrounds */} | |
<SVG.Search width={"20px"} height={"20px"} fill={"#C84C0E"} /> | |
<span style={{ whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", color: "#C84C0E" }}> | |
{t?.(searchIcon?.label || "")} | |
</span> | |
</div> | |
{/* Middle: Filter (full-width inside its cell) */} | |
<div style={{ minWidth: 0 }}> | |
<div style={{ width: "100%" }}> | |
<Filter field={filter} t={t} /> | |
</div> | |
</div> | |
{/* Right: Sort icon + label (optional) */} | |
<div | |
style={cellStyle} | |
> | |
<SVG.ArrowDownward width={"20px"} height={"20px"} fill={"#C84C0E"} /> | |
{sortIcon?.label ? ( | |
<span style={{ whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" , color: "#C84C0E"}}> | |
{t?.(sortIcon?.label || "")} | |
</span> | |
) : null} | |
</div> | |
</div> | |
); | |
} | |
{/* Use currentColor so it won't disappear on white backgrounds */} | |
<SVG.Search | |
width={"20px"} | |
height={"20px"} | |
fill={"#C84C0E"} | |
aria-hidden={true} | |
focusable="false" | |
/> | |
{/* Right: Sort icon + label (optional) */} | |
<SVG.ArrowDownward | |
width={"20px"} | |
height={"20px"} | |
fill={"#C84C0E"} | |
aria-hidden={true} | |
focusable="false" | |
/> |
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
around lines 609-686, the SVG icons are currently exposed to assistive tech even
though they are decorative; update the JSX where SVG.Search and
SVG.ArrowDownward are rendered to mark them as decorative by passing
accessibility props (e.g., aria-hidden="true" and focusable="false") so screen
readers ignore them, and ensure visible textual labels remain accessible (do not
hide the span text).
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: 1
♻️ Duplicate comments (6)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js (6)
42-45
: Fix accessibility and keyboard support for clickable SVG FilterIconBiome flags missing accessible name and missing keyboard handler for the clickable SVG. Make it operable via keyboard and expose an accessible name.
Apply this diff:
-const FilterIcon = (props) => ( - <svg onClick={props?.onClick} width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> +const FilterIcon = (props) => ( + <svg + role="button" + tabIndex="0" + aria-label={props?.ariaLabel || "Filter"} + onClick={props?.onClick} + onKeyDown={(e) => { + if (e.key === "Enter" || e.key === " ") { + e.preventDefault(); + props?.onClick?.(e); + } + }} + width="16" + height="16" + viewBox="0 0 16 16" + fill="none" + xmlns="http://www.w3.org/2000/svg" + > + <title>{props?.ariaLabel || "Filter"}</title> <path d="M0.250666 1.61C2.27067 4.2 6.00067 9 6.00067 9V15C6.00067 15.55 6.45067 16 7.00067 16H9.00067C9.55067 16 10.0007 15.55 10.0007 15V9C10.0007 9 13.7207 4.2 15.7407 1.61C16.2507 0.95 15.7807 0 14.9507 0H1.04067C0.210666 0 -0.259334 0.95 0.250666 1.61Z" fill="#C84C0E" /> </svg> );
53-55
: Make Filter label access safe; pass translated aria-label to FilterIconAvoid potential crash if field is undefined and provide an accessible name to the icon.
- <FilterIcon onClick={() => setShowPopUp(true)} /> - <span className="digit-search-text" style={{color: "#C84C0E"}}>{props.t(props.field.label) || "LABEL"}</span> + <FilterIcon onClick={() => setShowPopUp(true)} ariaLabel={props.t("FILTER")} /> + <span className="digit-search-text" style={{ color: "#C84C0E" }}> + {props.t(props?.field?.label) || "LABEL"} + </span>
56-72
: Remove no-op props and clean inline style comments in PopUpEmpty footerChildren and sortFooterChildren add noise; inline comment clutter in style is unnecessary.
<PopUp className={"custom-popup-filter"} type={"default"} heading={props.t("SELECT_FILTER")} onClose={() => setShowPopUp(false)} - style={{ - width: "100%", // Full width popup - maxWidth: "100%", // Prevents shrinking - height: "auto", - margin: 0, - padding: 0 - }} - footerChildren={[ - ]} - sortFooterChildren={true} + style={{ width: "100%", maxWidth: "100%", height: "auto", margin: 0, padding: 0 }} >
192-193
: Avoid horizontal overflow: replace minWidth: 100vh with width: 100%100vh ties width to viewport height and can cause horizontal scroll.
- display: "flex", alignItems: "center", minWidth: "100vh", paddingBottom: "1rem" + display: "flex", alignItems: "center", width: "100%", paddingBottom: "1rem"
396-396
: Use strict hidden check (or boolean negation) to avoid coercion pitfallsReplace loose inequality with strict comparison or boolean negation.
- {detailsCard?.hidden != true && <DetailsCardSection t={t} field={detailsCard} />} + {!detailsCard?.hidden && <DetailsCardSection t={t} field={detailsCard} />}
661-661
: Hide decorative SVGs from assistive techMark non-interactive icons as decorative.
- <SVG.Search width={"20px"} height={"20px"} fill={"#C84C0E"} /> + <SVG.Search width={"20px"} height={"20px"} fill={"#C84C0E"} aria-hidden={true} focusable="false" />- <SVG.ArrowDownward width={"20px"} height={"20px"} fill={"#C84C0E"} /> + <SVG.ArrowDownward width={"20px"} height={"20px"} fill={"#C84C0E"} aria-hidden={true} focusable="false" />Also applies to: 678-678
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
(7 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.js
⚙️ CodeRabbit Configuration File
check
Files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
🧠 Learnings (3)
📚 Learning: 2025-06-27T05:52:33.156Z
Learnt from: Hari-egov
PR: egovernments/DIGIT-Frontend#2644
File: micro-ui/web/micro-ui-internals/packages/modules/core/src/components/PrivacyComponent.js:0-0
Timestamp: 2025-06-27T05:52:33.156Z
Learning: The PrivacyComponent in `micro-ui/web/micro-ui-internals/packages/modules/core/src/components/PrivacyComponent.js` is mostly used in login and signup pages, especially in formcomposer where the UI is stable, making layout changes less likely to cause regressions.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
📚 Learning: 2024-06-10T19:25:42.992Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#698
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanPreview.js:1-1
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The imports in `MicroplanPreview.js` are from different libraries: `egovernments/digit-ui-components` and `egovernments/digit-ui-react-components`.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
📚 Learning: 2024-06-10T19:25:42.992Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#0
File: :0-0
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The Button component from `egovernments/digit-ui-components` has compatibility issues with the ActionBar, leading to the preference for using the Button from `egovernments/digit-ui-react-components` in certain scenarios.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
🧬 Code Graph Analysis (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js (2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js (1)
showPopUp
(297-297)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/RenderSelectionField.js (1)
RenderSelectionField
(4-46)
🪛 Biome (2.1.2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
[error] 43-43: Alternative text title element cannot be empty
For accessibility purposes, SVGs should have an alternative text, provided via title element. If the svg element has role="img", you should add the aria-label or aria-labelledby attribute.
(lint/a11y/noSvgWithoutTitle)
[error] 43-43: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event.
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
(lint/a11y/useKeyWithClickEvents)
⏰ Context from checks skipped due to timeout of 10000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Build application arm64
- GitHub Check: Build application amd64
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js (2)
1-2
: Imports look correct and minimal; all symbols are usedThe added imports (PopUp, SVG, useState, RenderSelectionField) are used appropriately in this file.
Also applies to: 4-4
334-336
: Early Acknowledgement short-circuit and ComplaintsInbox mapping look goodThe short-circuit preserves existing Acknowledgement rendering, and mapping ComplaintsInbox to SimpleSearchFilterRow wires the new UI correctly.
Also applies to: 341-343
<div | ||
style={cellStyle} | ||
> | ||
{/* Use currentColor so it won't disappear on white backgrounds */} | ||
<SVG.Search width={"20px"} height={"20px"} fill={"#C84C0E"} /> | ||
<span style={{ whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", color: "#C84C0E" }}> | ||
{t?.(searchIcon?.label || "")} | ||
</span> | ||
</div> |
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.
🧹 Nitpick (assertive)
Conditionally render label span to avoid empty, focusable text nodes
Avoid rendering an empty span when no label is provided.
- <span style={{ whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", color: "#C84C0E" }}>
- {t?.(searchIcon?.label || "")}
- </span>
+ {!!searchIcon?.label && (
+ <span style={{ whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", color: "#C84C0E" }}>
+ {t?.(searchIcon?.label)}
+ </span>
+ )}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
<div | |
style={cellStyle} | |
> | |
{/* Use currentColor so it won't disappear on white backgrounds */} | |
<SVG.Search width={"20px"} height={"20px"} fill={"#C84C0E"} /> | |
<span style={{ whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", color: "#C84C0E" }}> | |
{t?.(searchIcon?.label || "")} | |
</span> | |
</div> | |
<div | |
style={cellStyle} | |
> | |
{/* Use currentColor so it won't disappear on white backgrounds */} | |
<SVG.Search width={"20px"} height={"20px"} fill={"#C84C0E"} /> | |
{!!searchIcon?.label && ( | |
<span style={{ whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", color: "#C84C0E" }}> | |
{t?.(searchIcon?.label)} | |
</span> | |
)} | |
</div> |
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
around lines 657-665, the code always renders an empty span when no label
exists; compute the translated label first (e.g. const label =
t?.(searchIcon?.label || "") ), check label.trim() (or a simple truthy check)
and only render the <span> when that label is non-empty so no empty, focusable
text node is created.
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: 3
🔭 Outside diff range comments (3)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js (3)
220-221
: Avoid directcrypto.randomUUID()
dependencyThis may break in environments without the Web Crypto API or with polyfills disabled. Either import a UUID helper, or guard the call with a fallback.
Example guard (outside this range):
const safeRandomUUID = (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") ? () => crypto.randomUUID() : () => `hdr_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`; // ... header: safeRandomUUID(),
290-310
:hidden
is set twice; first assignment is dead codeLine 301 sets
hidden: false
and is immediately overridden by Line 303. Remove the first assignment to avoid confusion.Outside this range, replace the object spread block as below:
// Remove this line // hidden: false, // Keep this hidden: field?.hidden || false,
165-176
: Dead code:addValidationArrayToConfig
is unusedThis helper isn’t referenced. Remove it to reduce maintenance surface.
♻️ Duplicate comments (5)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js (5)
115-133
: Delete commented legacy helper to reduce noiseThis legacy
flattenValidationsToField
block is commented out and unused. Remove it to keep the file lean and reduce future confusion.-// function flattenValidationsToField(validationsArray) { -// const result = {}; -// -// if (!Array.isArray(validationsArray)) return {}; -// -// for (const rule of validationsArray) { -// if (!rule || typeof rule !== "object") continue; -// const { type, value, message } = rule; -// -// if (!type || value === undefined || value === null) continue; -// result[`toArray.${type}`] = value; -// if (message !== undefined && message !== null) { -// result[`toArray.${type}.message`] = message; -// } -// } -// -// return result; -// }
136-151
: Default group key should be plural ("validations")Use "validations" by default to avoid accidentally creating a singular "validation" bucket when a caller omits the explicit key.
-function flattenValidationsToField2(validationsArray, groupKey = "validation") { +function flattenValidationsToField2(validationsArray, groupKey = "validations") {Optional: consider structuring messages as nested objects (e.g.,
validations: { pattern: { value, message } }
) instead of keys with dots ("pattern.message"
), which are harder to work with and easy to mis-handle in consumers. This would be a broader refactor across producers/consumers.
152-163
: HardenflattenConfigArrays
: avoid prototype iteration, null-safety, and safe per-key merges
- Avoid
for..in
to skip prototype keys.- Guard against
null
items; currenttypeof v === "object" && v.type
will throw fornull
.- Merge per key to avoid accidental overwrites on repeated calls.
-function flattenConfigArrays(configObj) { - const result = {}; - for (const key in configObj) { - const value = configObj[key]; - // Handle array of {type, value} objects (like validations) - if (Array.isArray(value) && value.every((v) => typeof v === "object" && v.type)) { - const flattened = flattenValidationsToField2(value, key); - Object.assign(result, flattened); // Only merged part (e.g., { validations: { ... } }) - } - } - return result; // :white_check_mark: Only changed keys -} +function flattenConfigArrays(configObj) { + const result = {}; + for (const [key, value] of Object.entries(configObj)) { + if (!Array.isArray(value) || value.length === 0) continue; + const isTypedObjArr = value.every((v) => v && typeof v === "object" && "type" in v); + if (!isTypedObjArr) continue; + const flattened = flattenValidationsToField2(value, key); // { [key]: {...} } + // Safe merge per key + result[key] = { ...(result[key] || {}), ...(flattened[key] || {}) }; + } + return result; +}
212-214
: Use null for visibilityCondition default; avoid truthy {} pitfallsAn empty object is truthy and can trigger conditional logic. Default to null and use nullish coalescing for robustness.
- visibilityCondition: field?.visibilityCondition || {}, - autoFillCondition: field?.autoFillCondition || [], + visibilityCondition: field?.visibilityCondition ?? null, + autoFillCondition: field?.autoFillCondition ?? [],
318-320
: Mirror forward defaults: set visibilityCondition to null and use nullish coalescingKeep symmetry with the forward path and avoid truthy defaults.
- visibilityCondition: field?.visibilityCondition || {}, - autoFillCondition: field?.autoFillCondition || [], + visibilityCondition: field?.visibilityCondition ?? null, + autoFillCondition: field?.autoFillCondition ?? [],
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
(6 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.js
⚙️ CodeRabbit Configuration File
check
Files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
🧠 Learnings (1)
📚 Learning: 2024-11-07T11:02:33.520Z
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1770
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/viewVillage.js:320-322
Timestamp: 2024-11-07T11:02:33.520Z
Learning: In `health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/viewVillage.js`, the `data?.additionalFields` object is guaranteed to be defined, so checking for its existence before accessing its keys is unnecessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
🧬 Code Graph Analysis (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DrawerFieldComposer.js (2)
type
(248-248)page
(48-48)
⏰ Context from checks skipped due to timeout of 10000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Build application arm64
- GitHub Check: Build application amd64
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js (1)
332-333
: Confirm intended default forconditionalNavigateTo
Reverse defaults to
{}
. After updating forward to use|| {}
(Line 258), the shapes are consistent. If consumers rely on null-sentinel semantics, consider standardizing tonull
in both directions.Would you like me to run a repo-wide scan to inspect consumers of
conditionalNavigateTo
andvisibilityCondition
for truthiness checks vs explicit null checks?
|
||
// / new function for scale up |
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.
🧹 Nitpick (assertive)
Fix comment typo
Nit: stray slash in comment.
-// / new function for scale up
+// New function for scale up
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
// / new function for scale up | |
// New function for scale up |
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
around line 135, there is a comment that contains a stray slash ("// / new
function for scale up"); remove the extra slash so the comment reads cleanly
(e.g., "// new function for scale up") to fix the typo and keep comment style
consistent.
conditionalNavigateTo: page?.conditionalNavigateTo, | ||
parent: parent?.name || "", |
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.
🧹 Nitpick (assertive)
Align conditionalNavigateTo
default with reverse path
Forward currently leaves it possibly undefined, while reverse defaults to {}
. Pick one; recommending {}
for stable shape.
- conditionalNavigateTo: page?.conditionalNavigateTo,
+ conditionalNavigateTo: page?.conditionalNavigateTo || {},
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
conditionalNavigateTo: page?.conditionalNavigateTo, | |
parent: parent?.name || "", | |
conditionalNavigateTo: page?.conditionalNavigateTo || {}, | |
parent: parent?.name || "", |
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
around lines 257-258, conditionalNavigateTo is set to
page?.conditionalNavigateTo which can be undefined while the reverse path
defaults to an empty object; change the assignment so it falls back to an empty
object when undefined (use a fallback expression such as logical OR or nullish
coalescing) so conditionalNavigateTo always has a stable {} shape.
…instead of object
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: 1
♻️ Duplicate comments (8)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js (8)
115-133
: Delete commented legacy flatten functionThis legacy block is commented-out and no longer used. Remove it to reduce noise and avoid future confusion.
-// function flattenValidationsToField(validationsArray) { -// const result = {}; -// -// if (!Array.isArray(validationsArray)) return {}; -// -// for (const rule of validationsArray) { -// if (!rule || typeof rule !== "object") continue; -// const { type, value, message } = rule; -// -// if (!type || value === undefined || value === null) continue; -// result[`toArray.${type}`] = value; -// if (message !== undefined && message !== null) { -// result[`toArray.${type}.message`] = message; -// } -// } -// -// return result; -// }
135-135
: Fix comment typoNit: remove the stray slash for consistency.
-// / new function for scale up +// New function for scale up
136-151
: Default group key should be plural to match usage and future callersUse "validations" as the default to avoid accidental emission under a singular "validation" key.
-function flattenValidationsToField2(validationsArray, groupKey = "validation") { +function flattenValidationsToField2(validationsArray, groupKey = "validations") { const result = {}; if (!Array.isArray(validationsArray)) return result;
152-163
: Harden flattener: avoid prototype iteration, skip empty arrays, and merge per keyRefactor to use Object.entries, guard empty arrays, and safely merge per key to prevent accidental overwrites if invoked multiple times.
-function flattenConfigArrays(configObj) { - const result = {}; - for (const key in configObj) { - const value = configObj[key]; - // Handle array of {type, value} objects (like validations) - if (Array.isArray(value) && value.every((v) => typeof v === "object" && v.type)) { - const flattened = flattenValidationsToField2(value, key); - Object.assign(result, flattened); // Only merged part (e.g., { validations: { ... } }) - } - } - return result; // :white_check_mark: Only changed keys -} +function flattenConfigArrays(configObj) { + const result = {}; + for (const [key, value] of Object.entries(configObj)) { + if (!Array.isArray(value) || value.length === 0) continue; + const isTypedObjArr = value.every((v) => v && typeof v === "object" && "type" in v); + if (!isTypedObjArr) continue; + const flattened = flattenValidationsToField2(value, key); // { [key]: {...} } + // Safe per-key merge + result[key] = { ...(result[key] || {}), ...(flattened[key] || {}) }; + } + return result; // Only changed keys +}
212-214
: Unify visibilityCondition default to null to avoid truthy empty-object pitfallsAn empty object is truthy and may trigger conditional logic. Align default to null for safer checks and symmetry with reverse path.
- visibilityCondition: field?.visibilityCondition || {}, + visibilityCondition: field?.visibilityCondition ?? null, autoFillCondition: field?.autoFillCondition || [],
257-257
: Align conditionalNavigateTo default shape with reverse path (choose a stable object)Forward leaves it possibly undefined; reverse currently defaults to an array, creating shape mismatch. Recommend consistently using {} for stability.
- conditionalNavigateTo: page?.conditionalNavigateTo, + conditionalNavigateTo: page?.conditionalNavigateTo || {},
318-320
: Mirror visibilityCondition default to null in reverse pathKeep symmetry with forward path and reduce accidental truthy checks.
- visibilityCondition: field?.visibilityCondition || {}, + visibilityCondition: field?.visibilityCondition ?? null, autoFillCondition: field?.autoFillCondition || [],
332-333
: Unify conditionalNavigateTo shape in reverse path to {}Reverse defaults to an array, while forward should use {}. Use a consistent object shape to avoid downstream type guards.
- conditionalNavigateTo: section?.conditionalNavigateTo || [], + conditionalNavigateTo: section?.conditionalNavigateTo || {},
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
(6 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.js
⚙️ CodeRabbit Configuration File
check
Files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
🧠 Learnings (1)
📚 Learning: 2024-11-07T11:02:33.520Z
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1770
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/viewVillage.js:320-322
Timestamp: 2024-11-07T11:02:33.520Z
Learning: In `health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/viewVillage.js`, the `data?.additionalFields` object is guaranteed to be defined, so checking for its existence before accessing its keys is unnecessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
⏰ Context from checks skipped due to timeout of 10000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Analyze (javascript-typescript)
...flattenConfigArrays(field), | ||
// ...flattenValidationsToField(field?.validations || []), | ||
label: field?.label || "", |
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.
💡 Verification agent
🧩 Analysis chain
Round-trip bug: validations are dropped in reverse path
Forward now emits grouped validations under field.validations (object), but reverse only reconstructs from legacy toArray.* keys. This drops validations on save/submit.
Recommended fix: keep grouped shape as the canonical forward path and extend addToArrayFields to also parse grouped validations. Prefer explicit toArray.* when both exist.
Proposed implementation (outside this range — place above/add to replace current addToArrayFields):
function arrayFromGroupedConfig(groupObj) {
if (!groupObj || typeof groupObj !== "object" || Array.isArray(groupObj)) return [];
const out = [];
for (const [key, value] of Object.entries(groupObj)) {
if (key.includes(".")) continue; // skip synthesized subkeys like "pattern.message"
const msg = groupObj[`${key}.message`];
if (value !== undefined && value !== null) {
out.push({ type: key, value, ...(msg !== undefined ? { message: msg } : {}) });
}
}
return out;
}
function addToArrayFields(field) {
if (!field || typeof field !== "object") return [];
// New: grouped validations (preferred forward shape)
const fromGrouped = arrayFromGroupedConfig(field.validations);
// Back-compat: legacy toArray.* keys
const validationMap = {};
for (const key in field) {
if (!Object.prototype.hasOwnProperty.call(field, key)) continue;
if (!key.startsWith("toArray.")) continue;
const parts = key.split(".");
const type = parts[1];
if (!type) continue;
if (!validationMap[type]) validationMap[type] = { type };
if (parts.length === 2) {
validationMap[type].value = field[key];
} else if (parts.length === 3 && parts[2] === "message") {
validationMap[type].message = field[key];
}
}
const fromToArray = Object.values(validationMap).filter((v) => v.value !== undefined && v.value !== null);
// Dedupe by type: prefer explicit toArray entries over grouped if both exist
const seen = new Set(fromToArray.map((v) => v.type));
return fromToArray.concat(fromGrouped.filter((v) => !seen.has(v.type)));
}
Optional fast fallback (not preferred): temporarily emit legacy toArray.* alongside grouped validations, but that maintains two representations and increases complexity.
Verification script to confirm current reverse path ignores grouped validations and to locate other usages of toArray.*:
🏁 Script executed:
#!/bin/bash
# Search for legacy toArray.* usage and grouped validations handling across the repo
rg -n -C2 -P '\btoArray\.' || true
rg -n -C2 -P '\bvalidations\s*:\s*\{' || true
Length of output: 5987
🏁 Script executed:
#!/bin/bash
# Locate definitions and usage of flattenConfigArrays, flattenValidationsToField, and flattenValidationsToField2
rg -n -C3 "flattenConfigArrays" health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
rg -n -C3 "flattenValidationsToField" health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
Length of output: 1985
#!/bin/bash
sed -n '240,330p' health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
Critical: Reverse path drops grouped validations on save/submit
The current reverse‐transformation in addToArrayFields
only handles legacy toArray.*
keys and ignores the new grouped field.validations
object. As a result, any validations saved under validations: { … }
are lost on form submit.
Locations to address:
health/micro-ui/.../appConfigHelpers.js
at lines 183–187: we spread...flattenConfigArrays(field)
but never rehydratefield.validations
.addToArrayFields
(around line 269): only iterates overtoArray.*
keys and skips grouped validations.
Please refactor by:
- Introducing a helper to convert grouped validations back into the array shape:
function arrayFromGroupedConfig(groupObj) { if (!groupObj || typeof groupObj !== "object" || Array.isArray(groupObj)) return []; const out = []; for (const [key, value] of Object.entries(groupObj)) { if (key.includes(".")) continue; // skip synthesized subkeys like "pattern.message" const msg = groupObj[`${key}.message`]; if (value !== undefined && value !== null) { out.push({ type: key, value, ...(msg != null ? { message: msg } : {}) }); } } return out; }
- Extending
addToArrayFields
to merge both legacy and grouped validations, preferring explicittoArray.*
entries:function addToArrayFields(field) { if (!field || typeof field !== "object") return [];
-
// Handle new grouped validations shape
-
const fromGrouped = arrayFromGroupedConfig(field.validations);
-
// Back-compat: legacy toArray.* keys
const validationMap = {};
for (const key in field) {
if (!Object.prototype.hasOwnProperty.call(field, key)) continue;
if (!key.startsWith("toArray.")) continue;
const parts = key.split(".");
const type = parts[1];
if (!type) continue;
if (!validationMap[type]) validationMap[type] = { type };
if (parts.length === 2) {
validationMap[type].value = field[key];
} else if (parts.length === 3 && parts[2] === "message") {
validationMap[type].message = field[key];
}
}
const fromToArray = Object.values(validationMap).filter((v) => v.value != null); -
// Merge, preferring legacy keys over grouped when both exist
-
const seen = new Set(fromToArray.map((v) => v.type));
-
return fromToArray.concat(fromGrouped.filter((v) => !seen.has(v.type)));
}
This ensures that both legacy and new validations are preserved.
<details>
<summary>🤖 Prompt for AI Agents</summary>
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
around lines 183–187 and in addToArrayFields around line 269, the reverse
transform drops grouped field.validations; add a helper function
(arrayFromGroupedConfig) that converts grouped validation objects into the
legacy array shape (skip dotted synthesized subkeys and include message from
${key}.message
when present), then update the code where you spread
...flattenConfigArrays(field) to also rehydrate field.validations by merging the
arrayFromGroupedConfig(field.validations) result with any explicit legacy
toArray.* entries inside addToArrayFields (iterate both sources, prefer explicit
toArray.* values over grouped ones, and produce a single merged validations
array assigned back to field.validations); ensure you skip non-object/array
inputs and preserve message when present.
</details>
<!-- fingerprinting:phantom:medusa:chinchilla -->
<!-- This is an auto-generated comment by CodeRabbit -->
Co-authored-by: NabeelAyubee <[email protected]>
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: 8
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (7)
health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss (1)
172-181
: Flex direction override: confirm intent and consider mobile fallbackSetting flex-direction: row on .microplan-naming-convention-instruction-list-container forces horizontal flow. If the default row was already effective, this may be redundant; if you’re overriding a prior column rule, keep it. Consider a responsive fallback so long instructions don’t overflow on narrow screens.
Suggested enhancement:
.microplan-naming-conventions { display: flex; flex-direction: column; .microplan-naming-convention-instruction-list-container { margin-left: 0.3rem; display: flex; align-items: flex-start; - flex-direction: row; + flex-direction: row; + flex-wrap: wrap; + gap: 0.5rem; + + @media (max-width: 48rem) { + flex-direction: column; + gap: 0.25rem; + }Please confirm if any upstream selector had previously set column here; if not, we can drop the explicit flex-direction to reduce CSS specificity.
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js (1)
31-47
: Number inputs: step="" is invalid; set step per typeWith type "number" now supported, config.step: "" is not valid HTML. Provide "any" or a numeric step (e.g., 1) based on field metadata.
Example:
- config={{ - step: "", - }} + config={{ + step: cField?.step ?? (cField?.type === "number" ? "any" : undefined), + }}health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js (3)
83-95
: Duplicate effects trigger multiple onSelect callsThe effect at Lines 83-85 and the one at 87-95 both call onSelect for the same dependencies, causing redundant writes. Merge into one effect.
-useEffect(() => { - onSelect("boundaryType", { selectedData: selectedData, boundaryData: boundaryOptions, updateBoundary: !restrictSelection }); -}, [selectedData, boundaryOptions, restrictSelection]); - -useEffect(() => { - if (selectedData?.length > 0 || Object.keys(boundaryOptions || {}).length) { - onSelect("boundaryType", { - selectedData, - boundaryData: boundaryOptions, - updateBoundary: !restrictSelection, - }); - } -}, [selectedData, boundaryOptions, restrictSelection]); +useEffect(() => { + const hasData = selectedData?.length > 0 || Object.keys(boundaryOptions || {}).length > 0; + if (hasData) { + onSelect("boundaryType", { selectedData, boundaryData: boundaryOptions, updateBoundary: !restrictSelection }); + } +}, [selectedData, boundaryOptions, restrictSelection]);
97-102
: Unbounded effect causes repeated renders; remove or guard itAn effect without a dependency array fires on every render; here it runs 5 times, forcing extra renders and onSelect calls. Remove it or run only once on mount if you need an initial sync.
Minimal removal:
-useEffect(() => { - if (executionCount < 5) { - onSelect("boundaryType", { selectedData: selectedData, boundaryData: boundaryOptions, updateBoundary: !restrictSelection }); - setExecutionCount((prevCount) => prevCount + 1); - } -});If one-time initialization is intended:
+useEffect(() => { + onSelect("boundaryType", { selectedData, boundaryData: boundaryOptions, updateBoundary: !restrictSelection }); + // eslint-disable-next-line react-hooks/exhaustive-deps +}, []);
103-111
: Loading state via setTimeout is brittleUsing setTimeout(() => setIsLoading(false), 10) is racy. Base isLoading on your data fetch state instead.
Example:
- setTimeout(() => setIsLoading(false), 10); + setIsLoading(false);And gate the page loader with campaignData fetch flags (or the hook’s isFetching).
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DrawerFieldComposer.js (1)
190-219
: Numeric input: set a valid step and avoid empty string.
step: ""
is not a valid number input step and can lead to inconsistent UX. Use"any"
for free-form decimals and keep""
for text.<FieldV1 type={panelItem?.fieldType} label={t(Digit.Utils.locale.getTransformedLocale(`FIELD_DRAWER_LABEL_${panelItem?.label}`))} @@ config={{ - step: "", + step: panelItem?.fieldType === "number" ? "any" : "", }}Optional: if you want stricter control, set a numeric step (e.g., "1") based on metadata.
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js (1)
74-81
: Attribute renaming is reversed (source/target swapped).
attributeToRename
is described as{ targetKey: sourceKey }
, but the assignment writesresult[sourceKey] = field[targetKey]
. This inverts the mapping and will copy values into the wrong keys. Swap toresult[targetKey] = field[sourceKey]
and only when the source exists.if (matched.attributeToRename) { Object.entries(matched.attributeToRename).forEach(([targetKey, sourceKey]) => { if (sourceKey === "validations" || targetKey === "validations") { return; } else { - result[sourceKey] = field[targetKey]; + if (field[sourceKey] !== undefined) { + result[targetKey] = field[sourceKey]; + } } }); }
♻️ Duplicate comments (13)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js (3)
56-58
: Chain SessionStorage.get safely to avoid TypeError at runtimeDigit?.SessionStorage.get(...) will throw if SessionStorage is undefined. Chain get as well.
- Digit?.SessionStorage.get("locale") || Digit?.SessionStorage.get("initData")?.selectedLanguage, + Digit?.SessionStorage?.get("locale") || Digit?.SessionStorage?.get("initData")?.selectedLanguage,Also applies to: 100-104
144-171
: crypto.randomUUID may be unavailable; add a safe fallbackOlder browsers/SSR environments might lack crypto.randomUUID. Introduce a helper and replace direct usages.
Add once near imports:
const safeRandomId = () => (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(16).slice(2)}`;Then:
- code: crypto.randomUUID(), + code: safeRandomId(),
223-235
: Remove unused/invalid prop and pass disabled consistently
- currentPage on DependentFieldsWrapper is unused and misleading. Drop it.
- Consider forwarding disabled to DependentFieldsWrapper if it has editable controls.
- <DependentFieldsWrapper - currentPage="beneficiaryLocation" - t={t} - parentState={parentState} - onExpressionChange={handleExpressionChange} - screenConfig={screenConfig} - selectedFieldItem={selectedField} - /> + <DependentFieldsWrapper + t={t} + parentState={parentState} + onExpressionChange={handleExpressionChange} + screenConfig={screenConfig} + selectedFieldItem={selectedField} + disabled={disabled} + />health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js (3)
154-163
: Extract endpoint constant and keep mutation template focusedImproves readability and reuse.
+const CANCEL_CAMPAIGN_ENDPOINT = "/project-factory/v1/project-type/cancel-campaign"; const Template = { - url: "/project-factory/v1/project-type/cancel-campaign", + url: CANCEL_CAMPAIGN_ENDPOINT, body: { CampaignDetails: { tenantId: tenantId, campaignId: queryParams?.id, }, }, };
231-269
: PopUp content component consistencyIf CardText remains unavailable in the design system, replace with TextBlock, which is already imported.
- <CardText style={{ margin: 0 }}>{t("ES_CAMPAIGN_UPDATE_BOUNDARY_MODAL_TEXT") + " "}</CardText> + <TextBlock style={{ margin: 0 }}>{t("ES_CAMPAIGN_UPDATE_BOUNDARY_MODAL_TEXT") + " "}</TextBlock>
5-5
: CardText used but not imported — runtime crash riskCardText is referenced in PopUp children (Line 238) but not imported. Import it or replace with TextBlock.
-import { AlertCard, Stepper, TextBlock, Tag, Card, HeaderComponent, Loader, PopUp, Button, Chip } from "@egovernments/digit-ui-components"; +import { AlertCard, Stepper, TextBlock, Tag, Card, HeaderComponent, Loader, PopUp, Button, Chip, CardText } from "@egovernments/digit-ui-components";health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DrawerFieldComposer.js (1)
423-433
: Guard against undefined visibilityCondition when spreading.Spreading
prev.visibilityCondition
can throw if it's undefined. Default it to{}
before spreading.Apply:
const handleExpressionChange = (expressionString) => { if (drawerState.visibilityCondition?.expression !== expressionString) { setDrawerState((prev) => ({ ...prev, visibilityCondition: { - ...prev.visibilityCondition, + ...(prev.visibilityCondition || {}), expression: expressionString } })); } };health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js (4)
178-186
: Reverse path drops grouped validations created by flattenConfigArrays.Forward now groups validations under
field.validations
object, but reverse only rehydrates from legacytoArray.*
keys. This loses validations on submit/save.Minimal change plan:
- Add a helper to convert grouped validations back to array.
- Merge with legacy
toArray.*
(prefer explicittoArray.*
when both exist).- Use the merged array for
validations
inreverseRestructure
.Patch (outside this range — place near
addToArrayFields
):function arrayFromGroupedConfig(groupObj) { if (!groupObj || typeof groupObj !== "object" || Array.isArray(groupObj)) return []; const out = []; for (const [key, value] of Object.entries(groupObj)) { if (key.includes(".")) continue; // skip synthesized subkeys like "pattern.message" const msg = groupObj[`${key}.message`]; if (value !== undefined && value !== null) { out.push({ type: key, value, ...(msg !== undefined ? { message: msg } : {}) }); } } return out; } function addToArrayFields(field) { const validationMap = {}; if (!field || typeof field !== "object") return []; // Legacy: toArray.* for (const key in field) { if (!Object.prototype.hasOwnProperty.call(field, key)) continue; if (!key.startsWith("toArray.")) continue; const parts = key.split("."); const type = parts[1]; if (!type) continue; if (!validationMap[type]) validationMap[type] = { type }; if (parts.length === 2) validationMap[type].value = field[key]; else if (parts.length === 3 && parts[2] === "message") validationMap[type].message = field[key]; } const fromToArray = Object.values(validationMap).filter((v) => v.value !== undefined && v.value !== null); // New: grouped validations const fromGrouped = arrayFromGroupedConfig(field.validations); // Prefer explicit legacy entries if both exist const seen = new Set(fromToArray.map((v) => v.type)); return fromToArray.concat(fromGrouped.filter((v) => !seen.has(v.type))); }
135-151
: Fix comment typo and use plural default group for consistency.
- Typo: stray slash in the comment.
- Default
groupKey
should be"validations"
to match the field name used elsewhere.-// / new function for scale up +// New function for scale up -function flattenValidationsToField2(validationsArray, groupKey = "validation") { +function flattenValidationsToField2(validationsArray, groupKey = "validations") {
152-163
: Harden flattenConfigArrays: avoid prototype iteration and ensure safe per-key merges.Use
Object.entries
, skip empty arrays, and merge per group key to avoid accidental overwrites.-function flattenConfigArrays(configObj) { - const result = {}; - for (const key in configObj) { - const value = configObj[key]; - // Handle array of {type, value} objects (like validations) - if (Array.isArray(value) && value.every((v) => typeof v === "object" && v.type)) { - const flattened = flattenValidationsToField2(value, key); - Object.assign(result, flattened); // Only merged part (e.g., { validations: { ... } }) - } - } - return result; // :white_check_mark: Only changed keys -} +function flattenConfigArrays(configObj) { + const result = {}; + for (const [key, value] of Object.entries(configObj)) { + if (!Array.isArray(value) || value.length === 0) continue; + const isTypedObjArr = value.every((v) => v && typeof v === "object" && "type" in v); + if (!isTypedObjArr) continue; + const flattened = flattenValidationsToField2(value, key); // { [key]: {...} } + result[key] = { ...(result[key] || {}), ...(flattened[key] || {}) }; + } + return result; +}
257-258
: Stabilize shape of conditionalNavigateTo.Forward path leaves
conditionalNavigateTo
possibly undefined. Default to{}
for a predictable shape (and match reverse once updated).- conditionalNavigateTo: page?.conditionalNavigateTo, + conditionalNavigateTo: page?.conditionalNavigateTo || {},health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppLocalisationWrapper.js (1)
41-41
: Signature extended with parentState — OK.Prop aligns with upstream changes and state threading. When adding prop-types/TS, remember to type
parentState
.health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/ImpelComponentWrapper.js (1)
189-190
: Keep dev wrapper in sync when uncommented.The commented dev block includes
parentState
. When enabling dev mode, ensureAppLocalisationWrapperDev
continues to receive/forward this prop.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
health/micro-ui/web/micro-ui-internals/packages/css/package.json
is excluded by!**/*.json
📒 Files selected for processing (9)
health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss
(1 hunks)health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/healthdss.scss
(1 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
(2 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
(6 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppLocalisationWrapper.js
(2 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DrawerFieldComposer.js
(6 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/ImpelComponentWrapper.js
(3 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js
(3 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
(7 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.js
⚙️ CodeRabbit configuration file
check
Files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/ImpelComponentWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppLocalisationWrapper.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DrawerFieldComposer.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
🧠 Learnings (9)
📚 Learning: 2025-06-26T10:24:08.628Z
Learnt from: Hari-egov
PR: egovernments/DIGIT-Frontend#2644
File: micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/sandbox.scss:1642-1662
Timestamp: 2025-06-26T10:24:08.628Z
Learning: In the sandbox SCSS file, tab styling with margin-bottom and border changes that cause layout shifts are intentional design requirements per updated UI specifications, not bugs to be fixed.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/healthdss.scss
📚 Learning: 2024-11-07T11:02:33.520Z
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1770
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/viewVillage.js:320-322
Timestamp: 2024-11-07T11:02:33.520Z
Learning: In `health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/viewVillage.js`, the `data?.additionalFields` object is guaranteed to be defined, so checking for its existence before accessing its keys is unnecessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
📚 Learning: 2024-10-17T11:59:00.327Z
Learnt from: Ramkrishna-egov
PR: egovernments/DIGIT-Frontend#1545
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/ActivityCard.js:1-1
Timestamp: 2024-10-17T11:59:00.327Z
Learning: In `ActivityCard.js`, `React.Fragment` is used in the code.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js
📚 Learning: 2024-11-07T07:17:27.636Z
Learnt from: jagankumar-egov
PR: egovernments/DIGIT-Frontend#1763
File: health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/MyCampaign.js:65-75
Timestamp: 2024-11-07T07:17:27.636Z
Learning: In `MyCampaign.js`, when suggesting code improvements for the `onClickRow` function, keep suggestions simple and avoid unnecessary complexity.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2025-07-15T06:49:28.898Z
Learnt from: Hari-egov
PR: egovernments/DIGIT-Frontend#2788
File: micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js:43-74
Timestamp: 2025-07-15T06:49:28.898Z
Learning: In the HRMS module (micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js), the current error handling approach in the `fetchDetailsForSelectedOption` function is considered sufficient by the team. Enhanced error handling with user notifications and fallback behavior is not required for the boundary service API call.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2024-11-14T12:48:23.023Z
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1832
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PopInbox.js:592-594
Timestamp: 2024-11-14T12:48:23.023Z
Learning: In `PopInbox.js`, when integrating the `ConfirmationPopUp` component, error handling for API failures is managed internally within the component, so explicitly passing an `onError` prop is not necessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2024-12-12T05:38:22.901Z
Learnt from: Bhavya-egov
PR: egovernments/DIGIT-Frontend#2013
File: health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/jsonReader.js:24-27
Timestamp: 2024-12-12T05:38:22.901Z
Learning: In the `jsonReader` function within `health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/jsonReader.js`, generic error handling is sufficient, and enhancing error handling with specific error types is not necessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2024-06-10T19:25:42.992Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#698
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanPreview.js:1-1
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The imports in `MicroplanPreview.js` are from different libraries: `egovernments/digit-ui-components` and `egovernments/digit-ui-react-components`.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
📚 Learning: 2024-10-08T20:11:12.539Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#803
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js:300-341
Timestamp: 2024-10-08T20:11:12.539Z
Learning: If the `boundaryDataGeneration` function in `Upload.js` fails, it indicates that there is no data for that campaign, and this is an acceptable outcome. Retrying the operation is unnecessary as it would yield the same result.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
🧬 Code graph analysis (7)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/ImpelComponentWrapper.js (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js (1)
parentState
(60-60)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppLocalisationWrapper.js (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js (2)
localeModule
(66-66)parentState
(60-60)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js (2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js (2)
history
(12-12)isDraftCampaign
(13-13)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/NewCampaignCreate/CampaignDetails.js (2)
history
(146-146)isDraftCampaign
(148-148)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js (4)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/FiltersRenderer.js (1)
FiltersRenderer
(4-95)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DrawerFieldComposer.js (2)
drawerState
(406-408)handleExpressionChange
(423-433)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js (1)
parentState
(60-60)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DependentFieldsWrapper.js (1)
selectedField
(44-44)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DrawerFieldComposer.js (2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js (1)
parentState
(60-60)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DependentFieldsWrapper.js (1)
selectedField
(44-44)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DrawerFieldComposer.js (2)
type
(259-259)page
(48-48)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js (3)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/NewCampaignCreate/CampaignDetails.js (3)
campaignData
(220-220)reqCriteria
(203-218)history
(146-146)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundaryComponent.js (1)
reqCriteria
(139-150)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/HCMMyCampaignRowCard.js (2)
history
(227-227)handleCancelClick
(284-297)
⏰ Context from checks skipped due to timeout of 10000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Build application arm64
- GitHub Check: Build application amd64
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (7)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js (1)
6-6
: Prop pass-through LGTMNew isDraftCampaign prop is correctly plumbed and used in navigation state.
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/RenderConditionalField.js (2)
1-8
: New imports are aligned with added field typesAdding FiltersRenderer and DependentFieldsWrapper is coherent with the new conditional rendering cases introduced below. No issues on import paths observed.
19-22
: Verify upstream plumbing for new props and avoid silent nullsThe new props (parentState, handleExpressionChange, screenConfig, selectedField) must be passed by DrawerFieldComposer. Confirm defaulting to safe values to prevent runtime crashes when editing legacy configs.
If needed, set resilient defaults at callsite:
- <RenderConditionalField {...props} parentState={parentState} handleExpressionChange={handleExpressionChange} screenConfig={screenConfig} selectedField={selectedField} /> + <RenderConditionalField {...props} parentState={parentState ?? {}} handleExpressionChange={handleExpressionChange ?? (()=>{})} screenConfig={screenConfig ?? {}} selectedField={selectedField ?? null} />health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/DrawerFieldComposer.js (1)
178-184
: Prop-drilling looks consistent.Forwarding
parentState
,handleExpressionChange
,screenConfig
, andselectedField
toRenderConditionalField
aligns with the new API and enables dependent visibility handling. LGTM.health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppLocalisationWrapper.js (1)
132-133
: Passing parentState downstream — OK.Forwarding
parentState
toAppConfigurationWrapper
is consistent with the production path inImpelComponentWrapper
.health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/ImpelComponentWrapper.js (2)
203-204
: Production path: parentState forwarded — OK.The production wrapper passes
parentState
intoAppLocalisationWrapper
; this keeps the tree consistent.
9-9
: AllImpelComponentWrapper
call sites passparentState
– no action needed.I’ve searched the entire codebase for
<ImpelComponentWrapper>
and confirmed the only usage in
AppConfigurationParentLayer.js
already includes the newparentState
prop. No other call sites were found.
This change is fully covered—no further updates required.
.digit-dss-card-item-border { | ||
border-bottom: 0.063rem solid theme(digitv2.lightTheme.divider); | ||
.digit-dss-insight-card { | ||
margin-bottom: 2rem !important; | ||
} | ||
} |
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.
🧹 Nitpick (assertive)
Avoid compounding vertical rhythm: margin inside a bordered row conflicts with parent gaps
You add margin-bottom: 2rem on .digit-dss-insight-card within .digit-dss-card-item-border, but .digit-dss-card-body-stacked already uses gap: 2rem (Line 715), which can double the spacing. Prefer spacing on the container or suppress the extra margin for the last item.
Minimal fix to avoid double-spacing:
.digit-dss-card-item-border {
border-bottom: 0.063rem solid theme(digitv2.lightTheme.divider);
- .digit-dss-insight-card {
- margin-bottom: 2rem !important;
- }
+ .digit-dss-insight-card {
+ margin-bottom: 2rem;
+ }
+ .digit-dss-insight-card:last-child {
+ margin-bottom: 0;
+ }
}
Alternatively, replace child margin with container padding-bottom, which generally composes better with flex gaps.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
.digit-dss-card-item-border { | |
border-bottom: 0.063rem solid theme(digitv2.lightTheme.divider); | |
.digit-dss-insight-card { | |
margin-bottom: 2rem !important; | |
} | |
} | |
.digit-dss-card-item-border { | |
border-bottom: 0.063rem solid theme(digitv2.lightTheme.divider); | |
.digit-dss-insight-card { | |
margin-bottom: 2rem; | |
} | |
.digit-dss-insight-card:last-child { | |
margin-bottom: 0; | |
} | |
} |
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/healthdss.scss
around lines 729-734, the .digit-dss-insight-card sets margin-bottom: 2rem which
duplicates spacing provided by the parent .digit-dss-card-body-stacked (gap:
2rem); remove the child margin to avoid compounding vertical rhythm and either
(a) delete the margin-bottom declaration so spacing is driven by the container
gap, or (b) suppress it for the last child (e.g. clear margin-bottom via
:last-child { margin-bottom: 0 }) or move the spacing to the container as
padding-bottom if bottom padding is required instead of gap.
<HeaderComponent | ||
className={"detail-header"} | ||
styles={{ | ||
color: disabled ? "#C5C5C5" : "#004b5e", // same gray for disabled header | ||
}} | ||
> | ||
{headingName} | ||
</HeaderComponent> |
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.
🧹 Nitpick (assertive)
Prefer theme tokens or classNames over inline color for disabled headings
Inline hex (#C5C5C5 / #004b5e) bypasses theming. Recommend mapping disabled state to a class or using theme tokens so designs remain consistent across themes.
Example:
-<HeaderComponent
- className={"detail-header"}
- styles={{
- color: disabled ? "#C5C5C5" : "#004b5e",
- }}
->
+<HeaderComponent
+ className={clsx("detail-header", { "is-disabled": disabled })}
+>
And style .detail-header.is-disabled via your theme.
Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
around lines 15-22, the HeaderComponent uses inline hex colors for disabled and
normal states which bypasses theming; remove the inline styles and instead
toggle a class or theme token: add a conditional className (e.g. "detail-header
is-disabled" when disabled, otherwise "detail-header"), delete the styles prop
with hardcoded colors, and update the component stylesheet or theme tokens to
map .detail-header and .detail-header.is-disabled to the appropriate color
values so the design follows theme tokens across themes.
</div> | ||
<Button | ||
label={buttonLabel} | ||
onClick={() => { | ||
history.push(`/${window.contextPath}/employee/campaign/${navLink}`,{isDraftCampaign : isDraftCampaign}); | ||
history.push(`/${window.contextPath}/employee/campaign/${navLink}`, { isDraftCampaign: isDraftCampaign }); |
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.
💡 Verification agent
🧩 Analysis chain
Harden route construction; avoid accidental double slashes and undefined contextPath
If navLink includes a leading slash or window.contextPath is undefined, the final URL may be inconsistent.
Proposed safeguard:
- history.push(`/${window.contextPath}/employee/campaign/${navLink}`, { isDraftCampaign: isDraftCampaign });
+ const base = `/${window?.contextPath || ""}/employee/campaign`;
+ const path = `${base}/${String(navLink || "").replace(/^\/+/, "")}`;
+ history.push(path, { isDraftCampaign });
Run a quick scan to ensure similar route building is consistent across Campaign Manager:
🏁 Script executed:
#!/bin/bash
# Scan for history.push calls constructing routes with window.contextPath in Campaign Manager module
rg -nP --type=ts --type=tsx --type=js --type=jsx -C2 'history\.push\(\s*`/\$\{?window\.contextPath\}?/employee/campaign' health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager
Length of output: 223
🏁 Script executed:
#!/bin/bash
# Re-scan for history.push calls constructing routes with window.contextPath using glob patterns
rg -n -C2 'history\.push\(\s*`/\\$\\{?window\.contextPath\}?/employee/campaign' -g '*.js' -g '*.jsx' -g '*.ts' -g '*.tsx' health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager
Length of output: 372
🏁 Script executed:
#!/bin/bash
# 1. Find all usages of window.contextPath in Campaign Manager
rg -n "window\.contextPath" --glob '*.js' --glob '*.jsx' health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager
# 2. Find all occurrences of employee/campaign routes in Campaign Manager
rg -n "employee/campaign" --glob '*.js' --glob '*.jsx' health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager
Length of output: 49471
Harden and centralize campaign‐route construction
Our scan uncovered dozens of call sites in the Campaign Manager module where routes are built via
`/${window.contextPath}/employee/campaign/...`
Relying on ad-hoc template strings risks accidental double-slashes (if navLink
has a leading slash) and broken URLs when window.contextPath
is undefined. Rather than patching each occurrence individually, extract a shared helper that:
- Defaults
contextPath
safely. - Strips any leading slashes from
navLink
. - Concatenates segments without introducing double-slashes.
Example utility (e.g. src/utils/buildCampaignPath.js
):
export function buildCampaignPath(
navLink,
contextPath = typeof window !== "undefined" ? window.contextPath : ""
) {
const base = `/${contextPath || ""}/employee/campaign`;
return `${base}/${String(navLink || "").replace(/^\/+/, "")}`;
}
Then, in ViewDetailComponent.js:
--- a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
+++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
@@ 27
- history.push(`/${window.contextPath}/employee/campaign/${navLink}`, { isDraftCampaign: isDraftCampaign });
+ history.push(buildCampaignPath(navLink), { isDraftCampaign });
• Apply this helper here to harden the patch.
• Optional: Gradually refactor other history.push
calls in the Campaign Manager codebase to use buildCampaignPath
for consistency and safety.
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
around line 27, the route is constructed inline with a template string which can
produce double-slashes or break when window.contextPath is undefined; create a
shared helper (e.g. src/utils/buildCampaignPath.js) that defaults contextPath
safely (use empty string if window/contextPath not available), strips any
leading slashes from navLink, and concatenates segments without double-slashes,
then replace the inline template with a call to buildCampaignPath(navLink, /*
optional contextPath */) and pass the resulting path into history.push along
with the existing state.
style={{ width: "19rem" }} | ||
isDisabled={disabled} | ||
title={buttonLabel} |
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.
🧹 Nitpick (assertive)
Button accessibility: title duplicates label
title={buttonLabel} is redundant since the Button already exposes an accessible name via label. Consider dropping title to avoid duplicate announcements on some ATs.
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CreateCampaignComponents/ViewDetailComponent.js
around lines 30-32, the Button currently passes title={buttonLabel} which
duplicates the accessible name exposed by the label; remove the title prop (or
set it to undefined) so the Button only provides a single accessible name via
its label; if a tooltip is required, implement it separately (e.g., using an
aria-describedby or a dedicated Tooltip component) rather than using title to
avoid duplicate announcements.
const { data: campaignData, isFetching } = Digit.Hooks.useCustomAPIHook(reqCriteria); | ||
|
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.
🧹 Nitpick (assertive)
Hook result aliasing: remove unused isFetching or use for loader
You destructure isFetching but never use it. Either wire it into your loading state or drop it to keep the file clean.
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
around lines 81-82, the hook result destructures isFetching but it is never
used; either remove isFetching from the destructuring to avoid an unused
variable, or wire it into the component's loading state (e.g., show a
loader/spinner or an early return while isFetching is true and only render the
main UI when false); update imports/props as needed to pass the loading flag to
children or to render a loading indicator and ensure no lint warnings remain.
{isDraftCampaign ? ( | ||
<div className="digit-tag-container" style={{ margin: "0rem" }}> | ||
<Chip text={`${t(`CANCEL_CAMPAIGN`)}`} onClick={handleCancelClick} hideClose={false} /> | ||
</div> | ||
) : null} |
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.
🧹 Nitpick (assertive)
Chip semantics: hideClose={false} exposes a close icon for a destructive action
For destructive “Cancel Campaign,” consider using a Button with explicit variant=“secondary”/“tertiary” and an icon that communicates intent, or set hideClose={true} to avoid implying a dismiss-only affordance.
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js
around lines 191-195, the Chip currently renders a destructive "Cancel Campaign"
action with hideClose={false} which exposes a close icon and implies a
dismiss-only affordance; replace the Chip with your Button component (or the
design system's actionable control) using variant="secondary" or "tertiary", add
an explicit cancel icon (e.g., Trash or Close) and keep the same
handleCancelClick handler, or if you must keep the Chip set hideClose={true} and
style it to look like an action (but preferred is swapping to Button for correct
semantics and accessibility).
visibilityCondition: field?.visibilityCondition || {}, | ||
autoFillCondition: field?.autoFillCondition || [], | ||
})); |
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.
🛠️ Refactor suggestion
Unify visibilityCondition default; prefer null over {} to indicate absence.
Using {}
is truthy and can trip feature flags. Recommend null
as the canonical “not set” value. Align forward path accordingly.
- visibilityCondition: field?.visibilityCondition || {},
+ visibilityCondition: field?.visibilityCondition ?? null,
- autoFillCondition: field?.autoFillCondition || [],
+ autoFillCondition: field?.autoFillCondition ?? [],
Note: Update reverse path and any consumers to treat null
as “no condition”.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
visibilityCondition: field?.visibilityCondition || {}, | |
autoFillCondition: field?.autoFillCondition || [], | |
})); | |
visibilityCondition: field?.visibilityCondition ?? null, | |
autoFillCondition: field?.autoFillCondition ?? [], | |
})); |
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
around lines 212-214, the mapped default for visibilityCondition uses an empty
object ({}), which is truthy and can incorrectly trigger feature flags; change
the default to null (visibilityCondition: field?.visibilityCondition ?? null)
and update the reverse-path serialization and any consumers to treat null as “no
condition” (replace checks like if (visibilityCondition) with explicit null
checks or boolean guards), ensuring downstream logic and tests expect null
rather than {}.
visibilityCondition: field?.visibilityCondition || {}, | ||
autoFillCondition: field?.autoFillCondition || [], | ||
}; |
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.
🛠️ Refactor suggestion
Mirror defaults in reverse; align with forward choices.
Make reverse consistent with forward: use null
for visibilityCondition
, and {}
for conditionalNavigateTo
. Keep arrays as arrays when they’re semantically lists.
- visibilityCondition: field?.visibilityCondition || {},
- autoFillCondition: field?.autoFillCondition || [],
+ visibilityCondition: field?.visibilityCondition ?? null,
+ autoFillCondition: field?.autoFillCondition ?? [],
And below:
- conditionalNavigateTo: section?.conditionalNavigateTo || [],
+ conditionalNavigateTo: section?.conditionalNavigateTo || {},
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
visibilityCondition: field?.visibilityCondition || {}, | |
autoFillCondition: field?.autoFillCondition || [], | |
}; | |
visibilityCondition: field?.visibilityCondition ?? null, | |
autoFillCondition: field?.autoFillCondition ?? [], | |
}; | |
// … other code … | |
conditionalNavigateTo: section?.conditionalNavigateTo || {}, |
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/appConfigHelpers.js
around lines 318-320, the reverse/default mapping uses {} for
visibilityCondition and may not mirror the forward mapping for
conditionalNavigateTo and list fields; change visibilityCondition to default to
null (e.g. use null when missing), ensure conditionalNavigateTo defaults to an
object ({}) to match forward, and ensure list fields like autoFillCondition
remain arrays (default to []), so switch the defaulting logic to use null for
visibilityCondition, {} for conditionalNavigateTo, and keep [] for array/list
fields.
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: 3
♻️ Duplicate comments (7)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js (7)
42-45
: A11y: Clickable SVG must be keyboard-operable and have an accessible nameSVG acts like a button but lacks role, tabIndex, keyboard handler, and title/aria-label. This violates a11y lint hints and blocks keyboard users.
Apply this diff to make the icon accessible:
-const FilterIcon = (props) => ( - <svg onClick={props?.onClick} width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> +const FilterIcon = (props) => ( + <svg + role="button" + tabIndex="0" + aria-label={props?.ariaLabel || "Filter"} + onClick={props?.onClick} + onKeyDown={(e) => { + if (e.key === "Enter" || e.key === " ") { + e.preventDefault(); + props?.onClick?.(e); + } + }} + width="16" + height="16" + viewBox="0 0 16 16" + fill="none" + xmlns="http://www.w3.org/2000/svg" + > + <title>{props?.ariaLabel || "Filter"}</title> <path d="M0.250666 1.61C2.27067 4.2 6.00067 9 6.00067 9V15C6.00067 15.55 6.45067 16 7.00067 16H9.00067C9.55067 16 10.0007 15.55 10.0007 15V9C10.0007 9 13.7207 4.2 15.7407 1.61C16.2507 0.95 15.7807 0 14.9507 0H1.04067C0.210666 0 -0.259334 0.95 0.250666 1.61Z" fill="#C84C0E" /> </svg> )
51-86
: Filter: pass ariaLabel to icon, use defensive access for label, remove no-op footer props
- Propagate a translated ariaLabel to FilterIcon.
- Use optional chaining for props.field?.label to prevent crashes.
- footerChildren is empty and sortFooterChildren has no effect; drop both.
- Optional: move inline style comments into CSS to reduce noise.
return ( <div className="digit-search-action"> - <FilterIcon onClick={() => setShowPopUp(true)} /> - <span className="digit-search-text" style={{ color: "#C84C0E" }}>{props.t(props.field.label) || "LABEL"}</span> + <FilterIcon onClick={() => setShowPopUp(true)} ariaLabel={props.t("FILTER")} /> + <span className="digit-search-text" style={{ color: "#C84C0E" }}>{props.t(props?.field?.label) || "LABEL"}</span> {showPopUp && ( <PopUp className={"custom-popup-filter"} type={"default"} heading={props.t("SELECT_FILTER")} onClose={() => setShowPopUp(false)} - style={{ - width: "100%", // Full width popup - maxWidth: "100%", // Prevents shrinking - height: "auto", - margin: 0, - padding: 0 - }} - footerChildren={[ - ]} - sortFooterChildren={true} + style={{ width: "100%", maxWidth: "100%", height: "auto", margin: 0, padding: 0 }} > <div style={{ width: "100%", // Take full popup width padding: "1rem", boxSizing: "border-box" }}> <RenderSelectionField field={props.field} t={props.t} /> </div> </PopUp> )} </div> );
192-193
: Avoid horizontal overflow: don’t tie width to viewport heightminWidth: "100vh" causes horizontal scroll on short viewports. Use width: "100%".
- display: "flex", alignItems: "center", minWidth: "100vh", paddingBottom: "1rem" + display: "flex", alignItems: "center", width: "100%", paddingBottom: "1rem"
396-396
: Use strict check (or boolean negation) for hidden flagAvoid loose inequality to prevent coercion pitfalls.
- {detailsCard?.hidden != true && <DetailsCardSection t={t} field={detailsCard} />} + {detailsCard?.hidden !== true && <DetailsCardSection t={t} field={detailsCard} />}Alternatively:
- {detailsCard?.hidden != true && <DetailsCardSection t={t} field={detailsCard} />} + {!detailsCard?.hidden && <DetailsCardSection t={t} field={detailsCard} />}
657-665
: Avoid rendering empty label span for search; honor hidden flag
- Don’t render an empty span when label is absent.
- Skip the whole cell when searchIcon.hidden is true.
- <div - style={cellStyle} - > - {/* Use currentColor so it won't disappear on white backgrounds */} - <SVG.Search width={"20px"} height={"20px"} fill={"#C84C0E"} /> - <span style={{ whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", color: "#C84C0E" }}> - {t?.(searchIcon?.label || "")} - </span> - </div> + {searchIcon?.hidden !== true && ( + <div style={cellStyle}> + <SVG.Search width={"20px"} height={"20px"} fill={"#C84C0E"} aria-hidden={true} focusable="false" /> + {!!searchIcon?.label && ( + <span style={{ whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", color: "#C84C0E" }}> + {t?.(searchIcon?.label)} + </span> + )} + </div> + )}
661-661
: Decorative icon should be hidden from assistive tech (Search icon)Mark purely decorative SVGs as aria-hidden and non-focusable.
- <SVG.Search width={"20px"} height={"20px"} fill={"#C84C0E"} /> + <SVG.Search width={"20px"} height={"20px"} fill={"#C84C0E"} aria-hidden={true} focusable="false" />
678-678
: Decorative icon should be hidden from assistive tech (Sort icon)Mark the arrow icon as decorative so screen readers ignore it.
- <SVG.ArrowDownward width={"20px"} height={"20px"} fill={"#C84C0E"} /> + <SVG.ArrowDownward width={"20px"} height={"20px"} fill={"#C84C0E"} aria-hidden={true} focusable="false" />
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
(7 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.js
⚙️ CodeRabbit configuration file
check
Files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
🧠 Learnings (3)
📚 Learning: 2025-06-27T05:52:33.156Z
Learnt from: Hari-egov
PR: egovernments/DIGIT-Frontend#2644
File: micro-ui/web/micro-ui-internals/packages/modules/core/src/components/PrivacyComponent.js:0-0
Timestamp: 2025-06-27T05:52:33.156Z
Learning: The PrivacyComponent in `micro-ui/web/micro-ui-internals/packages/modules/core/src/components/PrivacyComponent.js` is mostly used in login and signup pages, especially in formcomposer where the UI is stable, making layout changes less likely to cause regressions.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
📚 Learning: 2024-06-10T19:25:42.992Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#698
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanPreview.js:1-1
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The imports in `MicroplanPreview.js` are from different libraries: `egovernments/digit-ui-components` and `egovernments/digit-ui-react-components`.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
📚 Learning: 2024-06-10T19:25:42.992Z
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#0
File: :0-0
Timestamp: 2024-06-10T19:25:42.992Z
Learning: The Button component from `egovernments/digit-ui-components` has compatibility issues with the ActionBar, leading to the preference for using the Button from `egovernments/digit-ui-react-components` in certain scenarios.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
🧬 Code graph analysis (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/RenderSelectionField.js (1)
RenderSelectionField
(4-46)
🪛 Biome (2.1.2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
[error] 43-43: Alternative text title element cannot be empty
For accessibility purposes, SVGs should have an alternative text, provided via title element. If the svg element has role="img", you should add the aria-label or aria-labelledby attribute.
(lint/a11y/noSvgWithoutTitle)
[error] 43-43: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event.
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
(lint/a11y/useKeyWithClickEvents)
⏰ Context from checks skipped due to timeout of 10000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Build application amd64
- GitHub Check: Build application arm64
🔇 Additional comments (4)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js (4)
1-2
: LGTM on extended imports for PopUp/SVG/useStateAppropriate additions for the new Filter pop-up and icons. No blockers here.
4-4
: RenderSelectionField import matches usage in FilterImport aligns with the pop-up content. Good to go.
334-336
: ACKNOWLEDGEMENT early-guard before switch is sensibleEnsures the response panel is selected regardless of case-specific variants. Good precedence handling.
338-343
: Verify COMPLAINTSINBOX mapping in MDMS/configOur ripgrep search didn’t find any occurrences of
COMPLAINTSINBOX
,COMPLAINTS_INBOX
, orComplaintsInbox
in the repository’s templateName usages or related configs. To avoid a dead mapping at runtime, please manually confirm that the external MDMS or JSON config indeed defines a template key matching exactly:
COMPLAINTSINBOX
(no underscore, uppercase)- Or adjust the switch-case to match the actual key (e.g.,
COMPLAINTS_INBOX
orComplaintsInbox
).File & Location:
- health/micro-ui/.../RegistrationComponents.js, lines 338–343
switch (templateName?.toUpperCase()) { case "HOUSEHOLDOVERVIEW": return HouseHoldOverviewSection; - case "COMPLAINTSINBOX": + // Ensure this matches the key in your MDMS/config exactly case "COMPLAINTSINBOX": return SimpleSearchFilterRow;• No matching key found via
rg -nP '(templateName|TEMPLATE_NAME).{0,40}COMPLAINTS?_?INBOX'
.
• No related config entries (searchComplaints
,filter
, etc.) reference this under campaign-manager.Next steps:
- Inspect your MDMS or JSON configuration to see which key is used for the Complaints Inbox template.
- Update the case label here (or your config) to ensure an exact match.
components = [], t | ||
// t, | ||
// label = "Search", | ||
// primaryColor = "currentColor", | ||
// size = "20px", | ||
// onSearchClick, | ||
// onSortClick, | ||
// // Pass anything your <Filter /> needs via this prop | ||
// filterProps = {}, | ||
}) => { |
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.
🧹 Nitpick (assertive)
Remove commented-out parameters and props in component signature
These comments add noise and risk confusion; keep the API surface clean.
-const SimpleSearchFilterRow = ({
- components = [], t
- // t,
- // label = "Search",
- // primaryColor = "currentColor",
- // size = "20px",
- // onSearchClick,
- // onSortClick,
- // // Pass anything your <Filter /> needs via this prop
- // filterProps = {},
-}) => {
+const SimpleSearchFilterRow = ({ components = [], t }) => {
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
components = [], t | |
// t, | |
// label = "Search", | |
// primaryColor = "currentColor", | |
// size = "20px", | |
// onSearchClick, | |
// onSortClick, | |
// // Pass anything your <Filter /> needs via this prop | |
// filterProps = {}, | |
}) => { | |
const SimpleSearchFilterRow = ({ components = [], t }) => { |
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
around lines 617 to 626, the component parameter list contains commented-out
parameters and props which clutter the signature; remove all commented-out
parameters (e.g., t, label, primaryColor, size, onSearchClick, onSortClick,
filterProps) so the function signature only lists actual used parameters
(components = [], t) and update any related trailing commas or formatting
accordingly to keep linting/formatting clean.
return ( | ||
<div | ||
style={{ | ||
display: "grid", | ||
gridTemplateColumns: "repeat(3, minmax(0, 1fr))", // equal widths | ||
columnGap: "0.5rem", // smaller overall gap | ||
rowGap: "0.5rem", | ||
alignItems: "center", | ||
width: "100%" //allow responsive wrap | ||
}} | ||
> |
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.
🧹 Nitpick (assertive)
Layout resilience when items are hidden
Grid is fixed to 3 equal columns; if search/sort are hidden via config, the layout leaves empty columns. Consider computing present columns or switching to flex with gap for automatic compaction.
Example approach (conceptual):
- Compute an array like sections = [showSearch && , showFilter && , showSort && ].filter(Boolean)
- Render in a flex container with justify-content: space-between; wrap as needed.
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
around lines 645-655, the layout uses a fixed 3-column CSS grid which leaves
empty columns when search/filter/sort are hidden; replace it by computing the
visible components into an array (e.g. sections = [showSearch && Search,
showFilter && Filter, showSort && Sort].filter(Boolean)) and render that array
inside a responsive flex container (display: "flex") with gap, wrap and
justifyContent/alignItems set so items compact automatically; remove the
hard-coded gridTemplateColumns and columnGap/rowGap so hidden items no longer
create empty space.
<div | ||
style={cellStyle} | ||
> | ||
<SVG.ArrowDownward width={"20px"} height={"20px"} fill={"#C84C0E"} /> | ||
{sortIcon?.label ? ( | ||
<span style={{ whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", color: "#C84C0E" }}> | ||
{t?.(sortIcon?.label || "")} | ||
</span> | ||
) : null} | ||
</div> | ||
</div> |
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.
🧹 Nitpick (assertive)
Sort section: honor hidden flag and avoid empty label
Mirror the search behavior: don’t render if hidden; only render label when present.
- <div
- style={cellStyle}
- >
- <SVG.ArrowDownward width={"20px"} height={"20px"} fill={"#C84C0E"} />
- {sortIcon?.label ? (
- <span style={{ whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", color: "#C84C0E" }}>
- {t?.(sortIcon?.label || "")}
- </span>
- ) : null}
- </div>
+ {sortIcon?.hidden !== true && (
+ <div style={cellStyle}>
+ <SVG.ArrowDownward width={"20px"} height={"20px"} fill={"#C84C0E"} aria-hidden={true} focusable="false" />
+ {!!sortIcon?.label && (
+ <span style={{ whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", color: "#C84C0E" }}>
+ {t?.(sortIcon?.label)}
+ </span>
+ )}
+ </div>
+ )}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
<div | |
style={cellStyle} | |
> | |
<SVG.ArrowDownward width={"20px"} height={"20px"} fill={"#C84C0E"} /> | |
{sortIcon?.label ? ( | |
<span style={{ whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", color: "#C84C0E" }}> | |
{t?.(sortIcon?.label || "")} | |
</span> | |
) : null} | |
</div> | |
</div> | |
{sortIcon?.hidden !== true && ( | |
<div style={cellStyle}> | |
<SVG.ArrowDownward | |
width={"20px"} | |
height={"20px"} | |
fill={"#C84C0E"} | |
aria-hidden={true} | |
focusable="false" | |
/> | |
{!!sortIcon?.label && ( | |
<span | |
style={{ | |
whiteSpace: "nowrap", | |
overflow: "hidden", | |
textOverflow: "ellipsis", | |
color: "#C84C0E", | |
}} | |
> | |
{t?.(sortIcon?.label)} | |
</span> | |
)} | |
</div> | |
)} |
🤖 Prompt for AI Agents
In
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/template_components/RegistrationComponents.js
around lines 675-685: the sort UI currently always renders even when
sortIcon.hidden is true and renders an empty translated span when label is
missing; update the rendering to mirror the search behavior by first checking
that sortIcon exists and sortIcon.hidden is falsy before rendering the outer
div, and inside only render the translated span when sortIcon.label is a
non-empty/truthy string (use t?.(label) only when label is present).
Choose the appropriate template for your PR:
Feature/Bugfix Request
JIRA ID
Module
Description
Summary by CodeRabbit
New Features
Enhancements
Style