-
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
Open microplan screen #1549
Open microplan screen #1549
Conversation
📝 WalkthroughWalkthroughThis pull request includes updates to multiple components and configurations within the micro UI project. Key changes involve updating a CSS stylesheet version, enhancing the Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 26
🧹 Outside diff range comments (7)
health/micro-ui/web/micro-ui-internals/example/public/index.html (1)
Line range hint
1-38
: Consider optimizing and cleaning up CSS imports.While not directly related to the current change, I noticed that the file contains multiple CSS stylesheet imports, some of which are commented out. This could lead to potential issues:
- Version conflicts between different CSS imports.
- Unnecessary code that might confuse future developers.
- Possible performance issues due to loading multiple stylesheets.
Consider the following improvements:
- Remove or update commented-out stylesheet links if they're no longer needed.
- Consolidate CSS imports where possible to reduce the number of HTTP requests.
- Ensure that all imported stylesheets are necessary and up-to-date.
- Consider using a CSS bundling tool to combine and minify your stylesheets for better performance.
Here's an example of how you might clean up the CSS imports:
<head> <!-- ... other head elements ... --> <!-- Main DIGIT UI CSS --> <link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" /> <!-- Additional CSS only if necessary --> <link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" /> <!-- ... rest of the head ... --> </head>This cleanup will make the file more maintainable and potentially improve load times.
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/hooks/services/createUpdatePlanProject.js (6)
Line range hint
113-113
: Missingbreak
statements inswitch
casesIn the
createUpdatePlanProject
function'sswitch
statement starting at line 113,break
statements are missing after eachcase
. This can lead to unintended fall-through behavior, causing multiple cases to execute.Apply the following diff to add
break
statements after each case:case "CAMPAIGN_DETAILS": setCurrentKey((prev) => prev + 1); setCurrentStep((prev) => prev + 1); return { triggeredFrom, }; + break; case "MICROPLAN_DETAILS": // existing code return { triggeredFrom, }; + break; // Add `break` statements for all other cases similarly
Line range hint
166-168
: Fix the typo when invalidatingoperations
In the
ASSUMPTIONS_FORM
case, theinvalidatedOperations
array is incorrectly mapping overplanObject.assumptions
instead ofplanObject.operations
.Apply this diff to correct the mapping:
const invalidatedOperations = planObject.operations.length > 0 ? planObject.assumptions.map(row => { return { ...row, active: false } }) : [] +const invalidatedOperations = planObject.operations.length > 0 ? planObject.operations.map(row => { + return { + ...row, + active: false + } +}) : []
Line range hint
166-168
: Refactor invalidation logic forassumptions
andoperations
The logic for invalidating
assumptions
andoperations
is identical. Consider creating a helper function to DRY up the code.Implement a helper function to invalidate entities:
const invalidateEntities = (entities) => { return entities.length > 0 ? entities.map(row => ({ ...row, active: false })) : []; }; const invalidatedAssumptions = invalidateEntities(planObject.assumptions); const invalidatedOperations = invalidateEntities(planObject.operations);
Line range hint
150-152
: Optimize deep comparison using_.isEqual
Deep equality checks with
_.isEqual
can be expensive for large objects. If performance is a concern, consider optimizing this check or implementing a shallow comparison if appropriate.
Line range hint
204-208
: Reduce code duplication inHYPOTHESIS
andSUB_HYPOTHESIS
casesThe
HYPOTHESIS
andSUB_HYPOTHESIS
cases contain similar logic for fetching the plan and updating assumptions. Refactor this common logic into a separate function to improve maintainability.
Line range hint
225-225
: Ensure proper control flow in thedefault
caseIn the
switch
statement, thedefault
case at line 225 lacks abreak
statement. While not strictly necessary after areturn
, adding abreak
can improve readability and prevent potential issues if the code changes.
📜 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 (9)
- health/micro-ui/web/micro-ui-internals/example/public/index.html (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/BoundaryKpi.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/MicroplanCard.js (3 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/MicroplanSearchConfig.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/MyMicroplanSearchConfig.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js (8 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/hooks/services/createUpdatePlanProject.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/MyMicroplans.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/index.js (2 hunks)
🧰 Additional context used
📓 Path-based instructions (8)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/BoundaryKpi.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/MicroplanCard.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/MicroplanSearchConfig.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/MyMicroplanSearchConfig.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/hooks/services/createUpdatePlanProject.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/MyMicroplans.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/index.js (1)
Pattern
**/*.js
: check
🪛 Biome
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/MyMicroplans.js
[error] 17-17: 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] 26-26: 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] 39-45: 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 (17)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/BoundaryKpi.js (3)
4-4
: LGTM: Correct import for internationalization.The addition of the
useTranslation
import from 'react-i18next' is correct and aligns with the PR objective of addressing localization issues.
7-7
: LGTM: Proper usage of useTranslation hook.The
useTranslation
hook is correctly implemented, destructuring thet
function for use within the component. This supports the localization objective of the PR.
Line range hint
1-24
: Overall assessment: Well-implemented localization changes.The changes in this file successfully implement localization for the
BoundaryKpi
component, addressing the PR objective related to boundary KPI localization. The implementation follows React and i18n best practices, improving the component's internationalization capabilities without compromising its core functionality.health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/MicroplanCard.js (1)
61-61
: LGTM: Component structure and exports remain consistent.The overall structure of the
MicroplanCard
component and its default export remain unchanged, which is good for maintaining consistency in the codebase.health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/MyMicroplans.js (1)
50-50
: LGTM! Component export is correct.The default export of the
MyMicroplans
component is properly implemented.health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/index.js (2)
16-16
: LGTM: Import statement for MyMicroplans component.The import statement is correctly placed and follows React naming conventions.
16-16
: Summary: Changes align with PR objectives.The addition of the MyMicroplans component import and the corresponding route successfully integrates the new feature into the existing structure. These changes align with the PR objective of enhancing the My-Microplans feature and making it searchable for users in other roles.
To further improve the code:
- Consider adding a space after the arrow function's opening parenthesis in the new route for consistency.
- Remove the redundant comment "my-microplans" to maintain code cleanliness.
Overall, the implementation is sound and achieves the intended goal.
Also applies to: 181-184
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/MicroplanSearchConfig.js (3)
99-99
: Verify the emptyjsonPath
for the "Actions" column.At line 99~, the
jsonPath
for the "Actions" column is an empty string. Ensure that this is intentional and that the rendering logic handles this case appropriately.
110-110
: Confirm the use ofcustomHookName
.At line 110~,
customHookName
is commented out, but it is added uncommented at line 113~. Verify whether the hook should be active. If it's not ready for use, consider keeping it commented until it is.Also applies to: 113-113
117-123
:⚠️ Potential issueCheck the placement and structure of additional label entries.
The label objects from lines 117~ to 120~ are placed outside the initial tab configuration object. Ensure they are correctly structured within the
TabSearchconfig
array and associated with appropriate configurations, such astype
,apiDetails
, andsections
.Ensure that these entries are correctly nested. For example:
- {label: "DRAFTED_SETUP"}, - {label: "EXECUTION_TO_BE_DONE",}, - {label:"EXECUTION_IN_PROGRESS"}, - {label:"MICROPLAN_EXECUTED"}, + { + label: "DRAFTED_SETUP", + type: "search", + // ...additional configurations + }, + { + label: "EXECUTION_TO_BE_DONE", + type: "search", + // ...additional configurations + }, + { + label: "EXECUTION_IN_PROGRESS", + type: "search", + // ...additional configurations + }, + { + label: "MICROPLAN_EXECUTED", + type: "search", + // ...additional configurations + },health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/MyMicroplanSearchConfig.js (3)
74-74
: 🧹 Nitpick (assertive)Correct the typo in 'Camapaign Type'.
The label
Camapaign Type
contains a spelling error. It should beCampaign Type
.Apply this diff to fix the typo:
{ - label:"Camapaign Type", + label:"Campaign Type", jsonPath:"additionalDetails.campaignType" },Likely invalid or redundant comment.
94-97
: 🧹 Nitpick (assertive)Remove redundant commented code to improve readability.
The
customHookName
is commented out at line 94 and then declared again at line 97. Removing the commented line reduces clutter and improves code clarity.Apply this diff to remove the commented line:
- // customHookName: "microplanv1.useSavedMicroplans", //! Note
Likely invalid or redundant comment.
82-85
:⚠️ Potential issueSpecify a valid 'jsonPath' for the 'Actions' column.
The 'Actions' column has an empty
jsonPath
, which may cause issues when rendering data. Ensure thatjsonPath
is properly set to retrieve the necessary data for this column.Apply this diff to specify the correct
jsonPath
:{ label:"Actions", - jsonPath:"", + jsonPath:"actions", additionalCustomization:true },Replace
"actions"
with the appropriate path based on your data structure.Likely invalid or redundant comment.
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js (2)
5-7
: Imports are properly addedThe additional components (
DeleteIconv2
,DownloadIcon
,FileIcon
,Button
,Card
,CardSubHeader
,EditIcon
,ArrowForward
) are correctly imported from@egovernments/digit-ui-react-components
to support the new UI elements.
182-204
: Approved: Custom rendering for microplan namesThe custom rendering for the "Name of the Microplan" column appropriately handles long text and 'NA' values, improving readability.
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/hooks/services/createUpdatePlanProject.js (2)
Line range hint
252-254
: Confirm the correct export syntax forcreateUpdatePlanProject
At the end of the file, ensure that the export syntax for
createUpdatePlanProject
aligns with the module system being used (CommonJS or ES Modules).If using ES Modules, the export is correct:
export default createUpdatePlanProject;If using CommonJS, adjust the export accordingly:
module.exports = createUpdatePlanProject;
69-69
: Ensure consistent initialization ofdisease
propertyAt line 69, the
disease
property is added toadditionalDetails
in thecampaignObject
. Verify that this property is consistently set wherevercampaignObject
is created or updated to prevent potentialundefined
errors.Run the following script to check all instances where
additionalDetails
is set:
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/BoundaryKpi.js
Show resolved
Hide resolved
...h/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/MicroplanCard.js
Outdated
Show resolved
Hide resolved
...icro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/MyMicroplans.js
Show resolved
Hide resolved
...icro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/MyMicroplans.js
Show resolved
Hide resolved
...h/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js
Outdated
Show resolved
Hide resolved
...h/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js
Show resolved
Hide resolved
...h/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js
Show resolved
Hide resolved
...h/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js
Outdated
Show resolved
Hide resolved
...h/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range comments (1)
health/micro-ui/web/public/index.html (1)
Line range hint
1-37
: Consider reviewing the overall CSS inclusion strategy.While the current change is appropriate, I noticed that this file includes multiple CSS stylesheets from different versions and packages. This approach might lead to potential conflicts or inconsistencies in styling.
Consider the following suggestions:
- Review if all these CSS inclusions are necessary. Can some be consolidated or removed?
- Evaluate if using a more consistent versioning strategy across stylesheets would be beneficial.
- Consider using a build process to bundle and minimize CSS files, which could improve load times and reduce the risk of conflicts.
These suggestions aim to improve maintainability and performance in the long run. If you'd like assistance in implementing any of these suggestions, please let me know.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
📒 Files selected for processing (1)
- health/micro-ui/web/public/index.html (1 hunks)
🧰 Additional context used
🔇 Additional comments (1)
health/micro-ui/web/public/index.html (1)
15-15
: CSS version update looks good, but verify compatibility.The update of the CSS version from 1.0.82-campaign to 1.0.83-campaign seems appropriate. This change aligns with the PR objectives of enhancing functionality and addressing issues.
To ensure this change doesn't introduce any unexpected visual or functional regressions, please run the following verification steps:
- Test the application thoroughly, especially the areas mentioned in the PR objectives (open microplan screen, My-Microplans feature, and boundary KPIs).
- Check for any visual inconsistencies or layout issues across different pages and components.
- Verify that the new CSS version is compatible with all browsers and devices supported by your application.
If you encounter any issues, consider rolling back to the previous version or addressing the problems in a follow-up PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
🧹 Outside diff range comments (1)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js (1)
Line range hint
235-251
: Fix initialization ofroleschosen
to avoid type inconsistencyIn the
preProcess
function,roleschosen
is initialized as an empty array[]
whenfilterForm
is undefined, but later you expect it to be an object. This could lead to unexpected behavior. To ensure consistency, initializeroleschosen
as an empty object{}
.Apply this diff to fix the issue:
-let { roleschosen } = data?.state?.filterForm || [] +let { roleschosen } = data?.state?.filterForm || {} if (!roleschosen) { roleschosen = {} }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
📒 Files selected for processing (2)
- health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/MicroplanCard.js (3 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js (8 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/MicroplanCard.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js (1)
Pattern
**/*.js
: check
🔇 Additional comments (2)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/MicroplanCard.js (1)
61-61
: Export statement looks goodThe modification to the export statement appears to be a minor change, possibly just formatting. The logic remains the same, exporting the
MicroplanCard
component as default.health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js (1)
251-256
: Confirm the correct parameter name 'names' indata.params
In the
preProcess
function,data.params.names
is assigned the value ofname
. Please verify if the API expects the parameter to benames
orname
to ensure consistency and correct functionality.
const OTHERS={ | ||
OTHERS:[ | ||
"PLAN_ESTIMATION_APPROVER", | ||
"ROOT_PLAN_ESTIMATION_APPROVER", | ||
"POPULATION_DATA_APPROVER", | ||
"ROOT_POPULATION_DATA_APPROVER", | ||
"FACILITY_CATCHMENT_MAPPER", | ||
"ROOT_FACILITY_CATCHMENT_MAPPER", | ||
"MICROPLAN_VIEWER" | ||
] | ||
|
||
} |
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 constant naming and structure for consistency
The new OTHERS
constant could be improved for better clarity and consistency:
- The name
OTHERS
is not descriptive. Consider a more specific name likeADDITIONAL_ROLES
. - The structure is inconsistent with the existing
ROLES
constant.
To address these issues and incorporate the suggestion from a previous review, consider merging this into the ROLES
object:
const ROLES = {
MICROPLAN: ["MICROPLAN_ADMIN"],
ADDITIONAL: [
"PLAN_ESTIMATION_APPROVER",
"ROOT_PLAN_ESTIMATION_APPROVER",
"POPULATION_DATA_APPROVER",
"ROOT_POPULATION_DATA_APPROVER",
"FACILITY_CATCHMENT_MAPPER",
"ROOT_FACILITY_CATCHMENT_MAPPER",
"MICROPLAN_VIEWER"
]
};
This approach centralizes role definitions and maintains consistency.
const generateOtherLink = (labelKey, pathSuffix) => { | ||
return { | ||
label: t(labelKey), | ||
link: `/${window?.contextPath}/employee/microplan/${pathSuffix}`, | ||
roles: ROLES.OTHERS, | ||
}; | ||
}; |
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
Remove or modify the redundant generateOtherLink
function
The generateOtherLink
function is nearly identical to generateLink
, introducing unnecessary code duplication. Additionally, it uses ROLES.OTHERS
, which is incorrect. Consider the following options:
-
If no differentiation is needed, remove
generateOtherLink
and usegenerateLink
for all links. -
If different behavior is intended for "other" links, update the function accordingly:
const generateAdditionalLink = (labelKey, pathSuffix) => {
return {
label: t(labelKey),
link: `/${window?.contextPath}/employee/microplan/${pathSuffix}`,
roles: ROLES.ADDITIONAL, // Use the newly defined ADDITIONAL roles
};
};
This approach aligns with the suggested changes to the ROLES
constant and provides a clear distinction between different types of links.
let links = [ | ||
generateLink("SETUP_MICROPLAN","setup-microplan"), | ||
generateLink("SEARCH_MICROPLANS","microplan-search"), | ||
generateLink("USER_MANAGEMENT","user-management"), | ||
generateOtherLink("MY_MICROPLANS","my-microplans") | ||
]; |
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
Use consistent link generation in the links
array
The "MY_MICROPLANS" link is added using generateOtherLink
, which is inconsistent with other links. To maintain consistency and reduce potential issues, update this section to use a single link generation function:
let links = [
generateLink("SETUP_MICROPLAN", "setup-microplan"),
generateLink("SEARCH_MICROPLANS", "microplan-search"),
generateLink("USER_MANAGEMENT", "user-management"),
generateLink("MY_MICROPLANS", "my-microplans")
];
If different role requirements are needed for "MY_MICROPLANS", ensure that the link generation function (whether generateLink
or a modified version) can handle different role sets appropriately.
row.status === "DRAFT" ? (<Button | ||
label={t("WBH_EDIT")} | ||
variation="secondary" | ||
icon={<EditIcon styles={{ height: "1.25rem", width: "2.5rem" }} />} | ||
type="button" | ||
className="dm-workbench-download-template-btn dm-hover" | ||
onButtonClick={(e) => { | ||
|
||
}} | ||
/>) : (row.status === "EXECUTION_TO_BE_DONE") ? ( | ||
<Button | ||
label={t("START")} | ||
variation="secondary" | ||
icon={<ArrowForward styles={{ height: "1.25rem", width: "2.5rem" }} />} | ||
type="button" | ||
className="dm-workbench-download-template-btn dm-hover" | ||
onButtonClick={(e) => { | ||
|
||
}} | ||
/> | ||
) : (row.status === "RESOURCE_ESTIMATIONS_APPROVED") ? ( | ||
<Button | ||
label={t("WBH_DOWNLOAD")} | ||
variation="secondary" | ||
icon={<DownloadIcon styles={{ height: "1.25rem", width: "2.5rem" }} />} | ||
type="button" | ||
className="dm-workbench-download-template-btn dm-hover" | ||
onButtonClick={(e) => { | ||
|
||
}} | ||
/> | ||
) : 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.
🛠️ Refactor suggestion
Refactor nested ternary operators for better readability
The nested ternary operators used to render different buttons based on row.status
can be difficult to read and maintain. Consider refactoring this logic into a more readable format, such as using if-else statements or mapping statuses to components.
For example, you can refactor the code as follows:
let actionButton = null;
if (row.status === "DRAFT") {
actionButton = (
<Button
label={t("WBH_EDIT")}
variation="secondary"
icon={<EditIcon styles={{ height: "1.25rem", width: "2.5rem" }} />}
type="button"
className="dm-workbench-download-template-btn dm-hover"
onButtonClick={(e) => {
// Implement action
}}
/>
);
} else if (row.status === "EXECUTION_TO_BE_DONE") {
actionButton = (
<Button
label={t("START")}
variation="secondary"
icon={<ArrowForward styles={{ height: "1.25rem", width: "2.5rem" }} />}
type="button"
className="dm-workbench-download-template-btn dm-hover"
onButtonClick={(e) => {
// Implement action
}}
/>
);
} else if (row.status === "RESOURCE_ESTIMATIONS_APPROVED") {
actionButton = (
<Button
label={t("WBH_DOWNLOAD")}
variation="secondary"
icon={<DownloadIcon styles={{ height: "1.25rem", width: "2.5rem" }} />}
type="button"
className="dm-workbench-download-template-btn dm-hover"
onButtonClick={(e) => {
// Implement action
}}
/>
);
}
return actionButton;
API integrated open microplan screen and also My-Microplans in Other roles are searchable.
Boundary kpi localization issue
Summary by CodeRabbit
New Features
MyMicroplans
component for managing microplan information.MyMicroplans
component in the app's navigation.Improvements
BoundaryKpi
component for better accessibility.