-
Notifications
You must be signed in to change notification settings - Fork 19
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
Console v0.3 changes #1823
base: master
Are you sure you want to change the base?
Console v0.3 changes #1823
Conversation
…er Download Screen (#1670) * Added Loader for User Download Screen * Added ShowMore Popup for Boundary Summary Screen --------- Co-authored-by: Nipun Arora <[email protected]>
#1671) * added hierarchy level for village and enable the edit button based on role * removed hardcoded campaign id --------- Co-authored-by: rachana-egov <[email protected]> Co-authored-by: Nipun Arora <[email protected]>
Co-authored-by: NabeelAyubee <[email protected]>
* tab not showing issue fix * removed console.log * show tab issue fix for plan inbox --------- Co-authored-by: rachana-egov <[email protected]>
* session data invalidation/update * synced UI customisations file
* Css changes to assumptions in summary * css changes for boundary screen * Css changes and Data management screen working * Data fileds localizations * css changes * removed console * t(NA) * card default changed * localization isuues * css changes * sync for UIcustomizations * localization changes --------- Co-authored-by: Nipun Arora <[email protected]>
* fixed import issue * updated imports * fixed component import * updated facilitypopup
Co-authored-by: NabeelAyubee <[email protected]>
fixed 1081
* some changes * changes * MyMicroplans screen search working --------- Co-authored-by: nabeelmd-eGov <[email protected]>
* fixed bugs in formula deletions, cascading effect on formula changes * removed logs
Co-authored-by: rachana-egov <[email protected]>
* my microplan localisation, css fixes * log removed --------- Co-authored-by: NabeelAyubee <[email protected]>
* Changes regarding template generate and user download * Delete micro-ui/web/package-lock.json
* updated facilitypopup * added review changes
…gn PlanAssignment update column added (#1691) * Implemented Search Functionality in User Aceess Data Table and Unassign PlanAssignment update column added * Updated code comments * Resolved code rabbit comments * Removed console logs
… camapign boundaries
* updated the table colomn to show name instead of id * updated village view to just update total population now * added fix for page not getting reload after update --------- Co-authored-by: rachana-egov <[email protected]>
* my microplan localisation, css fixes * log removed * issues fixes demo fixes * added localisation and commenting updated code * disabled dropdown if user already tagged --------- Co-authored-by: NabeelAyubee <[email protected]>
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: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
📒 Files selected for processing (2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/fetchFromMicroplan.js
(1 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/useFetchFromMicroplan.js
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/fetchFromMicroplan.js (1)
Pattern **/*.js
: check
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/useFetchFromMicroplan.js (1)
Pattern **/*.js
: check
🪛 Biome (1.9.4)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/fetchFromMicroplan.js
[error] 42-42: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 49-49: Unsafe usage of optional chaining.
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
(lint/correctness/noUnsafeOptionalChaining)
[error] 82-82: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 151-151: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
Unsafe fix: Use a SelfClosingElement instead
(lint/style/useSelfClosingElements)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/useFetchFromMicroplan.js
[error] 131-131: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 134-134: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
🔇 Additional comments (9)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/useFetchFromMicroplan.js (6)
11-30
: Well-implemented fetchFromMicroplan
function
The fetchFromMicroplan
function is correctly implemented, effectively fetching campaign details and handling responses appropriately.
31-48
: Efficient searchCampaign
function
The searchCampaign
function efficiently searches for campaigns by ID and tenant ID, and returns the expected results.
49-67
: Appropriate implementation of updateCampaign
function
The updateCampaign
function properly handles campaign creation and updates based on the provided mode, with correct payload modifications.
77-101
: Avoid hardcoded time values
The use of hardcoded millisecond values for startDate
and endDate
reduces flexibility and maintainability. Consider defining these durations as constants or retrieving them from a configuration.
117-119
: Fix campaign existence check
The condition if (!campaignData)
may not correctly detect when no campaign is found because an empty object {}
is truthy in JavaScript. Consider modifying the condition to check if campaignData
is an empty object.
131-134
: Simplify conditional assignments using optional chaining
Enhance readability by using optional chaining (?.
) in your conditional assignments for newCampaignSearchResponse
and updatedCampaignData
.
🧰 Tools
🪛 Biome (1.9.4)
[error] 131-131: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 134-134: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/fetchFromMicroplan.js (3)
36-36
: Correct the typo in step description.
There's a typo in the step description "UPDATED_CAMPAIGN_WITH_UPLODAED_DATA"
. The word "UPLODAED" should be "UPLOADED".
115-115
: Correct typo in error message key.
The translation key "SOME_ERROR_OCCURED_IN_FETCH"
contains a typo. "OCCURED" should be "OCCURRED".
151-151
: Fix incorrect condition in loader display logic.
The condition id?.key?.length > 0
is incorrect because id
is a string obtained from searchParams.get("id")
and does not have a key
property. You should check if id
itself has a length greater than zero.
🧰 Tools
🪛 Biome (1.9.4)
[error] 151-151: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
Unsafe fix: Use a SelfClosingElement instead
(lint/style/useSelfClosingElements)
if(templates&&templates?.completed){ | ||
if(currentStep==4){ | ||
setCurrentStep((prev) => prev + 1); | ||
} | ||
const fetchFromMicroplanResponse=await fetchFromMicroplan(data?.updatedCampaignData?.id,data?.updatedCampaignData?.tenantId,planConfigurationId); | ||
|
||
setMicroplan({ | ||
...fetchFromMicroplanResponse | ||
}) | ||
|
||
|
||
} | ||
|
||
},[templates]) | ||
|
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.
Import the missing fetchFromMicroplan
function.
The fetchFromMicroplan
function is used but not imported or defined within this file, which will cause a ReferenceError
at runtime. Ensure that you import it from the correct module.
Apply this diff to fix the issue:
+import { fetchFromMicroplan } from "../path/to/fetchFromMicroplan";
// ... existing imports ...
Replace "../path/to/fetchFromMicroplan"
with the actual relative path to the module where fetchFromMicroplan
is defined.
Committable suggestion skipped: line range outside the PR's diff.
🧰 Tools
🪛 Biome (1.9.4)
[error] 82-82: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
useEffect(async()=>{ | ||
if(templates&&templates?.completed){ | ||
if(currentStep==4){ | ||
setCurrentStep((prev) => prev + 1); | ||
} | ||
const fetchFromMicroplanResponse=await fetchFromMicroplan(data?.updatedCampaignData?.id,data?.updatedCampaignData?.tenantId,planConfigurationId); | ||
|
||
setMicroplan({ | ||
...fetchFromMicroplanResponse | ||
}) | ||
|
||
|
||
} | ||
|
||
},[templates]) | ||
|
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.
Avoid using async functions directly in useEffect
; define and invoke them inside the effect instead.
The useEffect
hook should not be an async
function. Declaring it as such can lead to unexpected behaviors. Instead, define an async
function inside the effect and call it. This practice ensures proper handling of asynchronous operations and cleanup.
Apply this diff to fix the issue:
-useEffect(async ()=>{
+useEffect(() => {
+ const fetchData = async () => {
if (templates && templates?.completed) {
if (currentStep == 4) {
setCurrentStep((prev) => prev + 1);
}
const fetchFromMicroplanResponse = await fetchFromMicroplan(
data?.updatedCampaignData?.id,
data?.updatedCampaignData?.tenantId,
planConfigurationId
);
setMicroplan({
...fetchFromMicroplanResponse,
});
}
- }
-}, [templates]);
+ };
+ fetchData();
+}, [templates]);
📝 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.
useEffect(async()=>{ | |
if(templates&&templates?.completed){ | |
if(currentStep==4){ | |
setCurrentStep((prev) => prev + 1); | |
} | |
const fetchFromMicroplanResponse=await fetchFromMicroplan(data?.updatedCampaignData?.id,data?.updatedCampaignData?.tenantId,planConfigurationId); | |
setMicroplan({ | |
...fetchFromMicroplanResponse | |
}) | |
} | |
},[templates]) | |
useEffect(() => { | |
const fetchData = async () => { | |
if (templates && templates?.completed) { | |
if (currentStep == 4) { | |
setCurrentStep((prev) => prev + 1); | |
} | |
const fetchFromMicroplanResponse = await fetchFromMicroplan( | |
data?.updatedCampaignData?.id, | |
data?.updatedCampaignData?.tenantId, | |
planConfigurationId | |
); | |
setMicroplan({ | |
...fetchFromMicroplanResponse, | |
}); | |
} | |
}; | |
fetchData(); | |
}, [templates]); |
🧰 Tools
🪛 Biome (1.9.4)
[error] 82-82: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
const { hierarchyType, id, tenantId } = data?.updatedCampaignData; | ||
|
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.
Ensure safe destructuring by verifying data.updatedCampaignData
exists before destructuring.
Destructuring properties from data?.updatedCampaignData
without checking if it exists can lead to runtime errors if updatedCampaignData
is undefined
. To prevent this, confirm its existence before destructuring.
Apply this diff to fix the issue:
- const { hierarchyType, id, tenantId } = data?.updatedCampaignData;
+ if (data?.updatedCampaignData) {
+ const { hierarchyType, id, tenantId } = data.updatedCampaignData;
+ // Proceed with API calls or handle the data
+ } else {
+ // Handle the case where updatedCampaignData is undefined
+ }
Committable suggestion skipped: line range outside the PR's diff.
🧰 Tools
🪛 Biome (1.9.4)
[error] 49-49: Unsafe usage of optional chaining.
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
(lint/correctness/noUnsafeOptionalChaining)
* button change * Changes * Formula name validation * Changes * console log removed * changes * changes * changes * Original formula config * Formula config change for toast * Update FormulaConfiguration.js --------- Co-authored-by: Nipun Arora <[email protected]>
* fixed decimal issue and total not getting validated issue * fixed user tagging multiselect dropdown issue --------- Co-authored-by: rachana-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: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
📒 Files selected for processing (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/fetchFromMicroplan.js
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/fetchFromMicroplan.js (1)
Pattern **/*.js
: check
🪛 Biome (1.9.4)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/fetchFromMicroplan.js
[error] 43-43: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 49-49: Unsafe usage of optional chaining.
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
(lint/correctness/noUnsafeOptionalChaining)
[error] 84-84: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 104-104: Unsafe usage of optional chaining.
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
(lint/correctness/noUnsafeOptionalChaining)
[error] 121-121: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 182-182: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
Unsafe fix: Use a SelfClosingElement instead
(lint/style/useSelfClosingElements)
🔇 Additional comments (5)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/fetchFromMicroplan.js (5)
37-37
: 🧹 Nitpick (assertive)
Fix typo in step description
There's a typo in the step description "UPDATED_CAMPAIGN_WITH_UPLODAED_DATA"
. The word "UPLODAED" should be "UPLOADED".
Apply this diff to fix the typo:
- "UPDATED_CAMPAIGN_WITH_UPLODAED_DATA",
+ "UPDATED_CAMPAIGN_WITH_UPLOADED_DATA",
182-182
:
Fix incorrect condition and use self-closing tag
The condition id?.key?.length > 0
is incorrect because id
is a string obtained from searchParams.get("id")
and does not have a key
property. Also, the <div>
element can be self-closing.
Apply this diff to correct the condition and use a self-closing tag:
- {showToast?.key != "error" && id?.key?.length > 0 && <div className="sandbox-loader"></div>}
+ {showToast?.key != "error" && id?.length > 0 && <div className="sandbox-loader" />}
🧰 Tools
🪛 Biome (1.9.4)
[error] 182-182: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
Unsafe fix: Use a SelfClosingElement instead
(lint/style/useSelfClosingElements)
85-85
: 🧹 Nitpick (assertive)
Remove unnecessary console.log
statement
Including console.log
in production code can expose internal data and affect performance. It's advisable to remove it or replace it with a proper logging mechanism.
Apply this diff to remove the console log:
- console.log(templates, "templates");
49-49
:
Ensure data.updatedCampaignData
exists before destructuring
Destructuring data?.updatedCampaignData
without verifying its existence can lead to runtime errors if updatedCampaignData
is undefined
.
Apply this fix to ensure safe destructuring:
+ if (data?.updatedCampaignData) {
const { hierarchyType, id, tenantId } = data.updatedCampaignData;
+ } else {
+ console.error("updatedCampaignData is undefined");
+ // Handle the error appropriately
+ }
Likely invalid or redundant comment.
🧰 Tools
🪛 Biome (1.9.4)
[error] 49-49: Unsafe usage of optional chaining.
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
(lint/correctness/noUnsafeOptionalChaining)
83-100
:
Avoid using async
directly in useEffect
; define and invoke inside
The useEffect
hook should not be declared as async
. Instead, define an async
function inside the effect and call it.
Apply this diff to refactor:
-useEffect(async () => {
+useEffect(() => {
+ const fetchData = async () => {
if (templates && templates?.completed) {
console.log(templates, "templates");
if (currentStep == 4) {
setCurrentStep((prev) => prev + 1);
}
const fetchFromMicroplanResponse = await fetchFromMicroplan(
data?.updatedCampaignData?.id,
data?.updatedCampaignData?.tenantId,
planConfigurationId
);
setMicroplan({
...fetchFromMicroplanResponse,
});
}
+ };
+ fetchData();
}, [templates]);
Likely invalid or redundant comment.
🧰 Tools
🪛 Biome (1.9.4)
[error] 84-84: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
console.error("Error fetching templates:", error); | ||
setCurrentStep((prev) => prev + 1); | ||
setTemplates({ | ||
facilityFile: null, | ||
targetFile: null, | ||
userFile: null, | ||
completed: "yes", | ||
}); | ||
} |
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.
Review error handling in template fetching
When an error occurs during template fetching, the code proceeds by incrementing currentStep
and setting templates
as completed with null
values. This may lead to unexpected behavior if subsequent code assumes templates
contain valid data.
Consider handling the error appropriately, possibly by displaying an error message or halting further processing.
useEffect(() => { | ||
const fetchMicroplanData = async () => { | ||
try { | ||
const { id, tenantId } = data?.updatedCampaignData; |
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.
Ensure data.updatedCampaignData
is defined before destructuring
Destructuring data?.updatedCampaignData
without confirming it exists can cause runtime errors.
Apply this fix:
+ if (data?.updatedCampaignData) {
const { id, tenantId } = data.updatedCampaignData;
+ } else {
+ console.error("updatedCampaignData is undefined");
+ // Handle the error appropriately
+ }
Committable suggestion skipped: line range outside the PR's diff.
🧰 Tools
🪛 Biome (1.9.4)
[error] 104-104: Unsafe usage of optional chaining.
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
(lint/correctness/noUnsafeOptionalChaining)
const [templates, setTemplates] = useState(null); | ||
const [microplan, setMicroplan] = useState(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)
Remove unused state variable microplan
The state variable microplan
is set but never used in the component. Consider removing it to clean up the code.
Apply this diff to remove the unused state:
- const [microplan, setMicroplan] = useState(null);
Also, remove or adjust any code that sets microplan
.
Committable suggestion skipped: line range outside the PR's diff.
* Heading added * changes to query, for kpi card * css change * css package update
updates
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
⛔ 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 (2)
health/micro-ui/web/micro-ui-internals/example/public/index.html
(2 hunks)health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplan.scss
(1 hunks)
🧰 Additional context used
📓 Learnings (1)
health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplan.scss (1)
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-11-10T20:01:49.000Z
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.
🔇 Additional comments (5)
health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplan.scss (5)
187-187
:
Fix syntax error in border-bottom property
The border-bottom property has incorrect syntax with quotes.
Apply this fix:
- border-bottom: '1px solid #e0e0e0' /* Align items vertically in the center */
+ border-bottom: 1px solid #e0e0e0; /* Add bottom border */
Likely invalid or redundant comment.
373-378
: 🧹 Nitpick (assertive)
Standardize spacing units
The gap property uses inconsistent units (0rem vs 24px elsewhere).
Apply this change:
.fac-kpi-container {
display: flex;
justify-content: space-between;
- gap: 0rem;
+ gap: 1.5rem;
align-items: center;
}
Likely invalid or redundant comment.
344-350
: 🛠️ Refactor suggestion
Improve grid layout implementation
The activity grid implementation has several issues:
- Fixed percentage columns don't account for gaps
- Unnecessary vendor prefix for text-align
- Hardcoded margin
Apply these changes:
.activity-grid {
display: grid;
- grid-template-columns: 33.3% 33.3% 33.3%;
+ grid-template-columns: repeat(3, 1fr);
- text-align: -webkit-center;
+ text-align: center;
gap: 24px;
- margin-right: 3rem;
+ padding-right: 3rem;
+ @media screen and (max-width: 768px) {
+ grid-template-columns: 1fr;
+ }
}
Likely invalid or redundant comment.
1-29
:
Critical: Fix accessibility issues in search tabs
The search tabs implementation has several accessibility concerns:
- Removing focus outline (line 27) harms keyboard navigation
- Missing ARIA attributes for tab roles and states
- Inconsistent color formats and hardcoded values
Apply these changes:
.search-tabs-container {
display: flex;
justify-content: space-between;
background-color: theme(digitv2.lightTheme.background-secondary);
.search-tab-head {
+ role: "tab";
+ aria-selected: "false";
padding: 10px 35px;
font-weight: 700;
font-size: 1rem;
border: 1px solid theme(digitv2.lightTheme.border);
border-radius: 0.5rem 0.5rem 0 0;
}
.search-tab-head-selected {
+ role: "tab";
+ aria-selected: "true";
padding: 10px 35px;
- color: rgb(244, 119, 56);
- border: 1px solid #f47738;
- border-bottom: 4px solid rgb(244, 119, 56);
+ color: theme(digitv2.lightTheme.primary);
+ border: 1px solid theme(digitv2.lightTheme.primary);
+ border-bottom: 4px solid theme(digitv2.lightTheme.primary);
font-weight: 700;
font-size: 1.125rem;
margin-bottom: -1rem;
}
.search-tab-head-selected:focus {
- outline: 0;
+ outline: 2px solid theme(digitv2.lightTheme.primary);
+ outline-offset: 2px;
}
}
Likely invalid or redundant comment.
127-160
: 🛠️ Refactor suggestion
Enhance table layout for better performance and accessibility
The table-like structure implementation has performance and accessibility concerns:
- Fixed table layout can cause performance issues
- Fixed widths may cause content overflow on mobile
- Missing ARIA roles for table structure
Apply these changes:
.as-table-like {
display: table;
width: 100%;
border-collapse: collapse;
- table-layout: fixed;
+ table-layout: auto;
+ role: "table";
}
.as-table-row {
display: table-row;
+ role: "row";
border-bottom: 1px solid theme(digitv2.lightTheme.border);
}
.as-key-cell {
font-weight: bold;
- min-width: 20rem;
+ width: 30%;
+ role: "rowheader";
background-color: #fff;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
+ @media screen and (max-width: 768px) {
+ width: 100%;
+ white-space: normal;
+ }
}
Likely invalid or redundant comment.
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" /> | ||
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" /> | ||
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" /> |
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)
Document the new health CSS module's scope and dependencies
The addition of a domain-specific CSS module (digit-ui-health-css
) represents a shift in styling architecture. To maintain clarity:
- The load order looks correct (base → components → feature-specific)
- Consider documenting:
- The scope and purpose of the health CSS module
- Any potential style overrides or dependencies between modules
- Guidelines for other teams adding domain-specific CSS modules
tbody tr:last-child td:last-child .digit-dropdown-employee-select-wrap .digit-dropdown-options-card { | ||
position: relative; | ||
} | ||
|
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)
💡 Codebase verification
Dropdown positioning needs to be absolute, not relative
The search results confirm that in other implementations of the same dropdown component across the codebase, the positioning is consistently set as absolute
. Specifically in microplanning.scss
, the same dropdown class uses position: absolute
. Setting it to relative
in this case would break the expected dropdown behavior.
health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplan.scss
: Changeposition: relative
toposition: absolute
- Consider adding
max-height
constraint as seen inemployee/index.scss
where it's set to10rem
🔗 Analysis chain
Fix dropdown positioning
The dropdown positioning override might cause issues with long lists or at screen edges.
Consider using a more robust positioning solution:
tbody tr:last-child td:last-child .digit-dropdown-employee-select-wrap .digit-dropdown-options-card {
- position: relative;
+ position: absolute;
+ bottom: 100%;
+ max-height: 200px;
+ overflow-y: auto;
}
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check for other dropdown implementations that might conflict
rg -l "digit-dropdown-options-card" --type scss
Length of output: 76
Script:
#!/bin/bash
# Search for dropdown related styles with ripgrep, including all possible file extensions for stylesheets
rg -l "digit-dropdown-options-card" -g "*.css" -g "*.scss" -g "*.sass" -g "*.less"
# Also search for the class name in the codebase to understand its usage
rg "digit-dropdown-options-card" -g "*.{js,jsx,ts,tsx,css,scss,sass,less}" -C 2
Length of output: 2542
/* Parent container */ | ||
.dm-parent-container { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
background: #FAFAFA; | ||
padding: 0.5rem 1rem; | ||
margin: 0.5rem 0; | ||
cursor: pointer; | ||
} | ||
|
||
/* Uploaded file container (left side) */ | ||
.dm-uploaded-file-container-sub { | ||
display: flex; | ||
align-items: center; | ||
cursor: pointer; | ||
} | ||
|
||
.dm-icon { | ||
margin-right: 0.5rem; /* Space between icon and filename */ | ||
} | ||
|
||
.dm-file-name { | ||
color: #505a5f; | ||
font-weight: 700; | ||
font-size: 0.875rem; /* Smaller text size */ | ||
} | ||
|
||
/* Actions container (right side) */ | ||
.dm-actions-container { | ||
display: flex; | ||
align-items: center; | ||
gap: 1rem; /* Space between edit and delete buttons */ | ||
} | ||
|
||
/* Edit container */ | ||
.dm-campaign-preview-edit-container { | ||
display: flex; | ||
align-items: center; | ||
cursor: pointer; | ||
} | ||
|
||
.dm-campaign-preview-edit-container span { | ||
/*margin-right: 0.25rem;*/ | ||
font-size: 0.875rem; | ||
font-weight: 500; | ||
color: #dc5a32; /* Orange color for the text */ | ||
} | ||
|
||
/* Button styles */ | ||
.dm-workbench-download-template-btn { | ||
border: 1px solid #dc5a32; /* Orange border */ | ||
background-color: transparent; | ||
color: #dc5a32; /* Orange text */ | ||
padding: 0.25rem 0.5rem; | ||
border-radius: 4px; | ||
font-size: 0.875rem; /* Small font size */ | ||
font-weight: 500; | ||
cursor: pointer; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
/* Hover effect for the button */ | ||
.dm-hover:hover { | ||
background-color: #fbe9e6; | ||
border-color: #dc5a32; | ||
} |
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
Improve document management component structure
The document management components have several areas for improvement:
- Redundant cursor properties (lines 39, 46)
- Hardcoded colors instead of theme variables
- Commented out code (line 74)
Apply these changes:
.dm-parent-container {
display: flex;
justify-content: space-between;
align-items: center;
background: theme(digitv2.lightTheme.background-secondary);
padding: 0.5rem 1rem;
margin: 0.5rem 0;
cursor: pointer;
}
.dm-uploaded-file-container-sub {
display: flex;
align-items: center;
- cursor: pointer; /* Remove redundant cursor */
}
.dm-file-name {
color: theme(digitv2.lightTheme.text-secondary);
font-weight: 700;
font-size: 0.875rem;
}
.dm-campaign-preview-edit-container span {
- /*margin-right: 0.25rem;*/ /* Remove commented code */
font-size: 0.875rem;
font-weight: 500;
- color: #dc5a32;
+ color: theme(digitv2.lightTheme.primary);
}
📝 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.
/* Parent container */ | |
.dm-parent-container { | |
display: flex; | |
justify-content: space-between; | |
align-items: center; | |
background: #FAFAFA; | |
padding: 0.5rem 1rem; | |
margin: 0.5rem 0; | |
cursor: pointer; | |
} | |
/* Uploaded file container (left side) */ | |
.dm-uploaded-file-container-sub { | |
display: flex; | |
align-items: center; | |
cursor: pointer; | |
} | |
.dm-icon { | |
margin-right: 0.5rem; /* Space between icon and filename */ | |
} | |
.dm-file-name { | |
color: #505a5f; | |
font-weight: 700; | |
font-size: 0.875rem; /* Smaller text size */ | |
} | |
/* Actions container (right side) */ | |
.dm-actions-container { | |
display: flex; | |
align-items: center; | |
gap: 1rem; /* Space between edit and delete buttons */ | |
} | |
/* Edit container */ | |
.dm-campaign-preview-edit-container { | |
display: flex; | |
align-items: center; | |
cursor: pointer; | |
} | |
.dm-campaign-preview-edit-container span { | |
/*margin-right: 0.25rem;*/ | |
font-size: 0.875rem; | |
font-weight: 500; | |
color: #dc5a32; /* Orange color for the text */ | |
} | |
/* Button styles */ | |
.dm-workbench-download-template-btn { | |
border: 1px solid #dc5a32; /* Orange border */ | |
background-color: transparent; | |
color: #dc5a32; /* Orange text */ | |
padding: 0.25rem 0.5rem; | |
border-radius: 4px; | |
font-size: 0.875rem; /* Small font size */ | |
font-weight: 500; | |
cursor: pointer; | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
} | |
/* Hover effect for the button */ | |
.dm-hover:hover { | |
background-color: #fbe9e6; | |
border-color: #dc5a32; | |
} | |
/* Parent container */ | |
.dm-parent-container { | |
display: flex; | |
justify-content: space-between; | |
align-items: center; | |
background: theme(digitv2.lightTheme.background-secondary); | |
padding: 0.5rem 1rem; | |
margin: 0.5rem 0; | |
cursor: pointer; | |
} | |
/* Uploaded file container (left side) */ | |
.dm-uploaded-file-container-sub { | |
display: flex; | |
align-items: center; | |
} | |
.dm-icon { | |
margin-right: 0.5rem; /* Space between icon and filename */ | |
} | |
.dm-file-name { | |
color: theme(digitv2.lightTheme.text-secondary); | |
font-weight: 700; | |
font-size: 0.875rem; /* Smaller text size */ | |
} | |
/* Actions container (right side) */ | |
.dm-actions-container { | |
display: flex; | |
align-items: center; | |
gap: 1rem; /* Space between edit and delete buttons */ | |
} | |
/* Edit container */ | |
.dm-campaign-preview-edit-container { | |
display: flex; | |
align-items: center; | |
cursor: pointer; | |
} | |
.dm-campaign-preview-edit-container span { | |
font-size: 0.875rem; | |
font-weight: 500; | |
color: theme(digitv2.lightTheme.primary); | |
} | |
/* Button styles */ | |
.dm-workbench-download-template-btn { | |
border: 1px solid #dc5a32; /* Orange border */ | |
background-color: transparent; | |
color: #dc5a32; /* Orange text */ | |
padding: 0.25rem 0.5rem; | |
border-radius: 4px; | |
font-size: 0.875rem; /* Small font size */ | |
font-weight: 500; | |
cursor: pointer; | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
} | |
/* Hover effect for the button */ | |
.dm-hover:hover { | |
background-color: #fbe9e6; | |
border-color: #dc5a32; | |
} |
* Added dynamic columns in facility screen * changed the filter condition * Update FacilityPopup.js --------- Co-authored-by: rachana-egov <[email protected]> Co-authored-by: Nipun Arora <[email protected]>
Co-authored-by: Nipun Arora <[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: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
📒 Files selected for processing (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/BoundaryRelationCreate.js
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/BoundaryRelationCreate.js (1)
Pattern **/*.js
: check
🪛 Biome (1.9.4)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/BoundaryRelationCreate.js
[error] 308-308: The catch clause that only rethrows the original error is useless.
An unnecessary catch clause can be confusing.
Unsafe fix: Remove the try/catch clause.
(lint/complexity/noUselessCatch)
[error] 350-350: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 467-467: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
Unsafe fix: Use a SelfClosingElement instead
(lint/style/useSelfClosingElements)
[error] 473-473: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 475-475: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
Unsafe fix: Use a SelfClosingElement instead
(lint/style/useSelfClosingElements)
[error] 480-480: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 492-492: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
Unsafe fix: Use a SelfClosingElement instead
(lint/style/useSelfClosingElements)
[error] 516-516: 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)
[error] 522-522: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
Unsafe fix: Use a SelfClosingElement instead
(lint/style/useSelfClosingElements)
[error] 538-538: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
Unsafe fix: Use a SelfClosingElement instead
(lint/style/useSelfClosingElements)
[error] 597-597: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
Unsafe fix: Use a SelfClosingElement instead
(lint/style/useSelfClosingElements)
[error] 599-599: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
Unsafe fix: Use a SelfClosingElement instead
(lint/style/useSelfClosingElements)
[error] 620-620: 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)
[error] 626-626: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
Unsafe fix: Use a SelfClosingElement instead
(lint/style/useSelfClosingElements)
[error] 23-23: This let declares a variable that is only assigned once.
'locale' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 27-27: This let declares a variable that is only assigned once.
'receivedData' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 73-73: This let declares a variable that is only assigned once.
'flag' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 235-235: This let declares a variable that is only assigned once.
'errorString' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 502-502: Missing key property for this element in iterable.
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.
(lint/correctness/useJsxKeyInIterable)
[error] 547-555: Missing key property for this element in iterable.
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.
(lint/correctness/useJsxKeyInIterable)
[error] 556-573: Missing key property for this element in iterable.
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.
(lint/correctness/useJsxKeyInIterable)
[error] 602-602: Missing key property for this element in iterable.
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.
(lint/correctness/useJsxKeyInIterable)
[error] 647-655: Missing key property for this element in iterable.
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.
(lint/correctness/useJsxKeyInIterable)
[error] 656-675: Missing key property for this element in iterable.
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.
(lint/correctness/useJsxKeyInIterable)
🔇 Additional comments (15)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/BoundaryRelationCreate.js (15)
23-23
: Use 'const' instead of 'let' for 'locale' variable
The variable locale
is not reassigned after its initial assignment. It should be declared as const
to prevent accidental reassignment.
🧰 Tools
🪛 Biome (1.9.4)
[error] 23-23: This let declares a variable that is only assigned once.
'locale' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
27-27
: Use 'const' instead of 'let' for 'receivedData' variable
The variable receivedData
is not reassigned after its initial assignment. Consider declaring it with const
for better code clarity.
🧰 Tools
🪛 Biome (1.9.4)
[error] 27-27: This let declares a variable that is only assigned once.
'receivedData' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
35-35
: Undefined variable 'module' in useUpsertLocalisation
The variable module
is not defined before its usage in Digit.Hooks.campaign.useUpsertLocalisation(tenantId, module, locale);
, which will cause a ReferenceError
at runtime.
73-73
: Use 'const' instead of 'let' for 'flag' variable
The variable flag
is never reassigned and can be declared using const
instead of let
.
🧰 Tools
🪛 Biome (1.9.4)
[error] 73-73: This let declares a variable that is only assigned once.
'flag' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
235-235
: Use 'const' instead of 'let' for 'errorString' variable
The variable errorString
is not reassigned after its declaration. Using const
is preferable.
🧰 Tools
🪛 Biome (1.9.4)
[error] 235-235: This let declares a variable that is only assigned once.
'errorString' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
308-309
: Remove unnecessary try-catch block that rethrows the error
The catch block rethrows the caught error without any additional processing, making it unnecessary.
🧰 Tools
🪛 Biome (1.9.4)
[error] 308-308: The catch clause that only rethrows the original error is useless.
An unnecessary catch clause can be confusing.
Unsafe fix: Remove the try/catch clause.
(lint/complexity/noUselessCatch)
314-314
: Undefined function 'setDisable'
The function setDisable
is called but not defined within this component. This will cause a ReferenceError
at runtime.
450-450
: Use strict equality operator ===
for comparison
To ensure type-safe comparisons, use the strict equality operator ===
when comparing newHierarchy
to false
.
467-467
: Use self-closing tag for empty <div>
element
The empty <div>
at line 467 can be converted to a self-closing tag to improve code cleanliness.
🧰 Tools
🪛 Biome (1.9.4)
[error] 467-467: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
Unsafe fix: Use a SelfClosingElement instead
(lint/style/useSelfClosingElements)
475-475
: Use self-closing tag for empty <div>
element
The <div>
element is empty and can be self-closed for cleaner code.
🧰 Tools
🪛 Biome (1.9.4)
[error] 475-475: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
Unsafe fix: Use a SelfClosingElement instead
(lint/style/useSelfClosingElements)
516-516
: Ensure accessibility by adding keyboard event handlers
The div
with an onClick
handler should be accessible via keyboard navigation. Consider using a button
element or adding keyboard event handlers for better accessibility.
🧰 Tools
🪛 Biome (1.9.4)
[error] 516-516: 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)
620-620
: Ensure accessibility by adding keyboard event handlers
Similar to the previous instance, the div
with an onClick
handler should support keyboard interactions for accessibility.
🧰 Tools
🪛 Biome (1.9.4)
[error] 620-620: 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)
597-597
: Use self-closing tag for empty <div>
element
The empty <div>
at line 597 can be self-closed to enhance code readability.
🧰 Tools
🪛 Biome (1.9.4)
[error] 597-597: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
Unsafe fix: Use a SelfClosingElement instead
(lint/style/useSelfClosingElements)
664-672
: Extract inline function for better readability
The onClick
handler contains complex logic implemented inline. Consider extracting this logic into a separate function to improve readability and maintainability.
422-438
: Avoid mutating state directly within setState
Modifying items directly within setState
can lead to unexpected behavior. Instead, create new objects to maintain immutability.
// first call the upsert | ||
// then call the create bouondary |
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)
Typo in comment: 'bouondary' should be 'boundary'
There's a typographical error in the comment on line 336. Correct it to 'boundary' for clarity.
* Added fixes for timeout and redirection for fetch microplan * Update useFetchFromMicroplan.js * Update health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/fetchFromMicroplan.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/fetchFromMicroplan.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Added fixes for the template generation * Update health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/fetchFromMicroplan.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/fetchFromMicroplan.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * updated --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
📒 Files selected for processing (2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/fetchFromMicroplan.js
(1 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/useFetchFromMicroplan.js
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/fetchFromMicroplan.js (1)
Pattern **/*.js
: check
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/useFetchFromMicroplan.js (1)
Pattern **/*.js
: check
🪛 Biome (1.9.4)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/fetchFromMicroplan.js
[error] 50-50: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 56-56: Unsafe usage of optional chaining.
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
(lint/correctness/noUnsafeOptionalChaining)
[error] 95-95: Unsafe usage of optional chaining.
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
(lint/correctness/noUnsafeOptionalChaining)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/useFetchFromMicroplan.js
[error] 133-133: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 138-138: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
🔇 Additional comments (15)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/useFetchFromMicroplan.js (11)
11-11
: Standardize Parameter Order Across Functions
The parameter order for fetchFromMicroplan
is (campaignId, tenantId, planConfigId)
, while other functions like fetchConsolidatedData
and useFetchFromMicroplan
use (tenantId, campaignId, planConfigId)
. This inconsistency can lead to confusion and potential bugs.
Apply this diff to standardize the parameter order:
-export const fetchFromMicroplan = async (campaignId, tenantId, planConfigId) => {
+export const fetchFromMicroplan = async (tenantId, campaignId, planConfigId) => {
Ensure that all calls to fetchFromMicroplan
are updated to match the new parameter order.
21-21
: Clarify Hardcoded resourceId
The resourceId
is hardcoded as "filestoreid"
. If this is intentional, consider adding a comment to explain its purpose. If it's a placeholder, you might want to parameterize it to avoid potential issues in different environments.
Apply this diff to add a clarifying comment:
planConfigurationId: planConfigId,
- resourceId: "filestoreid",
+ resourceId: "filestoreid", // Placeholder resource ID; replace with actual ID if necessary
26-29
: Consistent Error Handling: Throw Errors Instead of Returning Them
In the catch
block of fetchFromMicroplan
, you're returning the error
object. It's preferable to throw the error to allow upstream functions to handle it appropriately, ensuring consistency in error handling.
Apply this diff to throw the error:
} catch (error) {
console.error("Error fetching CampaignDetails:", error);
- return error;
+ throw error;
}
44-47
: Consistent Error Handling: Throw Errors Instead of Returning Them
In the catch
block of searchCampaign
, you're returning the error
object. Throwing the error ensures that upstream functions can handle it appropriately.
Apply this diff to throw the error:
} catch (error) {
console.error("Error fetching CampaignDetails:", error);
- return error;
+ throw error;
}
63-66
: Consistent Error Handling: Throw Errors Instead of Returning Them
In the catch
block of updateCampaign
, consider throwing the error instead of returning it to maintain consistent error handling practices.
Apply this diff to throw the error:
} catch (error) {
console.error("Error fetching CampaignDetails:", error);
- return error;
+ throw error;
}
97-100
: Consistent Error Handling: Throw Errors Instead of Returning Them
In the catch
block of createCampaign
, it's advisable to throw the error to allow upstream functions to handle it appropriately.
Apply this diff to throw the error:
} catch (error) {
console.error("Error creating campaign:", error);
- return error;
+ throw error;
}
119-121
: Fix Campaign Existence Check
The condition if (!campaignData)
may not correctly detect when no campaign is found because an empty object {}
is truthy in JavaScript. Since searchCampaign
returns {}
when no campaign is found, the error "No campaign found."
might not be thrown as expected. Consider modifying the condition to check if campaignData
is an empty object.
Apply this diff to correctly handle the case when no campaign is found:
if (!campaignData) {
+ if (!campaignData || Object.keys(campaignData).length === 0) {
throw new Error("No campaign found.");
}
133-133
: Simplify Conditional Assignment with Optional Chaining
You can enhance readability by using optional chaining (?.
) and a ternary operator in your assignment.
Apply this diff to simplify the code:
- const newCampaignSearchResponse = newCampaignResponse&&newCampaignResponse?.id&& await searchCampaign(newCampaignResponse?.id,tenantId);
+ const newCampaignSearchResponse = newCampaignResponse?.id ? await searchCampaign(newCampaignResponse.id, tenantId) : null;
🧰 Tools
🪛 Biome (1.9.4)
[error] 133-133: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
138-138
: Simplify Conditional Assignment with Optional Chaining
Similarly, simplify the assignment of updatedCampaignData
using optional chaining and a ternary operator.
Apply this diff to simplify the code:
- const updatedCampaignData = newCampaignResponse && newCampaignResponse?.id && newCampaignSearchResponse && await updateCampaign({...newCampaignSearchResponse, boundaries: campaignData?.boundaries}, "update");
+ const updatedCampaignData = newCampaignResponse?.id && newCampaignSearchResponse ? await updateCampaign({ ...newCampaignSearchResponse, boundaries: campaignData?.boundaries }, "update") : null;
🧰 Tools
🪛 Biome (1.9.4)
[error] 138-138: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
81-82
: Avoid Hardcoded Time Values: Use Constants or Configuration
You're adding fixed millisecond values for startDate
and endDate
. Hardcoding these values can reduce flexibility and make future changes cumbersome. Consider defining these durations as constants for better readability and maintainability.
Apply this diff to use constants:
+ const ONE_DAY_IN_MS = 86400000; // 1 day in milliseconds
+ const THREE_DAYS_IN_MS = 259200000; // 3 days in milliseconds
const campaignPayload = {
...campaignData,
- startDate: Date.now() + 86400000, // 1 day later
- endDate: Date.now() + 259200000, // 3 days later
+ startDate: Date.now() + ONE_DAY_IN_MS, // 1 day later
+ endDate: Date.now() + THREE_DAYS_IN_MS, // 3 days later
id: null,
auditDetails: null,
Alternatively, consider accepting these durations as function parameters or fetching them from a configuration file to enhance adaptability.
146-149
: Consistent Error Handling: Throw Errors Instead of Returning Them
In the catch
block of fetchConsolidatedData
, throw the error instead of returning it to maintain consistent error handling practices.
Apply this diff to throw the error:
} catch (error) {
console.error("Error fetching consolidated data:", error);
- return { error };
+ throw error;
}
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/fetchFromMicroplan.js (4)
56-56
: Ensure data.updatedCampaignData
exists before destructuring
Destructuring data?.updatedCampaignData
without confirming it exists can cause runtime errors. Please verify that data.updatedCampaignData
is not undefined before destructuring.
🧰 Tools
🪛 Biome (1.9.4)
[error] 56-56: Unsafe usage of optional chaining.
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
(lint/correctness/noUnsafeOptionalChaining)
95-95
: Ensure data.updatedCampaignData
exists before destructuring
Destructuring data?.updatedCampaignData
without confirming it exists can cause runtime errors. Please verify that data.updatedCampaignData
is not undefined before destructuring.
🧰 Tools
🪛 Biome (1.9.4)
[error] 95-95: Unsafe usage of optional chaining.
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
(lint/correctness/noUnsafeOptionalChaining)
192-192
: Avoid using async functions directly in useEffect
; define and invoke them inside the effect instead.
Declaring useEffect
as async can lead to unexpected behaviors. Instead, define an async
function inside the effect and call it.
237-237
: Verify that the Toast component handles 'warn'
as a valid type
The Toast
component receives type={showToast?.key}
, which can be 'warn'
. Ensure that the Toast
component accepts 'warn'
as a valid type
, or map it to a valid type like 'warning'
or 'info'
to prevent potential rendering issues.
data?.updatedCampaignData?.id, | ||
data?.updatedCampaignData?.tenantId | ||
); | ||
if (response?.resources && response?.resources?.length ==3) { |
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)
Use strict equality comparison
It's recommended to use ===
instead of ==
for strict equality comparisons to prevent unintended type coercion.
Apply this diff:
- if (response?.resources && response?.resources?.length ==3) {
+ if (response?.resources && response?.resources?.length === 3) {
📝 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.
if (response?.resources && response?.resources?.length ==3) { | |
if (response?.resources && response?.resources?.length === 3) { |
/> | ||
|
||
<div className="sandbox-loader-screen" style={{ height: "100%" }}> | ||
{showToast?.key != "error" && <LoaderWithGap text={t("DATA_FECTHING_FROM_SERVER")} />} |
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.
Correct typo in translation key
The translation key "DATA_FECTHING_FROM_SERVER"
contains a typo. "FECTHING" should be "FETCHING".
Apply this diff to fix the typo:
- {showToast?.key != "error" && <LoaderWithGap text={t("DATA_FECTHING_FROM_SERVER")} />}
+ {showToast?.key != "error" && <LoaderWithGap text={t("DATA_FETCHING_FROM_SERVER")} />}
📝 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.
{showToast?.key != "error" && <LoaderWithGap text={t("DATA_FECTHING_FROM_SERVER")} />} | |
{showToast?.key != "error" && <LoaderWithGap text={t("DATA_FETCHING_FROM_SERVER")} />} |
setCurrentStep((prev) => TEMPLATE_GENERATION_STEP); | ||
} catch (error) { | ||
console.error("Error fetching templates:", error); | ||
setShowToast({ key: "warn", label: t("EMPTY_TEMPLATE_GENERTAION_NOTCOMPLETED_STILL_PROCEEDING") }); |
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 typo in translation key
The translation key "EMPTY_TEMPLATE_GENERTAION_NOTCOMPLETED_STILL_PROCEEDING"
contains a typo. "GENERTAION" should be corrected to "GENERATION".
Apply this diff to fix the typo:
- setShowToast({ key: "warn", label: t("EMPTY_TEMPLATE_GENERTAION_NOTCOMPLETED_STILL_PROCEEDING") });
+ setShowToast({ key: "warn", label: t("EMPTY_TEMPLATE_GENERATION_NOTCOMPLETED_STILL_PROCEEDING") });
📝 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.
setShowToast({ key: "warn", label: t("EMPTY_TEMPLATE_GENERTAION_NOTCOMPLETED_STILL_PROCEEDING") }); | |
setShowToast({ key: "warn", label: t("EMPTY_TEMPLATE_GENERATION_NOTCOMPLETED_STILL_PROCEEDING") }); |
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: 9
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
📒 Files selected for processing (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/fetchFromMicroplan.js
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/fetchFromMicroplan.js (1)
Pattern **/*.js
: check
🪛 Biome (1.9.4)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/fetchFromMicroplan.js
[error] 50-50: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 56-56: Unsafe usage of optional chaining.
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
(lint/correctness/noUnsafeOptionalChaining)
[error] 95-95: Unsafe usage of optional chaining.
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
(lint/correctness/noUnsafeOptionalChaining)
🔇 Additional comments (8)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/fetchFromMicroplan.js (8)
23-23
: Add validation for tenantId
It is recommended to validate that tenantId
is available before proceeding to prevent potential issues.
44-44
: Correct typo in step description
There's a typo in the step description "UPDATED_CAMPAIGN_WITH_UPLODAED_DATA"
. The word "UPLODAED" should be "UPLOADED".
75-75
: Fix typo in translation key
The translation key "EMPTY_TEMPLATE_GENERTAION_NOTCOMPLETED_STILL_PROCEEDING"
contains a typo. "GENERTAION" should be corrected to "GENERATION".
143-143
: Fix typo in error message key
The translation key "SOME_ERROR_OCCURED_IN_FETCH"
contains a typo. "OCCURED" should be "OCCURRED".
192-192
: Avoid using async
directly in useEffect
; define and invoke inside
The useEffect
hook should not be declared as an async
function. Instead, define an async
function inside the effect and call it:
- useEffect(async () => {
+ useEffect(() => {
+ const navigateOnCompletion = async () => {
if (currentStep === steps.length && microplan) {
// Logic here
}
+ };
+ navigateOnCompletion();
}, [currentStep, microplan]);
222-222
: Correct typo in translation key
The translation key "DATA_FECTHING_FROM_SERVER"
contains a typo. "FECTHING" should be "FETCHING".
95-95
:
Ensure data.updatedCampaignData
is defined before destructuring
Destructuring data?.updatedCampaignData
without confirming it exists can cause runtime errors. Verify its existence before proceeding:
- const { id, tenantId } = data?.updatedCampaignData;
+ if (data?.updatedCampaignData) {
+ const { id, tenantId } = data.updatedCampaignData;
+ // Proceed with logic
+ } else {
+ // Handle the case where updatedCampaignData is undefined
+ }
Likely invalid or redundant comment.
🧰 Tools
🪛 Biome (1.9.4)
[error] 95-95: Unsafe usage of optional chaining.
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
(lint/correctness/noUnsafeOptionalChaining)
56-56
:
Ensure safe destructuring of data.updatedCampaignData
Destructuring data?.updatedCampaignData
without verifying its existence can lead to runtime errors if updatedCampaignData
is undefined
. Confirm its existence before destructuring:
- const { hierarchyType, id, tenantId } = data?.updatedCampaignData;
+ if (data?.updatedCampaignData) {
+ const { hierarchyType, id, tenantId } = data.updatedCampaignData;
+ // Proceed with logic
+ } else {
+ // Handle the case where updatedCampaignData is undefined
+ }
Likely invalid or redundant comment.
🧰 Tools
🪛 Biome (1.9.4)
[error] 56-56: Unsafe usage of optional chaining.
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
(lint/correctness/noUnsafeOptionalChaining)
const steps = [ | ||
"FETCHING_CAMPAIGN_DATA_FROM_MICROPLAN", | ||
"FETCHING_CAMPAIGN_TYPE_FROM_MICROPLAN", | ||
"FETCHING_CAMPAIGN_TARGET_FROM_MICROPLAN", | ||
"GENERATING_ALL_THE_TEMPLATES", | ||
"DOWNLOAD_THE_TARGET_TEMPLATE", | ||
"FILLING_CAMPAIGN_TARGET_DATA_FROM_MICROPLAN", | ||
"FETCHING_CAMPAIGN_FACILITY_FROM_MICROPLAN", | ||
"DOWNLOAD_THE_FACILITY_TEMPLATE", | ||
"FILLING_CAMPAIGN_FACILITY_DATA_FROM_MICROPLAN", | ||
"DOWNLOAD_THE_USER_TEMPLATE", | ||
"FETCHING_CAMPAIGN_USER_FROM_MICROPLAN", | ||
"FILLING_CAMPAIGN_USER_DATA_FROM_MICROPLAN", | ||
"UPDATED_CAMPAIGN_WITH_UPLODAED_DATA", | ||
"CMN_ALL_DATA_FETCH_DONE", | ||
]; |
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)
Consider moving step descriptions to a constants file
For better maintainability and reusability, consider extracting the steps
array into a dedicated constants or localization file. This approach will:
- Simplify updates to step descriptions without modifying component logic.
- Enhance readability by separating data from component code.
- Facilitate localization if step descriptions need to be translated.
const closeToast = () => { | ||
setShowToast(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)
Consider handling closeToast
cleanup in useEffect
Ensure that any timers or listeners related to closeToast
are properly cleaned up to prevent memory leaks. If you're setting timeouts or intervals to auto-close the toast, include a cleanup function:
useEffect(() => {
if (showToast) {
const toastTimeout = setTimeout(closeToast, 5000); // Adjust duration as needed
return () => clearTimeout(toastTimeout);
}
}, [showToast]);
import React, { useEffect, useState, Fragment } from "react"; | ||
import { CheckCircle } from "@egovernments/digit-ui-svg-components"; | ||
import { useHistory, useLocation } from "react-router-dom"; | ||
import { useTranslation } from "react-i18next"; | ||
import { Header, LoaderWithGap } from "@egovernments/digit-ui-react-components"; | ||
import { InfoCard, Toast } from "@egovernments/digit-ui-components"; | ||
import { callTemplateDownloadByUntilCompleted } from "../utils/pollUtils"; | ||
import { fetchFromMicroplan, searchCampaign, waitForSomeTime } from "../hooks/useFetchFromMicroplan"; |
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)
Organize imports and remove unused ones
For better readability and maintenance, organize your imports and remove any that are unused:
- Group React imports separately.
- Verify if all imported modules are used in the component.
|
||
useEffect(() => { | ||
const fetchTemplates = async () => { | ||
if (data && data?.updatedCampaignData) { |
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)
Simplify conditional check by using optional chaining
The check if (data && data?.updatedCampaignData)
can be simplified using optional chaining:
- if (data && data?.updatedCampaignData) {
+ if (data?.updatedCampaignData) {
This change improves readability without altering functionality.
📝 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.
if (data && data?.updatedCampaignData) { | |
if (data?.updatedCampaignData) { |
🧰 Tools
🪛 Biome (1.9.4)
[error] 50-50: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
<li key={currentStep + 1} className={`sandbox-step ${0 < currentStep ? "sandbox-visible" : ""}`}> | ||
<span className="sandbox-step-text"> | ||
{t("MP_COMPELTED_STEPS")} - {currentStep} {t("MP_OUT_OFF")} - {steps?.length} | ||
</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.
Fix typo in displayed text
In the string concatenation, "MP_COMPELTED_STEPS" contains a typo. "COMPELTED" should be "COMPLETED":
- {t("MP_COMPELTED_STEPS")} - {currentStep} {t("MP_OUT_OFF")} - {steps?.length}
+ {t("MP_COMPLETED_STEPS")} - {currentStep} {t("MP_OUT_OF")} - {steps?.length}
Committable suggestion skipped: line range outside the PR's diff.
<li key={index} className={`sandbox-step ${index < currentStep ? "sandbox-visible" : ""}`}> | ||
<span className="sandbox-step-text">{t(step)}</span> | ||
{index < currentStep && <CheckCircle fill="#00703C" />} | ||
</li> | ||
))} |
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)
Ensure key
prop uniqueness in list rendering
In your <ul>
rendering, ensure that the key
prop is unique and not based solely on the index, especially when the list might change dynamically. Using unique identifiers prevents rendering issues:
- {steps.map((step, index) => (
- <li key={index} className={`sandbox-step ${index < currentStep ? "sandbox-visible" : ""}`}>
+ {steps.map((step, index) => (
+ <li key={step} className={`sandbox-step ${index < currentStep ? "sandbox-visible" : ""}`}>
📝 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.
<li key={index} className={`sandbox-step ${index < currentStep ? "sandbox-visible" : ""}`}> | |
<span className="sandbox-step-text">{t(step)}</span> | |
{index < currentStep && <CheckCircle fill="#00703C" />} | |
</li> | |
))} | |
{steps.map((step, index) => ( | |
<li key={step} className={`sandbox-step ${index < currentStep ? "sandbox-visible" : ""}`}> | |
<span className="sandbox-step-text">{t(step)}</span> | |
{index < currentStep && <CheckCircle fill="#00703C" />} | |
</li> | |
))} |
useEffect(() => { | ||
if (data?.campaignData && data?.updatedCampaignData && currentStep > 0) { | ||
const interval = setInterval(() => { | ||
// Step constants for template generation and facility data | ||
|
||
// Skip template generation and facility data steps as they're handled separately | ||
if ( | ||
currentStep < steps.length && | ||
currentStep !== TEMPLATE_GENERATION_STEP && | ||
currentStep !== FACILITY_DATA_STEP && | ||
currentStep !== steps.length - 2 | ||
) { | ||
setCurrentStep((prev) => prev + 1); | ||
} | ||
}, 3000); | ||
|
||
return () => clearInterval(interval); | ||
} | ||
}, [currentStep, data]); |
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
Review interval setup in useEffect
to prevent multiple intervals
The useEffect
hook depends on currentStep
and data
, which may cause multiple intervals to be set up, leading to unexpected behavior or memory leaks. Ensure intervals are properly managed:
useEffect(() => {
- if (data?.campaignData && data?.updatedCampaignData && currentStep > 0) {
+ if (data?.campaignData && data?.updatedCampaignData && currentStep > 0 && !intervalRef.current) {
const interval = setInterval(() => {
// Logic
}, 3000);
+ intervalRef.current = interval;
return () => clearInterval(interval);
}
}, [data, currentStep]);
Committable suggestion skipped: line range outside the PR's diff.
useEffect(() => { | ||
const fetchCampaign = async () => { | ||
if (currentStep === steps.length - 2 && completed == null) { | ||
try { | ||
const response = await searchCampaign( | ||
data?.updatedCampaignData?.id, | ||
data?.updatedCampaignData?.tenantId | ||
); | ||
if (response?.resources && response?.resources?.length ==3) { | ||
setCompleted({ ...response }); | ||
setCurrentStep((curr) => curr + 1); | ||
} else { | ||
setShowToast({ key: "warning", label: t("SOME_ERROR_OCCURED_IN_FETCH_RETRYING") }); | ||
setCurrentStep(TEMPLATE_GENERATION_STEP); | ||
} | ||
} catch (error) { | ||
console.error("Error fetching campaign:", error); | ||
setShowToast({ key: "error", label: t("ERROR_FETCHING_CAMPAIGN") }); | ||
} | ||
} | ||
}; | ||
fetchCampaign(); | ||
}, [currentStep, completed]); |
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)
Optimize campaign fetching logic
The fetchCampaign
function inside the useEffect
may be called multiple times unnecessarily. Consider adding a flag or adjusting dependencies to prevent redundant calls:
useEffect(() => {
const fetchCampaign = async () => {
if (currentStep === steps.length - 2 && !completed) {
// Fetch logic
}
};
fetchCampaign();
-}, [currentStep, completed]);
+}, [currentStep]);
Committable suggestion skipped: line range outside the PR's diff.
return ( | ||
<> | ||
<Header styles={{ fontSize: "32px" }}>{t("MY_FETCH_FROM_MICROPLAN_HEADING")}</Header> | ||
<InfoCard | ||
populators={{ | ||
name: "infocard", | ||
}} | ||
variant="info" | ||
text={t("HCM_FETCH_FROM_PLAN_INFO")} | ||
style={{ marginTop: "1rem", maxWidth: "100%", marginBottom: "1rem" }} | ||
/> | ||
|
||
<div className="sandbox-loader-screen" style={{ height: "100%" }}> | ||
{showToast?.key != "error" && <LoaderWithGap text={t("DATA_FECTHING_FROM_SERVER")} />} | ||
<ul className="sandbox-installation-steps" style={{ margin: "1rem" }}> | ||
{steps.map((step, index) => ( | ||
<li key={index} className={`sandbox-step ${index < currentStep ? "sandbox-visible" : ""}`}> | ||
<span className="sandbox-step-text">{t(step)}</span> | ||
{index < currentStep && <CheckCircle fill="#00703C" />} | ||
</li> | ||
))} | ||
<li key={currentStep + 1} className={`sandbox-step ${0 < currentStep ? "sandbox-visible" : ""}`}> | ||
<span className="sandbox-step-text"> | ||
{t("MP_COMPELTED_STEPS")} - {currentStep} {t("MP_OUT_OFF")} - {steps?.length} | ||
</span> | ||
</li> | ||
</ul> | ||
</div> | ||
{showToast && <Toast type={showToast?.key} label={t(showToast?.label)} onClose={closeToast} />} | ||
</> | ||
); |
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)
Improve accessibility and semantics in JSX
Consider enhancing the accessibility of your component:
- Use semantic HTML elements where appropriate.
- Add ARIA attributes to improve screen reader support.
Example:
- <div className="sandbox-loader-screen" style={{ height: "100%" }}>
+ <section className="sandbox-loader-screen" style={{ height: "100%" }} aria-label="Data Loading">
Committable suggestion skipped: line range outside the PR's diff.
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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
📒 Files selected for processing (1)
health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js
(4 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js (1)
Pattern **/*.js
: check
🪛 Biome (1.9.4)
health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js
[error] 801-801: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 802-802: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 803-803: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 811-824: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 875-875: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 886-886: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 897-897: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 908-908: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 975-1009: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 986-986: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 998-998: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 1074-1074: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 1095-1095: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 1116-1116: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 1128-1128: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 1190-1190: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
[error] 1191-1191: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
[error] 1289-1289: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
🔇 Additional comments (4)
health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js (4)
801-803
: Wrap 'case' blocks in braces to restrict variable scope
Variables declared within case
clauses without braces are hoisted and can be accessed by other cases, potentially leading to unintended side effects. Wrap the contents of the case "ACTIONS"
block in braces {}
to properly scope dummyFile
, microplanFileId
, options
, and the handleDownload
function.
Apply this change:
switch (key) {
case "ACTIONS": {
// TODO : Replace dummy file id with real file id when API is ready
const dummyFile = "c22a7676-d5d7-49b6-bcdb-83e9519f58df";
const microplanFileId = row?.campaignDetails?.additionalDetails?.microplanFileId || dummyFile;
let options = [];
if (row?.status == "DRAFT") {
options = [{ code: "1", name: "MP_ACTIONS_EDIT_SETUP" }];
} else {
options = [{ code: "1", name: "MP_ACTIONS_VIEW_SUMMARY" }];
}
const handleDownload = () => {
const files = row?.files;
const file = files.find((item) => item.templateIdentifier === "Population");
const fileId = file?.filestoreId;
const campaignName = row?.name || "";
if (!fileId) {
console.error("Population template file not found");
return;
}
Digit.Utils.campaign.downloadExcelWithCustomName({
fileStoreId: fileId,
customName: campaignName,
});
};
return (
<div>
{microplanFileId && row?.status == "RESOURCE_ESTIMATIONS_APPROVED" ? (
<div>
<ButtonNew style={{ width: "100%" }} onClick={handleDownload} label={t("WBH_DOWNLOAD_MICROPLAN")} />
</div>
) : (
<Dropdown
t={t}
option={options}
select={(e) => {
if (e.name == "MP_ACTIONS_EDIT_SETUP") {
window.location.href = `/${window.contextPath}/employee/microplan/setup-microplan?key=${1}µplanId=${row.id}&campaignId=${row.campaignDetails.id}`;
}
if (e.name == "MP_ACTIONS_VIEW_SUMMARY") {
window.location.href = `/${window.contextPath}/employee/microplan/setup-microplan?key=${10}µplanId=${row.id}&campaignId=${row.campaignDetails.id}&setup-completed=true`;
}
}}
optionKey={"name"}
selected={{ code: "1", name: "MP_ACTIONS_FOR_MICROPLAN_SEARCH" }}
/>
)}
</div>
);
}
// Other cases...
}
Also applies to: 811-824
🧰 Tools
🪛 Biome (1.9.4)
[error] 801-801: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 802-802: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 803-803: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
875-875
: Use template literals instead of string concatenation
For better readability and maintainability, prefer using template literals over string concatenation when constructing strings.
Apply these changes:
- return <p>{t(Digit.Utils.locale.getTransformedLocale("MICROPLAN_STATUS_" + value))}</p>;
+ return <p>{t(Digit.Utils.locale.getTransformedLocale(`MICROPLAN_STATUS_${value}`))}</p>;
- return <p>{t(Digit.Utils.locale.getTransformedLocale("MICROPLAN_DISEASE_" + value))}</p>;
+ return <p>{t(Digit.Utils.locale.getTransformedLocale(`MICROPLAN_DISEASE_${value}`))}</p>;
- return <p>{t(Digit.Utils.locale.getTransformedLocale("MICROPLAN_TYPE_" + value))}</p>;
+ return <p>{t(Digit.Utils.locale.getTransformedLocale(`MICROPLAN_TYPE_${value}`))}</p>;
- return <p>{t(Digit.Utils.locale.getTransformedLocale("MICROPLAN_DISTRIBUTION_" + value))}</p>;
+ return <p>{t(Digit.Utils.locale.getTransformedLocale(`MICROPLAN_DISTRIBUTION_${value}`))}</p>;
Also applies to: 886-886, 897-897, 908-908, 1074-1074, 1095-1095, 1116-1116, 1128-1128
🧰 Tools
🪛 Biome (1.9.4)
[error] 875-875: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
906-906
: Correct the spelling of 'DISTIRBUTION_STRATEGY'
The case key 'DISTIRBUTION_STRATEGY'
is misspelled. It should be 'DISTRIBUTION_STRATEGY'
to ensure the switch case works as intended.
Apply this fix:
case "DISTIRBUTION_STRATEGY":
+ // Corrected spelling
- if (value && value != "NA") {
+ case "DISTRIBUTION_STRATEGY":
if (value && value != "NA") {
1190-1191
: Avoid using the delete
operator for better performance
Assigning undefined
to object properties is generally more performant than using the delete
operator. Consider setting the properties to undefined
instead of deleting them.
Apply this diff:
- delete data.params.roleschosen;
+ data.params.roleschosen = undefined;
- delete data.params.name;
+ data.params.name = undefined;
🧰 Tools
🪛 Biome (1.9.4)
[error] 1190-1190: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
[error] 1191-1191: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
data.body.PlanConfigurationSearchCriteria.name = name; | ||
data.body.PlanConfigurationSearchCriteria.tenantId = Digit.ULBService.getCurrentTenantId(); | ||
data.body.PlanConfigurationSearchCriteria.userUuid = Digit.UserService.getUser().info.uuid; | ||
// delete data.body.PlanConfigurationSearchCriteria.pagination | ||
data.body.PlanConfigurationSearchCriteria.status = status?.status; | ||
data.body.PlanConfigurationSearchCriteria.name = data?.state?.searchForm?.microplanName; |
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.
Avoid overwriting 'name' property in PlanConfigurationSearchCriteria
The name
property is assigned twice to PlanConfigurationSearchCriteria
. The second assignment at line 779 overwrites the value assigned at line 774. Please verify which value should be used and remove the redundant assignment to prevent unintended behavior.
Apply this diff to remove the redundant assignment:
data.body.PlanConfigurationSearchCriteria.limit = data?.state?.tableForm?.limit;
data.body.PlanConfigurationSearchCriteria.offset = data?.state?.tableForm?.offset;
- data.body.PlanConfigurationSearchCriteria.name = name;
data.body.PlanConfigurationSearchCriteria.tenantId = Digit.ULBService.getCurrentTenantId();
data.body.PlanConfigurationSearchCriteria.userUuid = Digit.UserService.getUser().info.uuid;
data.body.PlanConfigurationSearchCriteria.status = status?.status;
data.body.PlanConfigurationSearchCriteria.name = data?.state?.searchForm?.microplanName;
Committable suggestion skipped: line range outside the PR's diff.
* updates to validation * Update health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FormulaConfiguration.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * updated regex --------- Co-authored-by: Nipun Arora <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: rachana-egov <[email protected]>
Co-authored-by: rachana-egov <[email protected]>
* wait and retry message * type of structure changed for irs
Co-authored-by: rachana-egov <[email protected]>
* a lot of changes * small change * changes * loc * removed
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
📒 Files selected for processing (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/MultiSelectDropdown.js
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/MultiSelectDropdown.js (1)
Pattern **/*.js
: check
🪛 Biome (1.9.4)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/MultiSelectDropdown.js
[error] 68-71: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 102-102: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 139-139: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 308-308: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 299-305: This code is unreachable
... because either this statement ...
... or this statement will return from the function beforehand
(lint/correctness/noUnreachable)
[error] 622-622: Unnecessary use of boolean literals in conditional expression.
Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with
(lint/complexity/noUselessTernary)
[error] 735-735: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 768-768: Unnecessary use of boolean literals in conditional expression.
Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with
(lint/complexity/noUselessTernary)
[error] 803-803: Unnecessary use of boolean literals in conditional expression.
Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with
(lint/complexity/noUselessTernary)
[error] 827-833: 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)
[error] 848-848: 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)
[error] 962-972: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
Unsafe fix: Use a SelfClosingElement instead
(lint/style/useSelfClosingElements)
[error] 103-103: Avoid passing children using a prop
The canonical way to pass children in React is to use JSX elements
(lint/correctness/noChildrenProp)
[error] 108-117: Missing key property for this element in iterable.
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.
(lint/correctness/useJsxKeyInIterable)
[error] 118-130: Missing key property for this element in iterable.
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.
(lint/correctness/useJsxKeyInIterable)
[error] 372-372: Use let or const instead of var.
A variable declared with var is accessible in the whole body of the function. Thus, the variable can be accessed before its initialization and outside the block where it is declared.
See MDN web docs for more details.
Unsafe fix: Use 'let' instead.
(lint/style/noVar)
[error] 622-622: This let declares a variable that is only assigned once.
'checked' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
🔇 Additional comments (6)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/MultiSelectDropdown.js (6)
68-71
: Simplify null checks using optional chaining
You can simplify the null checks by utilizing optional chaining directly in the map
method.
🧰 Tools
🪛 Biome (1.9.4)
[error] 68-71: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
102-102
: Use template literals instead of string concatenation
Using template literals improves readability when constructing strings.
🧰 Tools
🪛 Biome (1.9.4)
[error] 102-102: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
139-139
: Use template literals for string construction
Consider using template literals for better readability when combining strings.
🧰 Tools
🪛 Biome (1.9.4)
[error] 139-139: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
308-308
: Wrap case block in braces to scope declarations properly
Declaring newState
inside a case
without braces can lead to scope issues. Wrap the case
block in braces to properly scope the declaration.
🧰 Tools
🪛 Biome (1.9.4)
[error] 308-308: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
622-622
: Simplify boolean assignment and use const
instead of let
The variable checked
is assigned once and never reassigned. Also, the ternary operator can be simplified.
🧰 Tools
🪛 Biome (1.9.4)
[error] 622-622: Unnecessary use of boolean literals in conditional expression.
Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with
(lint/complexity/noUselessTernary)
[error] 622-622: This let declares a variable that is only assigned once.
'checked' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
962-972
: Use self-closing tags for components without children
The Wrapper
component does not have any children and can be self-closed to improve code readability.
🧰 Tools
🪛 Biome (1.9.4)
[error] 962-972: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
Unsafe fix: Use a SelfClosingElement instead
(lint/style/useSelfClosingElements)
|
||
function findParentOption(childOption, options) { | ||
for (const option of options) { | ||
if (option.options && option.options.some((child) => child.code === childOption.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.
🧹 Nitpick (assertive)
Simplify condition using optional chaining
You can simplify the conditional check by using optional chaining.
Apply this diff:
- if (option.options && option.options.some((child) => child.code === childOption.code)) {
+ if (option.options?.some((child) => child.code === childOption.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.
if (option.options && option.options.some((child) => child.code === childOption.code)) { | |
if (option.options?.some((child) => child.code === childOption.code)) { |
🧰 Tools
🪛 Biome (1.9.4)
[error] 735-735: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
if (state.some((e) => e.code === action.payload?.[1]?.code) || !action?.payload?.[1]?.type) { | ||
return state; // Return state unchanged if item is already in queue | ||
} | ||
return [ | ||
...state, | ||
{ code: action?.payload?.[1]?.code, name: action?.payload?.[1]?.name, propsData: action.payload }, | ||
]; |
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.
Remove duplicated and unreachable code in 'ADD_TO_SELECTED_EVENT_QUEUE' case
The code from lines 299-305 duplicates the logic from lines 289-297 and is unreachable due to the previous return statements. Removing this duplicated code will eliminate the unreachable code and improve maintainability.
Apply this diff to remove the unreachable code:
case "ADD_TO_SELECTED_EVENT_QUEUE":
// Check if the item already exists to prevent duplication
if (state.some((e) => e.code === action.payload?.[1]?.code) || !action?.payload?.[1]?.type) {
return state; // Return state unchanged if item is already in queue
}
return [
...state,
{ code: action?.payload?.[1]?.code, name: action?.payload?.[1]?.name, propsData: action.payload },
];
- // Duplicate code begins here
- // Check if the item already exists to prevent duplication
- if (state.some((e) => e.code === action.payload?.[1]?.code) || !action?.payload?.[1]?.type) {
- return state; // Return state unchanged if item is already in queue
- }
- return [
- ...state,
- { code: action?.payload?.[1]?.code, name: action?.payload?.[1]?.name, propsData: action.payload },
- ];
📝 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.
if (state.some((e) => e.code === action.payload?.[1]?.code) || !action?.payload?.[1]?.type) { | |
return state; // Return state unchanged if item is already in queue | |
} | |
return [ | |
...state, | |
{ code: action?.payload?.[1]?.code, name: action?.payload?.[1]?.name, propsData: action.payload }, | |
]; | |
if (state.some((e) => e.code === action.payload?.[1]?.code) || !action?.payload?.[1]?.type) { | |
return state; // Return state unchanged if item is already in queue | |
} | |
return [ | |
...state, | |
{ code: action?.payload?.[1]?.code, name: action?.payload?.[1]?.name, propsData: action.payload }, | |
]; |
🧰 Tools
🪛 Biome (1.9.4)
[error] 299-305: This code is unreachable
... because either this statement ...
... or this statement will return from the function beforehand
(lint/correctness/noUnreachable)
<div | ||
className={`digit-multiselectdropodwn-menuitem ${ | ||
variant ? variant : "" | ||
} unsuccessfulresults`} | ||
key={"-1"} | ||
onClick={() => {}} | ||
> |
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.
Add keyboard event handlers for accessibility
The <div>
element with an onClick
event should also handle keyboard events to be accessible for keyboard-only users.
Apply this diff to add keyboard event handlers and make the element focusable:
<div
className={`digit-multiselectdropodwn-menuitem ${
variant ? variant : ""
} unsuccessfulresults`}
key={"-1"}
onClick={() => {}}
+ onKeyUp={(e) => {
+ if (e.key === 'Enter' || e.key === ' ') {
+ // Handle the click event
+ }
+ }}
+ tabIndex="0"
>
Committable suggestion skipped: line range outside the PR's diff.
🧰 Tools
🪛 Biome (1.9.4)
[error] 827-833: 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)
Co-authored-by: rachana-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: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
📒 Files selected for processing (1)
CODEOWNERS
(1 hunks)
🔇 Additional comments (1)
CODEOWNERS (1)
1-4
: Verify the intended ownership structure for overlapping paths.
The paths micro-ui/web/
and health/micro-ui/web/
overlap, which might cause confusion. While GitHub will correctly use the last matching pattern (meaning health/micro-ui/web/
will be owned by @egovernments/core-ui-reviewers), it would be helpful to clarify if this is intentional.
Consider:
- Are both paths intended to be owned by the same team?
- Should we add comments to explain the ownership structure?
Let's check the repository structure to understand the path relationships:
✅ Verification successful
Based on the fd
and rg
results, I can see that:
micro-ui/web/
exists and contains many fileshealth/micro-ui/web/
path does not exist in the repository
This means the CODEOWNERS entry for health/micro-ui/web/
is being added for a new directory that will likely be created as part of this PR's changes.
The CODEOWNERS file changes are correct and intentional
The overlapping paths in CODEOWNERS are not an issue because:
- The more specific path
health/micro-ui/web/
correctly comes after the general pathmicro-ui/web/
- GitHub applies the last matching pattern, so files under
health/micro-ui/web/
will be owned by @egovernments/core-ui-reviewers as intended - The new path appears to be for a new health module being added, so having it owned by the same team as the main UI makes sense
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check the directory structure to understand path relationships
# Expected: Show if these are separate or nested directories
# List all directories matching the patterns
echo "Directories matching the patterns:"
fd -t d "micro-ui/web$"
fd -t d "health/micro-ui/web$"
# Check if there are any unique files in each path
echo -e "\nUnique files in each path:"
rg --files "micro-ui/web" | grep -v "health/"
rg --files "health/micro-ui/web"
Length of output: 110906
|
||
micro-ui/web/ @egovernments/core-ui-reviewers | ||
health/micro-ui/web/ @egovernments/core-ui-reviewers | ||
|
||
health/micro-ui/web/ @egovernments/core-ui-reviewers |
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)
Add documentation for the ownership structure.
To improve maintainability and clarity, consider adding comments to explain:
- The relationship between these paths
- The rationale for the ownership assignments
- The team responsibilities
Example structure:
+# Default owner for all files unless overridden
* @jagankumar-egov
+# Core UI team owns all micro-ui web components
micro-ui/web/ @egovernments/core-ui-reviewers
+
+# Health module specific UI components
health/micro-ui/web/ @egovernments/core-ui-reviewers
📝 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.
micro-ui/web/ @egovernments/core-ui-reviewers | |
health/micro-ui/web/ @egovernments/core-ui-reviewers | |
health/micro-ui/web/ @egovernments/core-ui-reviewers | |
# Default owner for all files unless overridden | |
* @jagankumar-egov | |
# Core UI team owns all micro-ui web components | |
micro-ui/web/ @egovernments/core-ui-reviewers | |
# Health module specific UI components | |
health/micro-ui/web/ @egovernments/core-ui-reviewers |
@@ -1,5 +1,4 @@ | |||
.* @jagankumar-egov |
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)
Consider scoping the default owner pattern.
The pattern .*
matches everything in the repository, which means @jagankumar-egov will be notified for all changes. Consider if this broad scope is necessary or if it could be more targeted.
A more specific approach could be:
-.* @jagankumar-egov
+* @jagankumar-egov
This still acts as a catch-all but is more conventional in CODEOWNERS files.
📝 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.
.* @jagankumar-egov | |
* @jagankumar-egov |
Choose the appropriate template for your PR:
Summary by CodeRabbit
New Features
FetchFromMicroplanScreen
component for fetching campaign data.ApprovedMicroplans
component for managing approved microplans.CreateChecklist
component for creating checklists in the campaign management interface.BoundaryRelationCreate
component for managing boundary relations.FinalPopup
for confirmation actions.MapView
for interactive map functionality.Enhancements
Bug Fixes
Documentation