-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/boundary ss #1490
Feature/boundary ss #1490
Conversation
📝 Walkthrough📝 WalkthroughWalkthroughThe pull request introduces several changes across multiple files, primarily focusing on updating CSS stylesheet versions, enhancing the styling and functionality of React components related to boundary management, and adding new components for managing boundary data. Key updates include the addition of new components like Changes
Possibly related PRs
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: 62
🧹 Outside diff range comments (2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/Module.js (2)
Line range hint
37-37
: Consider removing or uncommenting commented-out code.There are commented-out lines related to
SelectingBoundaryComponent
. If this component is no longer needed, consider removing these lines. If it's still required, please uncomment and ensure it's properly integrated.Also applies to: 145-145
Line range hint
1-205
: Consider refactoring for improved modularity.This file contains multiple responsibilities, including component definition, hook overrides, and component registration. Consider splitting it into smaller, more focused modules to improve maintainability and readability. For example:
- A file for the CampaignModule component
- A file for component registration
- A file for hook and library overrides
This separation of concerns could make the codebase easier to navigate and maintain.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
⛔ Files ignored due to path filters (2)
health/micro-ui/web/micro-ui-internals/package.json
is excluded by!**/*.json
health/micro-ui/web/micro-ui-internals/packages/css/package.json
is excluded by!**/*.json
📒 Files selected for processing (15)
- health/micro-ui/web/micro-ui-internals/example/public/index.html (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/Module.js (2 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignCard.js (2 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/XlsPreviewNew.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/icons/ShapeFileIcon.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/boundarySearchConfig.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/Boundary.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/GeoPode.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewBoundary.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewHierarchy.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/index.js (2 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/downloadTemplate.js (1 hunks)
- health/micro-ui/web/public/index.html (1 hunks)
🧰 Additional context used
📓 Path-based instructions (12)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/Module.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignCard.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/XlsPreviewNew.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/icons/ShapeFileIcon.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/boundarySearchConfig.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/Boundary.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/GeoPode.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewBoundary.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewHierarchy.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/index.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/downloadTemplate.js (1)
Pattern
**/*.js
: check
🪛 Biome
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/XlsPreviewNew.js
[error] 9-9: Alternative text title element cannot be empty
For accessibility purposes, SVGs should have an alternative text, provided via title element. If the svg element has role="img", you should add the aria-label or aria-labelledby attribute.
(lint/a11y/noSvgWithoutTitle)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/icons/ShapeFileIcon.js
[error] 4-4: Alternative text title element cannot be empty
For accessibility purposes, SVGs should have an alternative text, provided via title element. If the svg element has role="img", you should add the aria-label or aria-labelledby attribute.
(lint/a11y/noSvgWithoutTitle)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js
[error] 78-78: 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] 71-71: This code is unreachable
... because this statement will return from the function beforehand
(lint/correctness/noUnreachable)
[error] 75-75: This code is unreachable
... because this statement will return from the function beforehand
(lint/correctness/noUnreachable)
[error] 81-81: This code is unreachable
... because this statement will return from the function beforehand
(lint/correctness/noUnreachable)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/Boundary.js
[error] 161-161: 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] 122-122: Avoid passing children using a prop
The canonical way to pass children in React is to use JSX elements
(lint/correctness/noChildrenProp)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/GeoPode.js
[error] 410-410: 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] 432-432: 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] 438-438: 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] 470-470: 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] 477-477: 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] 514-514: 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] 520-520: 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] 642-642: 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] 646-646: 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] 665-665: 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] 671-671: 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] 42-42: This let declares a variable that is only assigned once.
'receivedData' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 288-288: This let declares a variable that is only assigned once.
'file' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 289-289: This let declares a variable that is only assigned once.
'fileDataTemp' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 295-295: This let declares a variable that is only assigned once.
'fileStoreId' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 353-353: Avoid passing children using a prop
The canonical way to pass children in React is to use JSX elements
(lint/correctness/noChildrenProp)
[error] 366-374: 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] 375-386: 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)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewHierarchy.js
[error] 207-207: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 209-209: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 245-245: 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] 263-263: 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] 284-284: 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] 303-303: 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] 404-404: 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] 123-123: This let declares a variable that is only assigned once.
'file' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 124-124: This let declares a variable that is only assigned once.
'fileDataTemp' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 130-130: This let declares a variable that is only assigned once.
'fileStoreIdTemp' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 370-379: 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] 380-389: 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] 408-417: 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] 418-426: 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)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/downloadTemplate.js
[error] 51-51: This let declares a variable that is only assigned once.
'child' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 58-58: This let declares a variable that is only assigned once.
'allDatas' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 168-168: Use Number.parseInt instead of the equivalent global.
ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.parseInt instead.(lint/style/useNumberNamespace)
[error] 303-303: This let declares a variable that is only assigned once.
'messages' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 313-313: This let declares a variable that is only assigned once.
'hierarchy' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 327-327: This let declares a variable that is only assigned once.
'localisedArray' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 333-333: This let declares a variable that is only assigned once.
'localisedData' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 344-344: This let declares a variable that is only assigned once.
'expectedName' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
🔇 Additional comments (19)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewBoundary.js (2)
7-7
: LGTM: Proper use of internationalization.The
useTranslation
hook is correctly implemented, allowing for easy localization of the component's text content. This is a good practice for creating multilingual applications.
31-31
: LGTM: Proper component export.The component is correctly exported as the default export, following common React patterns.
health/micro-ui/web/micro-ui-internals/example/public/index.html (2)
Line range hint
1-38
: Improve HTML structure and follow best practices.While the overall structure of the HTML file is correct, there are several areas where it can be improved:
- Remove commented-out code to improve readability and maintainability.
- Consider using local stylesheets instead of CDN links to improve performance and reliability.
- Combine and minify CSS files to reduce the number of HTTP requests.
- Add a meta description tag for better SEO.
- Consider adding a language attribute to the html tag for accessibility.
Here's a suggested refactoring of the
<head>
section:<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="theme-color" content="#00bcd1" /> <meta name="description" content="DIGIT - Digital Infrastructure for Governance, Impact & Transformation" /> <link rel="icon" href="https://egov-dev-assets.s3.ap-south-1.amazonaws.com/browser-icon.png" /> <title>DIGIT</title> <link href="https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@400;500;700&family=Roboto:wght@400;500;700&display=swap" rel="stylesheet"> <link rel="stylesheet" href="/styles/combined.min.css" /> <script src="%REACT_APP_GLOBAL%"></script> </head>To assist in consolidating and optimizing CSS files, run the following script to list all external resources:
#!/bin/bash # Description: List all external resources (CSS and JS) used in the file echo "External CSS resources:" rg --no-filename '<link.*href="(https?://[^"]+\.css)"' health/micro-ui/web/micro-ui-internals/example/public/index.html -or '$1' | sort | uniq echo -e "\nExternal JS resources:" rg --no-filename '<script.*src="(https?://[^"]+\.js)"' health/micro-ui/web/micro-ui-internals/example/public/index.html -or '$1' | sort | uniqReview the output to identify resources that can be combined, minified, or served locally to improve performance.
Line range hint
13-23
: Consider consolidating CSS library versions.The file currently includes multiple versions of @egovernments/digit-ui-css (1.8.2-beta.34, 1.8.0-alpha.6, 1.0.77-campaign, 1.0.50-microplan) and @egovernments/digit-ui-components-css (0.0.2-beta.36). This approach may lead to:
- Potential styling conflicts
- Increased page load time
- Difficulty in maintaining consistent styles across the application
Consider the following recommendations:
- Consolidate to a single, stable version of @egovernments/digit-ui-css that includes all required styles.
- If different modules require specific CSS versions, consider using a CSS management system or build tool to merge and minimize conflicts.
- Remove or update commented-out CSS links to reduce confusion.
- Document the reason for using multiple CSS versions if it's absolutely necessary for your use case.
To assist in consolidation, run the following script to identify which HTML elements are using styles from each CSS version:
#!/bin/bash # Description: Identify HTML elements using styles from each CSS version echo "Searching for usage of styles from different CSS versions:" rg --type html -A 5 'class="[^"]*"' health/micro-ui/web/micro-ui-internals/example/public/index.htmlReview the output to determine which styles are essential and which versions can be safely consolidated or removed.
health/micro-ui/web/public/index.html (1)
15-15
: LGTM. Verify visual consistency after CSS update.The update of the @egovernments/digit-ui-css package from version 1.0.76-campaign to 1.0.77-campaign looks good. This keeps the project up-to-date with the latest styles.
To ensure this update doesn't introduce any unexpected visual changes, please verify the following:
- Check if there are any breaking changes or significant updates in the changelog for this version.
- Test the application thoroughly, especially pages that heavily rely on custom styling.
- Verify that all components render correctly and maintain their expected appearance.
Run the following script to check for any potential visual regressions:
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/icons/ShapeFileIcon.js (2)
1-3
: LGTM: Import and component declaration are correct.The React import and the component declaration as a named export using arrow function syntax are implemented correctly.
49-49
: LGTM: Text element is well-positioned and styledThe text element displaying ".SHP" is correctly implemented, with appropriate positioning and styling that matches the overall design of the icon.
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/XlsPreviewNew.js (1)
69-69
: LGTM! Well-structured component with room for minor improvements.The
XlsPreviewNew
component is well-structured and correctly exported as the default export. It provides a good foundation for previewing Excel files.To further improve the component:
- Consider implementing error handling for cases where the file might not load correctly.
- Add PropTypes or TypeScript types for better type checking and documentation.
- If this component is part of a larger form or workflow, consider adding some context or comments explaining its role in the broader application.
Overall, good job on creating this preview component!
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/boundarySearchConfig.js (2)
31-65
:⚠️ Potential issueClarify and complete search form configuration
The search form configuration appears to be incomplete or in progress:
Only one search field ("Hierarchy Name") is currently defined. Is this intentional, or are additional search fields planned?
There are commented-out code blocks for a "Type of Campaign" field. Please clarify if this field should be included or removed entirely.
The
minReqFields
is set to 0, allowing empty searches. Consider if this is the intended behavior or if at least one search parameter should be required.The
isMandatory
field for "Hierarchy Name" is set to "false" (as a string). This should be a boolean value:isMandatory: false,
- The
populators
object for the "Hierarchy Name" field includes anoptionsKey
, but nooptions
array. If this is meant to be a dropdown, please provide the options or clarify how they will be populated.Could you please clarify the intended search functionality and complete the configuration accordingly?
66-97
:⚠️ Potential issueRefine search results configuration
The search results configuration has a few areas that need attention:
The
jsonpath
for the "Levels" column currently points toauditDetails.createdBy
. This doesn't seem correct for displaying the number of levels in a hierarchy. Please provide the correct path for this information.The
Action
column usesjsonPath
(camelCase) instead ofjsonpath
(lowercase) like the other columns. Ensure consistent naming across all columns:{ label: "Action", jsonpath: "isActive", additionalCustomization: true }
All columns have
additionalCustomization
set to true. Please clarify what this property does and if it's necessary for all columns.The
Creation Date
column usesauditDetails.createdTime
. Ensure that this value is properly formatted for display in the UI.Consider adding a formatter function for the
isActive
field in the "Action" column to display a more user-friendly value (e.g., "Active" or "Inactive" instead of true/false).Could you please address these points and provide any necessary clarifications?
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/index.js (2)
14-17
: LGTM: New component imports added correctly.The new import statements for Boundary, GeoPode, ViewBoundary, and ViewHierarchy components are correctly formatted and consistent with the existing code style.
14-17
: Verify the implementation of new components.The new routes and imports for Boundary, GeoPode, ViewBoundary, and ViewHierarchy components have been added correctly. To ensure completeness of the review:
Please run the following script to check the implementation of these new components:
This script will help verify that the new component files exist and have a basic React component structure.
Also applies to: 122-125
✅ Verification successful
Implementation of new components verified.
The new components
Boundary
,GeoPode
,ViewBoundary
, andViewHierarchy
are correctly exported as default exports in their respective files. All necessary component files are present and properly implemented.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of new components # Test: Check if the new component files exist echo "Checking for new component files:" fd -e js -p "Boundary.js|GeoPode.js|ViewBoundary.js|ViewHierarchy.js" health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ # Test: Check the basic structure of new components echo "\nChecking basic structure of new components:" for file in Boundary GeoPode ViewBoundary ViewHierarchy; do echo "\n$file.js:" ast-grep --lang javascript --pattern $'export default function $_($$_) { $$$ }' health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/${file}.js doneLength of output: 2036
Script:
#!/bin/bash # Description: Verify the implementation of new components with alternative export patterns # Test: Check if the new component files exist echo "Re-checking for new component files:" fd -e js -p "Boundary.js|GeoPode.js|ViewBoundary.js|ViewHierarchy.js" health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ # Test: Check for arrow function exports echo "\nChecking for arrow function exports in new components:" for file in Boundary GeoPode ViewBoundary ViewHierarchy; do echo "\n$file.js (Arrow Function Export):" ast-grep --lang javascript --pattern $'export const $_ = ($$_) => { $$$ }' health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/${file}.js done # Test: Check for class-based exports echo "\nChecking for class-based exports in new components:" for file in Boundary GeoPode ViewBoundary ViewHierarchy; do echo "\n$file.js (Class-Based Export):" ast-grep --lang javascript --pattern $'export default class $_ extends React.Component { $$$ }' health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/${file}.js doneLength of output: 3777
Script:
#!/bin/bash # Description: Verify the implementation of new components with additional export patterns # Test: Check for named function exports echo "Checking for named function exports in new components:" for file in Boundary GeoPode ViewBoundary ViewHierarchy; do echo "\n$file.js (Named Function Export):" ast-grep --lang javascript --pattern $'export function $_($$_) { $$$ }' health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/${file}.js done # Test: Check for default exports without function or class declarations echo "\nChecking for default exports with variable declarations in new components:" for file in Boundary GeoPode ViewBoundary ViewHierarchy; do echo "\n$file.js (Default Export with Variable Declaration):" ast-grep --lang javascript --pattern $'const $_ = ($$_) => { $$$ } export default $_;' health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/${file}.js done # Test: Check for multiple exports in the component files echo "\nChecking for multiple exports in new components:" for file in Boundary GeoPode ViewBoundary ViewHierarchy; do echo "\n$file.js (Multiple Exports):" ast-grep --lang javascript --pattern $'export {$$$}' health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/${file}.js doneLength of output: 6388
Script:
#!/bin/bash # Description: Verify the implementation of new components with corrected and additional export patterns # Test: Check for named function exports echo "Checking for named function exports in new components:" for file in Boundary GeoPode ViewBoundary ViewHierarchy; do echo "\n$file.js (Named Function Export):" ast-grep --lang javascript --pattern 'export function $_($_) { $$$ }' health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/${file}.js done # Test: Check for named arrow function exports echo "\nChecking for named arrow function exports in new components:" for file in Boundary GeoPode ViewBoundary ViewHierarchy; do echo "\n$file.js (Named Arrow Function Export):" ast-grep --lang javascript --pattern 'export const $_ = ($_ ) => { $$$ }' health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/${file}.js done # Test: Check for default exports with variable declarations (separated) echo "\nChecking for default exports with variable declarations in new components:" for file in Boundary GeoPode ViewBoundary ViewHierarchy; do echo "\n$file.js (Variable Declaration):" ast-grep --lang javascript --pattern 'const $_ = ($_ ) => { $$$ }' health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/${file}.js echo "\n$file.js (Default Export of Variable):" ast-grep --lang javascript --pattern 'export default $_;' health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/${file}.js done # Test: Check for multiple exports in the component files echo "\nChecking for multiple exports in new components:" for file in Boundary GeoPode ViewBoundary ViewHierarchy; do echo "\n$file.js (Multiple Exports):" ast-grep --lang javascript --pattern 'export { $$ }' health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/${file}.js doneLength of output: 9849
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/Module.js (2)
50-53
: LGTM: New component imports added correctly.The new imports for Boundary, GeoPode, ViewBoundary, and ViewHierarchy components are correctly added and follow the existing import pattern and naming conventions.
140-143
: LGTM: New components correctly registered.The Boundary, GeoPode, ViewBoundary, and ViewHierarchy components are correctly added to the componentsToRegister object, following the existing pattern.
health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss (3)
963-966
: LGTM: Appropriate spacing for dustbin iconThe
.dustbin-icon
class adds suitable vertical margins to the icon, providing good spacing and visual separation. The slightly larger bottom margin (1rem) compared to the top margin (0.7rem) may help with visual balance, especially if there's more content below the icon.
972-973
: LGTM with a suggestion for layout verificationSetting
width: 100%
for all directdiv
children of.digit-action-bar-wrap
ensures they take up the full width of their container. This can provide a consistent layout for action bar items.However, it's important to verify that this change doesn't unintentionally affect the layout of action bar items. Please run the following script to check the usage of
.digit-action-bar-wrap
:#!/bin/bash # Check for usage of .digit-action-bar-wrap in JavaScript files rg -t js '\.digit-action-bar-wrap' # Check for usage of .digit-action-bar-wrap in JSX files rg -t jsx '\.digit-action-bar-wrap'Review the results to ensure that the layout of action bar items still appears as intended across different components and screen sizes.
968-970
: LGTM with a suggestion for accessibility verificationThe use of
display: contents
for.custom-action-bar .digit-action-bar-fields
can provide more flexible layouts while preserving the HTML structure. This is generally a good approach for custom styling.However, it's important to verify that this doesn't negatively impact accessibility, especially for screen readers. Please run the following script to check for potential accessibility issues:
This script will search for ARIA attributes and roles in your JavaScript files, which might be affected by the
display: contents
property. Review the results to ensure that important accessibility information is not being hidden or misrepresented due to this CSS change.health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/Boundary.js (1)
30-30
: Verify the necessity of theisLoading
variableThe
isLoading
variable is destructured from the hook but not used in the component. If it's unnecessary, consider removing it.health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/downloadTemplate.js (1)
324-324
: 🧹 Nitpick (assertive)Correct pluralization in console log message
In the console log, "all datas" should be "all data" as "data" is already plural.
Apply this diff:
- console.log("all datas", allDatas); + console.log("all data", allDatas);Likely invalid or redundant comment.
return ( | ||
<div> | ||
<Header styles={{ fontSize: "32px", marginBottom:"2rem", marginTop:"2rem"}}>{t("CURRENT_HIERARCHIES")}</Header> | ||
<div className="inbox-search-wrapper"> | ||
{/* Pass defaultValues as props to InboxSearchComposer */} | ||
<InboxSearchComposer configs={boundarySearchConfig?.[0]} | ||
// defaultValues={defaultValues} | ||
additionalConfig={{ | ||
resultsTable: { | ||
// onClickRow, | ||
}, | ||
}} | ||
> | ||
</InboxSearchComposer> | ||
</div> | ||
</div> | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Improve component structure and remove unused code.
The component's structure is generally good, but consider the following improvements:
- Move inline styles to a separate CSS file for better maintainability.
- Remove commented out code (
defaultValues
prop andonClickRow
function) if they are not needed. - Simplify the
additionalConfig
prop ifonClickRow
is not used.
Here's a suggested refactor:
- return (
- <div>
- <Header styles={{ fontSize: "32px", marginBottom:"2rem", marginTop:"2rem"}}>{t("CURRENT_HIERARCHIES")}</Header>
- <div className="inbox-search-wrapper">
- {/* Pass defaultValues as props to InboxSearchComposer */}
- <InboxSearchComposer configs={boundarySearchConfig?.[0]}
- // defaultValues={defaultValues}
- additionalConfig={{
- resultsTable: {
- // onClickRow,
- },
- }}
- >
- </InboxSearchComposer>
- </div>
- </div>
- )
+ return (
+ <div>
+ <Header className="view-boundary-header">{t("CURRENT_HIERARCHIES")}</Header>
+ <div className="inbox-search-wrapper">
+ <InboxSearchComposer configs={boundarySearchConfig?.[0]} />
+ </div>
+ </div>
+ )
Don't forget to add the corresponding CSS:
.view-boundary-header {
font-size: 32px;
margin-bottom: 2rem;
margin-top: 2rem;
}
import React, { useEffect, useState , useRef} from "react"; | ||
import { Header, InboxSearchComposer } from "@egovernments/digit-ui-react-components"; | ||
import { boundarySearchConfig } from "../../configs/boundarySearchConfig"; | ||
import { useTranslation } from "react-i18next"; | ||
|
||
const ViewBoundary = () => { |
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 imports to improve code cleanliness.
The following hooks are imported but not used in the component:
useState
useEffect
useRef
Consider removing these unused imports to keep the code clean and potentially improve performance.
Apply this diff to remove unused imports:
-import React, { useEffect, useState , useRef} from "react";
+import React from "react";
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
import React, { useEffect, useState , useRef} from "react"; | |
import { Header, InboxSearchComposer } from "@egovernments/digit-ui-react-components"; | |
import { boundarySearchConfig } from "../../configs/boundarySearchConfig"; | |
import { useTranslation } from "react-i18next"; | |
const ViewBoundary = () => { | |
import React from "react"; | |
import { Header, InboxSearchComposer } from "@egovernments/digit-ui-react-components"; | |
import { boundarySearchConfig } from "../../configs/boundarySearchConfig"; | |
import { useTranslation } from "react-i18next"; | |
const ViewBoundary = () => { |
@@ -18,7 +18,7 @@ | |||
<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].76-campaign/dist/index.css" /> | |||
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].77-campaign/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.
💡 Codebase verification
Multiple CSS library versions detected.
Multiple versions of @egovernments/digit-ui-css
are linked in the HTML file, which can lead to styling conflicts and inconsistent behaviors. Please consolidate to a single, stable version to ensure consistent styling and improve maintainability.
🔗 Analysis chain
Approved: CSS library version update.
The update from version 1.0.76-campaign to 1.0.77-campaign of @egovernments/digit-ui-css is a minor version change, which typically indicates bug fixes or small improvements. This change is acceptable.
However, please ensure that this update is compatible with the other versions of the CSS library used in this file. Run the following script to list all versions of @egovernments/digit-ui-css being used:
Review the output to confirm that using multiple versions is intentional and doesn't cause any styling conflicts.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: List all versions of @egovernments/digit-ui-css used in the file
echo "Versions of @egovernments/digit-ui-css found in the file:"
rg --no-filename '@egovernments/digit-ui-css@\d+\.\d+\.\d+' health/micro-ui/web/micro-ui-internals/example/public/index.html | sort | uniq
Length of output: 989
<rect | ||
x="5" | ||
y="5" | ||
width="86" | ||
height="110" | ||
rx="10" | ||
ry="10" | ||
fill="url(#gradient)" // Gradient fill | ||
stroke="#DAA520" // Golden outline | ||
strokeWidth="2" | ||
/> | ||
|
||
{/* File fold at the top-right corner */} | ||
<path | ||
d="M64 0V24H88" | ||
fill="url(#foldGradient)" | ||
stroke="#DAA520" | ||
strokeWidth="1" | ||
/> | ||
|
||
{/* Shadow under the fold */} | ||
<path | ||
d="M64 24L88 24" | ||
stroke="#FFD700" | ||
strokeOpacity="0.5" | ||
strokeWidth="1.5" | ||
/> | ||
|
||
{/* Add subtle shadow for depth */} | ||
<rect | ||
x="5" | ||
y="5" | ||
width="86" | ||
height="110" | ||
rx="10" | ||
ry="10" | ||
fill="none" | ||
stroke="rgba(0,0,0,0.2)" // Shadow | ||
strokeWidth="4" | ||
strokeLinecap="round" | ||
/> |
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)
LGTM: SVG shapes and styling are well-implemented
The SVG shapes and their styling are correctly defined, creating a visually appealing icon with depth and gradient effects. The code is also well-commented, which aids in understanding the purpose of each shape.
For consistency, consider using hex color codes throughout instead of mixing with color names. For example, replace #FFD700
with #DAA520
(golden color) where appropriate.
<defs> | ||
<linearGradient id="gradient" x1="0%" y1="0%" x2="100%" y2="100%"> | ||
<stop offset="0%" style={{ stopColor: "#FFD700", stopOpacity: 1 }} /> | ||
<stop offset="100%" style={{ stopColor: "#FFEA00", stopOpacity: 1 }} /> | ||
</linearGradient> | ||
|
||
{/* Gradient for the folded corner */} | ||
<linearGradient id="foldGradient" x1="0%" y1="0%" x2="100%" y2="100%"> | ||
<stop offset="0%" style={{ stopColor: "#FFDE5A", stopOpacity: 1 }} /> | ||
<stop offset="100%" style={{ stopColor: "#FFD700", stopOpacity: 0.8 }} /> | ||
</linearGradient> | ||
</defs> |
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)
LGTM: Gradient definitions are correct and enhance the design
The linear gradients for the main file icon and the folded corner are well-defined, adding depth and visual appeal to the icon.
For improved maintainability, consider extracting the color values into constants at the top of the file. This would make it easier to update the color scheme in the future. For example:
const GOLDEN_COLOR = "#DAA520";
const LIGHT_GOLDEN_COLOR = "#FFD700";
const PALE_GOLDEN_COLOR = "#FFEA00";
// Then use these constants in your gradient definitions
let file = files[0]; | ||
let fileDataTemp = {}; |
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 'const' instead of 'let' for variables not reassigned
Variables file
and fileDataTemp
are not reassigned after their initial assignment. Using const
instead of let
communicates that these variables are constants.
Apply this diff:
-let file = files[0];
-let fileDataTemp = {};
+const file = files[0];
+const fileDataTemp = {};
📝 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.
let file = files[0]; | |
let fileDataTemp = {}; | |
const file = files[0]; | |
const fileDataTemp = {}; |
🧰 Tools
🪛 Biome
[error] 288-288: This let declares a variable that is only assigned once.
'file' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 289-289: This let declares a variable that is only assigned once.
'fileDataTemp' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
const response = await Digit.UploadServices.Filestorage(module, file, tenantId); | ||
// console.log("respose from file storage is", response); | ||
fileDataTemp.fileStoreId = response?.data?.[0]?.fileStoreId; | ||
let fileStoreId = response?.data?.files?.[0]?.fileStoreId; |
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 'const' for 'fileStoreId'
The variable fileStoreId
is not reassigned after its initial assignment. It's better to declare it using const
.
Apply this diff:
-let fileStoreId = response?.data?.files?.[0]?.fileStoreId;
+const fileStoreId = response?.data?.files?.[0]?.fileStoreId;
📝 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.
let fileStoreId = response?.data?.files?.[0]?.fileStoreId; | |
const fileStoreId = response?.data?.files?.[0]?.fileStoreId; |
🧰 Tools
🪛 Biome
[error] 295-295: This let declares a variable that is only assigned once.
'fileStoreId' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
const goBackToBoundary = ()=> { | ||
window.history.pushState( | ||
{ | ||
data: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.
'data' is undefined in 'goBackToBoundary' function
The variable data
used in window.history.pushState
is not defined within the scope of the goBackToBoundary
function. This will result in a ReferenceError
when the function is called.
To fix this issue, define data
before using it or remove it if it's not necessary:
window.history.pushState(
{
- data:data
+ // data: data
},
"",
`/${window.contextPath}/employee/campaign/boundary-management?defaultHierarchyType=${defaultHierarchyType}&hierarchyType=${hierarchyType}`
);
Committable suggestion was skipped due to low confidence.
<div className="dustbin-icon" onClick={() => removeLevel(index)}> | ||
<DustbinIcon /> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace 'div' with 'button' for accessibility
The div
element with an onClick
handler should be replaced with a button
element to ensure keyboard accessibility. This allows users who navigate via keyboard to interact with the element.
Apply this diff to enhance accessibility:
-<div className="dustbin-icon" onClick={() => removeLevel(index)}>
+<button className="dustbin-icon" onClick={() => removeLevel(index)} type="button">
<DustbinIcon />
-</div>
+</button>
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
<div className="dustbin-icon" onClick={() => removeLevel(index)}> | |
<DustbinIcon /> | |
</div> | |
<button className="dustbin-icon" onClick={() => removeLevel(index)} type="button"> | |
<DustbinIcon /> | |
</button> |
🧰 Tools
🪛 Biome
[error] 432-432: 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)
className={"custom-popup"} | ||
type={"default"} | ||
heading={t("ADD_BOUNDARY_HIERARCHY_LEVEL")} | ||
children={[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Avoid passing 'children' as a prop
Passing children
directly as a prop is not recommended in React. Instead, include child elements between the opening and closing tags of the component.
Update the PopUp
component usage:
<PopUp
className={"custom-popup"}
type={"default"}
heading={t("ADD_BOUNDARY_HIERARCHY_LEVEL")}
- children={[
- ]}
onClose={()=>{
setShowPopUp(false);
}}
onOverlayClick={()=>{
setShowPopUp(false);
}}
style={{
width: "50rem"
}}
footerChildren={[
// Footer buttons
]}
sortFooterChildren={true}
>
{/* Include any child components or elements here */}
</PopUp>
Committable suggestion was skipped due to low confidence.
🧰 Tools
🪛 Biome
[error] 353-353: Avoid passing children using a prop
The canonical way to pass children in React is to use JSX elements
(lint/correctness/noChildrenProp)
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: 22
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
📒 Files selected for processing (4)
- health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/Boundary.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/GeoPode.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewHierarchy.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/Svgicon.js (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/Boundary.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/GeoPode.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewHierarchy.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/Svgicon.js (1)
Pattern
**/*.js
: check
🪛 Biome
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/Boundary.js
[error] 158-158: 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] 117-117: Avoid passing children using a prop
The canonical way to pass children in React is to use JSX elements
(lint/correctness/noChildrenProp)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/GeoPode.js
[error] 158-158: 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] 165-165: 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] 205-205: 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] 211-211: 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] 320-320: 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] 324-324: 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] 342-342: 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] 348-348: 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] 24-24: This let declares a variable that is only assigned once.
'receivedData' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 161-161: 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] 191-191: 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] 236-236: Avoid passing children using a prop
The canonical way to pass children in React is to use JSX elements
(lint/correctness/noChildrenProp)
[error] 249-257: 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] 258-268: 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] 279-287: 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] 288-297: 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] 328-328: 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: Avoid passing children using a prop
The canonical way to pass children in React is to use JSX elements
(lint/correctness/noChildrenProp)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewHierarchy.js
[error] 135-135: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 137-137: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 171-171: 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] 183-183: 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] 210-210: 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] 230-230: 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] 315-315: 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] 93-93: This let declares a variable that is only assigned once.
'file' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 94-94: This let declares a variable that is only assigned once.
'fileDataTemp' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 99-99: This let declares a variable that is only assigned once.
'fileStoreIdTemp' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 281-290: 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] 291-300: 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] 319-328: 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] 329-338: 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)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/Svgicon.js
[error] 5-5: Alternative text title element cannot be empty
For accessibility purposes, SVGs should have an alternative text, provided via title element. If the svg element has role="img", you should add the aria-label or aria-labelledby attribute.
(lint/a11y/noSvgWithoutTitle)
🔇 Additional comments (6)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/Svgicon.js (1)
1-3
: LGTM: Import and component declaration look good.The import statement and component declaration follow React best practices. Using a named export for the
Svgicon
component is appropriate.health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/Boundary.js (3)
102-107
: Verify the correct usage of loading indicatorsYou are using
isFetching
to determine the loading state:if (isFetching) { return <Loader />; }Ensure that
isFetching
is the appropriate flag from your custom hook to indicate loading. IfisLoading
more accurately represents the loading state, consider using it instead.
113-154
: Avoid passing 'children' prop directlyPassing
children
as a prop to a component is unnecessary and not a standard practice in React. Instead, you should pass children as nested JSX elements within the component. In your<PopUp>
component, you can remove thechildren
prop and nest the content directly:🧰 Tools
🪛 Biome
[error] 117-117: Avoid passing children using a prop
The canonical way to pass children in React is to use JSX elements
(lint/correctness/noChildrenProp)
158-158
: Use self-closing tags for empty JSX elementsThe
<div>
element on line 158 is empty. In JSX, it's cleaner to use a self-closing tag for elements without children:🧰 Tools
🪛 Biome
[error] 158-158: 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/pages/employee/ViewHierarchy.js (1)
322-324
: Review theisDisabled
logic on the Back buttonThe Back button's
isDisabled
prop is set todisable
, which may unintentionally disable the button when it should be enabled. Verify if the button should be disabled based on the application's state, and adjust the logic accordingly to ensure proper navigation.health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/GeoPode.js (1)
97-107
:⚠️ Potential issue
data
is undefined ingoBackToBoundary
functionThe variable
data
used inwindow.history.pushState
is not defined within the scope of thegoBackToBoundary
function. This will result in aReferenceError
when the function is called.To fix this issue, define
data
before using it or remove it if it's not necessary:window.history.pushState( { - data: data + // data: data (Remove or define 'data' variable) }, "", `/${window.contextPath}/employee/campaign/boundary-management?defaultHierarchyType=${defaultHierarchyType}&hierarchyType=${hierarchyType}` );Likely invalid or redundant comment.
export const Svgicon = () => ( | ||
|
||
<svg width="69" height="72" viewBox="0 0 69 72" fill="none" xmlns="http://www.w3.org/2000/svg" xlink="http://www.w3.org/1999/xlink"> | ||
<rect width="69" height="72" fill="url(#pattern0_12654_28443)" /> | ||
<defs> | ||
<pattern id="pattern0_12654_28443" patternContentUnits="objectBoundingBox" width="1" height="1"> | ||
<use href="#image0_12654_28443" transform="matrix(0.00771642 0 0 0.00699301 -0.0015674 0)" /> | ||
</pattern> | ||
<image id="image0_12654_28443" width="130" height="143" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIIAAACPCAYAAAA2nQMjAAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAArUSURBVHgB7Z1dbBTXFcfP7CxrQ/xVbEpjF3AgMSRKHAdhAyIKOApSm2Ds5qmRqCD0LQoNfknT5gF4aJU3J7hN3hqj5KFSJb5atX2gQCgoCbYIBZUPpwUTgsHEJjaYYBvPTu4561n2e2ft3Z0Z+/+Tlp3xzo6Hub8599xzx7saZYHO9pZ1PtNoDhLVkakeRGUEEuPTdtZvO7iLXIZGU4AFINPYoRp/HQH7uFCGSYvQ2b5hBwW1nbysB+bQD2rWUOmiZ2h2+UJZB/Hc6j5OV4/9SZY10raseOPgHnIJkxKha3fTh6ZJW3i54sn19KPlzWh8m9w4dYD61EMI6o31rfuPkgvIWITO3RvbyDS3c8NXr3+dih5eRiAzImQYNINGY0Pr30+Tw/gy2fjk7qYtlgRLNrwJCSYJR9C5qitVlPl8+r4v2lqqyWFsi/ApH6xJO3h5vvqPzJ67kMDkWfDcL+VCMomqDZ9xxGkZbIswSzd2qH6kmpPCeSovAFOHu1ZOrlmGcd84RwbHht22ROADNE2thZc5rIHsYOVZgaIKtabVjevGPnIIWyLc1w0lgVnGoSx00CBb8PnkfEvOq6rH8IiMHMCWCGqjtfxcouoEIPtYMnCE4GF5Z/vGHZRnbImgugUuG6vkZimB3CAyvPRmaCVo7sy3DDaTRVNE4MQG5A4+vwue2xpaUTJ0vbdxM+WJtCJYmSwqh/lhbs2zMjxnTDI7OtvUfE4eSCvCyMRMIkTIHzwys2Qgn7HvZNuLdZRjMqosgvzBMlSE6jV5qT5CBBdTteoVNaO7PC/VR4jgchas3RquPk7IkJPqI0RwOTLB91Ko4DRRij5COQAieABrttcqReei+ggRPEKuq48QwUNY1UcZyme5+ggRPAYnjpWrfh5aUTJ8trtpO2UBiOBBuPpYqYaWjG5SWzZK0RDBo/DNQRGl6HenWn2ECB4msvqo+fQpFZwggsfh6qN1I+xUqo8QYRrA+cJUq48QYRqQqPqYqQwQYZoQW300dKMtk/dDhGlEXPVxd5NtGSDCNCOq+mjS9q72phY774MI0xBOHEuqQ3eca6a9z6qACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACEDQjn3wWMovi9JMf5lmBur4c/vwlcDe4d7AV2SMfUemNnLa1IKDqbY19ECrn7+qPtVGJo2rnY1T8P53dP9GPwEPocm/dfwBzanwG6Nl6BqAABGAABGAABGAABGAABGAABGA4KcZykPlj9OSZ98Or4+P3aZz/3iNZiozVgR/QQmVVjaE10fuXKOZDLoGIEAEIEAEIEAEIEAEIEwrEXgk4OZ95uL4soWnh4+llStpUf02VRNYFnWS7w6cp+H+83Sl8w80eudrygTeT1XtZvrh0pepsLgq/POh3pPUd2Ev9V3cm/B9sXWJoWuf05WudjlG3h8PVa1jHB+9TQM9hyZ1fLnCkyIUFv+Yap5/J6oOEAk3Cj/mq8bsPdNB/z/xe7IDv+eJn74fJYAF/y55VDVQ9+G34l6PrUvwvSBVY3do8ZrfJtyWj40fXylZrnS2k9N4TgSW4KnmjxI2ViIqa7eQrk58osaLxB8oplq133Thmxvvroo2187sSbldmZKiLImokSxcsU0iRLr95RrPibBwxetREvBJ5BDLoZbh1zgUlz/yQngbbryBS4fC2yQiMmxz+L/bf4H0QAkVVSyj+ctejjmGbbYbzmrkUVW5TLW/vov7ZFun8JwIpVUro9YvqbAf2W9znzvU+7lc3dw/W1Q9vTmlCAznFmcO/CKuQbj8zLmIBUvD3Qhvn639VT61WboJp/DUqIFPWGyXMKgaPRF9F/ZFrReoLiUV3Fj/VZNOia7K3rN74n5eVPE4pSPZ/rjBh2KOOzZK5BtPRQQ+qfyI7MfLVITgbD4WjhLJMvyE+1aJ3WiSiafQ772T8fBvNMVEFndntc0PIhYLzvt3qnvwXB0hNhzXNL4zMYJYSfmkwGaymoxE3Qp3N07huRyBs//QqOFBqLeGYgyP94f7z9HA5X/FhV83wVf+yO1rVFjyQCiOCkPkDJ6LCJxonVUJ2EiSQgyP5avUkJGTxfpNR8KCgNR4ssTMMnR+/LxEh/7Lh5L2q3yFcbexJEFRB0Tj6RJzZELIOQL3seWLX4gr5HBRieVxumgTi7+gOGrdyTrCtJl04nyg92yH6jY2qWjRGNd1sAxugnOc2FGIk7fLeSoicN//UMT4nYeNiRJCPqHdh38jeYJF4RSz/GwTO0/C0SBdgSqXuE4ELvwYY7cThkkess1f+rPwOs8PJBsZcF3Aabi7SnR8HAkWRlQWGR7tOIlrugYOlbXNH1PDpsO0emtXVAnWYuBydImY5xN4XiERi9ScRCSDDpzoJ37yx7hRC0tQm2DSLFFRLJ+4JiJUTszZW/BETL+aKIoMl3x1sQyRE0qL17yt1tdL7SBU/SuWkx/b/9504ETzMfCoha9+rjLysRUUVcUdG4980s2D5BrXiMBhPu5nCUq63Ufeotrij6JyBetegWTwfH8m5eZswQkrRzq++pPlKLzNpRO/I6dxTdfA07CRjEzMIsbCucOpvzRL446kubuHXz/3z9ccm9VLVfhiuLvi2clRF/xxjXbs/cdMcgl81fAtYhzib3bvTTuuDt0VtFJuVSsseVByHv7mvHQpqUrM1lSyRbqsPXYug6e7I4d7/HrkKIX59wc14dc4YlnHOD465KoSuKaZja4SwcukEsHtsAi4nR0IEAEIEAEIEAEIEAEIM/aDMrIN1wJiayFeAiJkCS4cdR/+NXkVdA1AgAhAgAhAgAhA8F+9NHj6/phRl3QDfRY9+shS0gvmUOWqVwh4g1tfHqe7vRfJ9N3ruK8NfpJq23HN3+O/+b9vGo1AgL/FJaEMhQWzSa8upYC/guY9+iIBb3Cv9zqNmDfIFyz9ZPWvOjvSbe9r3U+D+thYo1o+TWDGIjkCZADhZBEyzGyiRg2QYeYSN3yEDDOThHUEyDDzSFpQsmTw6T7I4EGCY/fk2TRo0M72KSuLLMPqp9dyZJBvFQXewRgNtZdJ+tRFYJ5p3a92pA2yCJDBO1htZRJlRwRBM6V74O8bBu6HJbDaqqF1v62u3ZYImqn9h5+HrnxBwP0MX78YWtDoqN332BLBDAb38/O33ScIuJ9vvwy1k0oUbX9EjC0R6lv/dpTt4pBzCzK4mrHhfhrqOSXLs0g/avd9tu9HsOzqO3UASaOL4fZhNI06VKLfY/d9tkVoaP1rB0cFNq73sz8TcB8sAUdsjbQe3dB3ZfLejO5QGjf0V3koeav7eNg84A44f7sx0SbBoLkrk2jAaJQhnW0b1pFP4xtZaN6T62n+8mbSA3MIOAdflJYEFNR21bce3EkZkrEITFdbU4vp0z5UmUNZoKhCZJhbs4ZAfhm+fkFJcFCehUlKwExKBObTtpZq3Rc8opFZzescFYoeXkaF5QsoUFxOIDcYo/doZOCqqumcCiftnBOoIf6rMrqbJJMWweJkW9MWzae9oaJDHYE8ow2qhOA9P/nfDU0FTGFPlCUkQpCxTklRrWnaIgK5wTSGzKDWoxZOTyUCxPI9S6knPN2AEnUAAAAASUVORK5CYII=" /> | ||
</defs> | ||
</svg> | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider improving component reusability and performance.
While the current implementation works, there are a few suggestions to enhance the component:
-
Make the component more reusable by accepting props for customization:
- Allow width and height to be passed as props.
- Accept an
ariaLabel
prop for accessibility.
-
The base64 encoded image significantly increases the file size. Consider:
- Using a separate image file and referencing it via URL.
- If the image is small and frequently used, consider using an SVG sprite.
Here's an example of how you could refactor the component:
import React from "react";
export const Svgicon = ({ width = 69, height = 72, ariaLabel = "Default description" }) => (
<svg
width={width}
height={height}
viewBox="0 0 69 72"
fill="none"
xmlns="http://www.w3.org/2000/svg"
xlink="http://www.w3.org/1999/xlink"
role="img"
aria-label={ariaLabel}
>
{/* SVG content */}
</svg>
);
This refactoring allows for more flexible usage of the component while addressing the accessibility concern.
🧰 Tools
🪛 Biome
[error] 5-5: Alternative text title element cannot be empty
For accessibility purposes, SVGs should have an alternative text, provided via title element. If the svg element has role="img", you should add the aria-label or aria-labelledby attribute.
(lint/a11y/noSvgWithoutTitle)
<svg width="69" height="72" viewBox="0 0 69 72" fill="none" xmlns="http://www.w3.org/2000/svg" xlink="http://www.w3.org/1999/xlink"> | ||
<rect width="69" height="72" fill="url(#pattern0_12654_28443)" /> | ||
<defs> | ||
<pattern id="pattern0_12654_28443" patternContentUnits="objectBoundingBox" width="1" height="1"> | ||
<use href="#image0_12654_28443" transform="matrix(0.00771642 0 0 0.00699301 -0.0015674 0)" /> | ||
</pattern> | ||
<image id="image0_12654_28443" width="130" height="143" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIIAAACPCAYAAAA2nQMjAAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAArUSURBVHgB7Z1dbBTXFcfP7CxrQ/xVbEpjF3AgMSRKHAdhAyIKOApSm2Ds5qmRqCD0LQoNfknT5gF4aJU3J7hN3hqj5KFSJb5atX2gQCgoCbYIBZUPpwUTgsHEJjaYYBvPTu4561n2e2ft3Z0Z+/+Tlp3xzo6Hub8599xzx7saZYHO9pZ1PtNoDhLVkakeRGUEEuPTdtZvO7iLXIZGU4AFINPYoRp/HQH7uFCGSYvQ2b5hBwW1nbysB+bQD2rWUOmiZ2h2+UJZB/Hc6j5OV4/9SZY10raseOPgHnIJkxKha3fTh6ZJW3i54sn19KPlzWh8m9w4dYD61EMI6o31rfuPkgvIWITO3RvbyDS3c8NXr3+dih5eRiAzImQYNINGY0Pr30+Tw/gy2fjk7qYtlgRLNrwJCSYJR9C5qitVlPl8+r4v2lqqyWFsi/ApH6xJO3h5vvqPzJ67kMDkWfDcL+VCMomqDZ9xxGkZbIswSzd2qH6kmpPCeSovAFOHu1ZOrlmGcd84RwbHht22ROADNE2thZc5rIHsYOVZgaIKtabVjevGPnIIWyLc1w0lgVnGoSx00CBb8PnkfEvOq6rH8IiMHMCWCGqjtfxcouoEIPtYMnCE4GF5Z/vGHZRnbImgugUuG6vkZimB3CAyvPRmaCVo7sy3DDaTRVNE4MQG5A4+vwue2xpaUTJ0vbdxM+WJtCJYmSwqh/lhbs2zMjxnTDI7OtvUfE4eSCvCyMRMIkTIHzwys2Qgn7HvZNuLdZRjMqosgvzBMlSE6jV5qT5CBBdTteoVNaO7PC/VR4jgchas3RquPk7IkJPqI0RwOTLB91Ko4DRRij5COQAieABrttcqReei+ggRPEKuq48QwUNY1UcZyme5+ggRPAYnjpWrfh5aUTJ8trtpO2UBiOBBuPpYqYaWjG5SWzZK0RDBo/DNQRGl6HenWn2ECB4msvqo+fQpFZwggsfh6qN1I+xUqo8QYRrA+cJUq48QYRqQqPqYqQwQYZoQW300dKMtk/dDhGlEXPVxd5NtGSDCNCOq+mjS9q72phY774MI0xBOHEuqQ3eca6a9z6qACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACEDQjn3wWMovi9JMf5lmBur4c/vwlcDe4d7AV2SMfUemNnLa1IKDqbY19ECrn7+qPtVGJo2rnY1T8P53dP9GPwEPocm/dfwBzanwG6Nl6BqAABGAABGAABGAABGAABGAABGA4KcZykPlj9OSZ98Or4+P3aZz/3iNZiozVgR/QQmVVjaE10fuXKOZDLoGIEAEIEAEIEAEIEAEIEwrEXgk4OZ95uL4soWnh4+llStpUf02VRNYFnWS7w6cp+H+83Sl8w80eudrygTeT1XtZvrh0pepsLgq/POh3pPUd2Ev9V3cm/B9sXWJoWuf05WudjlG3h8PVa1jHB+9TQM9hyZ1fLnCkyIUFv+Yap5/J6oOEAk3Cj/mq8bsPdNB/z/xe7IDv+eJn74fJYAF/y55VDVQ9+G34l6PrUvwvSBVY3do8ZrfJtyWj40fXylZrnS2k9N4TgSW4KnmjxI2ViIqa7eQrk58osaLxB8oplq133Thmxvvroo2187sSbldmZKiLImokSxcsU0iRLr95RrPibBwxetREvBJ5BDLoZbh1zgUlz/yQngbbryBS4fC2yQiMmxz+L/bf4H0QAkVVSyj+ctejjmGbbYbzmrkUVW5TLW/vov7ZFun8JwIpVUro9YvqbAf2W9znzvU+7lc3dw/W1Q9vTmlCAznFmcO/CKuQbj8zLmIBUvD3Qhvn639VT61WboJp/DUqIFPWGyXMKgaPRF9F/ZFrReoLiUV3Fj/VZNOia7K3rN74n5eVPE4pSPZ/rjBh2KOOzZK5BtPRQQ+qfyI7MfLVITgbD4WjhLJMvyE+1aJ3WiSiafQ772T8fBvNMVEFndntc0PIhYLzvt3qnvwXB0hNhzXNL4zMYJYSfmkwGaymoxE3Qp3N07huRyBs//QqOFBqLeGYgyP94f7z9HA5X/FhV83wVf+yO1rVFjyQCiOCkPkDJ6LCJxonVUJ2EiSQgyP5avUkJGTxfpNR8KCgNR4ssTMMnR+/LxEh/7Lh5L2q3yFcbexJEFRB0Tj6RJzZELIOQL3seWLX4gr5HBRieVxumgTi7+gOGrdyTrCtJl04nyg92yH6jY2qWjRGNd1sAxugnOc2FGIk7fLeSoicN//UMT4nYeNiRJCPqHdh38jeYJF4RSz/GwTO0/C0SBdgSqXuE4ELvwYY7cThkkess1f+rPwOs8PJBsZcF3Aabi7SnR8HAkWRlQWGR7tOIlrugYOlbXNH1PDpsO0emtXVAnWYuBydImY5xN4XiERi9ScRCSDDpzoJ37yx7hRC0tQm2DSLFFRLJ+4JiJUTszZW/BETL+aKIoMl3x1sQyRE0qL17yt1tdL7SBU/SuWkx/b/9504ETzMfCoha9+rjLysRUUVcUdG4980s2D5BrXiMBhPu5nCUq63Ufeotrij6JyBetegWTwfH8m5eZswQkrRzq++pPlKLzNpRO/I6dxTdfA07CRjEzMIsbCucOpvzRL446kubuHXz/3z9ccm9VLVfhiuLvi2clRF/xxjXbs/cdMcgl81fAtYhzib3bvTTuuDt0VtFJuVSsseVByHv7mvHQpqUrM1lSyRbqsPXYug6e7I4d7/HrkKIX59wc14dc4YlnHOD465KoSuKaZja4SwcukEsHtsAi4nR0IEAEIEAEIEAEIEAEIM/aDMrIN1wJiayFeAiJkCS4cdR/+NXkVdA1AgAhAgAhAgAhA8F+9NHj6/phRl3QDfRY9+shS0gvmUOWqVwh4g1tfHqe7vRfJ9N3ruK8NfpJq23HN3+O/+b9vGo1AgL/FJaEMhQWzSa8upYC/guY9+iIBb3Cv9zqNmDfIFyz9ZPWvOjvSbe9r3U+D+thYo1o+TWDGIjkCZADhZBEyzGyiRg2QYeYSN3yEDDOThHUEyDDzSFpQsmTw6T7I4EGCY/fk2TRo0M72KSuLLMPqp9dyZJBvFQXewRgNtZdJ+tRFYJ5p3a92pA2yCJDBO1htZRJlRwRBM6V74O8bBu6HJbDaqqF1v62u3ZYImqn9h5+HrnxBwP0MX78YWtDoqN332BLBDAb38/O33ScIuJ9vvwy1k0oUbX9EjC0R6lv/dpTt4pBzCzK4mrHhfhrqOSXLs0g/avd9tu9HsOzqO3UASaOL4fZhNI06VKLfY/d9tkVoaP1rB0cFNq73sz8TcB8sAUdsjbQe3dB3ZfLejO5QGjf0V3koeav7eNg84A44f7sx0SbBoLkrk2jAaJQhnW0b1pFP4xtZaN6T62n+8mbSA3MIOAdflJYEFNR21bce3EkZkrEITFdbU4vp0z5UmUNZoKhCZJhbs4ZAfhm+fkFJcFCehUlKwExKBObTtpZq3Rc8opFZzescFYoeXkaF5QsoUFxOIDcYo/doZOCqqumcCiftnBOoIf6rMrqbJJMWweJkW9MWzae9oaJDHYE8ow2qhOA9P/nfDU0FTGFPlCUkQpCxTklRrWnaIgK5wTSGzKDWoxZOTyUCxPI9S6knPN2AEnUAAAAASUVORK5CYII=" /> | ||
</defs> | ||
</svg> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add accessibility attributes to the SVG element.
The SVG structure is well-formed, but it lacks accessibility attributes. To improve accessibility:
- Add a
role="img"
attribute to the<svg>
element. - Add an
aria-label
attribute with a descriptive text.
Here's an example of how to modify the SVG opening tag:
- <svg width="69" height="72" viewBox="0 0 69 72" fill="none" xmlns="http://www.w3.org/2000/svg" xlink="http://www.w3.org/1999/xlink">
+ <svg width="69" height="72" viewBox="0 0 69 72" fill="none" xmlns="http://www.w3.org/2000/svg" xlink="http://www.w3.org/1999/xlink" role="img" aria-label="Description of the image">
Replace "Description of the image" with a brief, meaningful description of what the image represents.
📝 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.
<svg width="69" height="72" viewBox="0 0 69 72" fill="none" xmlns="http://www.w3.org/2000/svg" xlink="http://www.w3.org/1999/xlink"> | |
<rect width="69" height="72" fill="url(#pattern0_12654_28443)" /> | |
<defs> | |
<pattern id="pattern0_12654_28443" patternContentUnits="objectBoundingBox" width="1" height="1"> | |
<use href="#image0_12654_28443" transform="matrix(0.00771642 0 0 0.00699301 -0.0015674 0)" /> | |
</pattern> | |
<image id="image0_12654_28443" width="130" height="143" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIIAAACPCAYAAAA2nQMjAAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAArUSURBVHgB7Z1dbBTXFcfP7CxrQ/xVbEpjF3AgMSRKHAdhAyIKOApSm2Ds5qmRqCD0LQoNfknT5gF4aJU3J7hN3hqj5KFSJb5atX2gQCgoCbYIBZUPpwUTgsHEJjaYYBvPTu4561n2e2ft3Z0Z+/+Tlp3xzo6Hub8599xzx7saZYHO9pZ1PtNoDhLVkakeRGUEEuPTdtZvO7iLXIZGU4AFINPYoRp/HQH7uFCGSYvQ2b5hBwW1nbysB+bQD2rWUOmiZ2h2+UJZB/Hc6j5OV4/9SZY10raseOPgHnIJkxKha3fTh6ZJW3i54sn19KPlzWh8m9w4dYD61EMI6o31rfuPkgvIWITO3RvbyDS3c8NXr3+dih5eRiAzImQYNINGY0Pr30+Tw/gy2fjk7qYtlgRLNrwJCSYJR9C5qitVlPl8+r4v2lqqyWFsi/ApH6xJO3h5vvqPzJ67kMDkWfDcL+VCMomqDZ9xxGkZbIswSzd2qH6kmpPCeSovAFOHu1ZOrlmGcd84RwbHht22ROADNE2thZc5rIHsYOVZgaIKtabVjevGPnIIWyLc1w0lgVnGoSx00CBb8PnkfEvOq6rH8IiMHMCWCGqjtfxcouoEIPtYMnCE4GF5Z/vGHZRnbImgugUuG6vkZimB3CAyvPRmaCVo7sy3DDaTRVNE4MQG5A4+vwue2xpaUTJ0vbdxM+WJtCJYmSwqh/lhbs2zMjxnTDI7OtvUfE4eSCvCyMRMIkTIHzwys2Qgn7HvZNuLdZRjMqosgvzBMlSE6jV5qT5CBBdTteoVNaO7PC/VR4jgchas3RquPk7IkJPqI0RwOTLB91Ko4DRRij5COQAieABrttcqReei+ggRPEKuq48QwUNY1UcZyme5+ggRPAYnjpWrfh5aUTJ8trtpO2UBiOBBuPpYqYaWjG5SWzZK0RDBo/DNQRGl6HenWn2ECB4msvqo+fQpFZwggsfh6qN1I+xUqo8QYRrA+cJUq48QYRqQqPqYqQwQYZoQW300dKMtk/dDhGlEXPVxd5NtGSDCNCOq+mjS9q72phY774MI0xBOHEuqQ3eca6a9z6qACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACEDQjn3wWMovi9JMf5lmBur4c/vwlcDe4d7AV2SMfUemNnLa1IKDqbY19ECrn7+qPtVGJo2rnY1T8P53dP9GPwEPocm/dfwBzanwG6Nl6BqAABGAABGAABGAABGAABGAABGA4KcZykPlj9OSZ98Or4+P3aZz/3iNZiozVgR/QQmVVjaE10fuXKOZDLoGIEAEIEAEIEAEIEAEIEwrEXgk4OZ95uL4soWnh4+llStpUf02VRNYFnWS7w6cp+H+83Sl8w80eudrygTeT1XtZvrh0pepsLgq/POh3pPUd2Ev9V3cm/B9sXWJoWuf05WudjlG3h8PVa1jHB+9TQM9hyZ1fLnCkyIUFv+Yap5/J6oOEAk3Cj/mq8bsPdNB/z/xe7IDv+eJn74fJYAF/y55VDVQ9+G34l6PrUvwvSBVY3do8ZrfJtyWj40fXylZrnS2k9N4TgSW4KnmjxI2ViIqa7eQrk58osaLxB8oplq133Thmxvvroo2187sSbldmZKiLImokSxcsU0iRLr95RrPibBwxetREvBJ5BDLoZbh1zgUlz/yQngbbryBS4fC2yQiMmxz+L/bf4H0QAkVVSyj+ctejjmGbbYbzmrkUVW5TLW/vov7ZFun8JwIpVUro9YvqbAf2W9znzvU+7lc3dw/W1Q9vTmlCAznFmcO/CKuQbj8zLmIBUvD3Qhvn639VT61WboJp/DUqIFPWGyXMKgaPRF9F/ZFrReoLiUV3Fj/VZNOia7K3rN74n5eVPE4pSPZ/rjBh2KOOzZK5BtPRQQ+qfyI7MfLVITgbD4WjhLJMvyE+1aJ3WiSiafQ772T8fBvNMVEFndntc0PIhYLzvt3qnvwXB0hNhzXNL4zMYJYSfmkwGaymoxE3Qp3N07huRyBs//QqOFBqLeGYgyP94f7z9HA5X/FhV83wVf+yO1rVFjyQCiOCkPkDJ6LCJxonVUJ2EiSQgyP5avUkJGTxfpNR8KCgNR4ssTMMnR+/LxEh/7Lh5L2q3yFcbexJEFRB0Tj6RJzZELIOQL3seWLX4gr5HBRieVxumgTi7+gOGrdyTrCtJl04nyg92yH6jY2qWjRGNd1sAxugnOc2FGIk7fLeSoicN//UMT4nYeNiRJCPqHdh38jeYJF4RSz/GwTO0/C0SBdgSqXuE4ELvwYY7cThkkess1f+rPwOs8PJBsZcF3Aabi7SnR8HAkWRlQWGR7tOIlrugYOlbXNH1PDpsO0emtXVAnWYuBydImY5xN4XiERi9ScRCSDDpzoJ37yx7hRC0tQm2DSLFFRLJ+4JiJUTszZW/BETL+aKIoMl3x1sQyRE0qL17yt1tdL7SBU/SuWkx/b/9504ETzMfCoha9+rjLysRUUVcUdG4980s2D5BrXiMBhPu5nCUq63Ufeotrij6JyBetegWTwfH8m5eZswQkrRzq++pPlKLzNpRO/I6dxTdfA07CRjEzMIsbCucOpvzRL446kubuHXz/3z9ccm9VLVfhiuLvi2clRF/xxjXbs/cdMcgl81fAtYhzib3bvTTuuDt0VtFJuVSsseVByHv7mvHQpqUrM1lSyRbqsPXYug6e7I4d7/HrkKIX59wc14dc4YlnHOD465KoSuKaZja4SwcukEsHtsAi4nR0IEAEIEAEIEAEIEAEIM/aDMrIN1wJiayFeAiJkCS4cdR/+NXkVdA1AgAhAgAhAgAhA8F+9NHj6/phRl3QDfRY9+shS0gvmUOWqVwh4g1tfHqe7vRfJ9N3ruK8NfpJq23HN3+O/+b9vGo1AgL/FJaEMhQWzSa8upYC/guY9+iIBb3Cv9zqNmDfIFyz9ZPWvOjvSbe9r3U+D+thYo1o+TWDGIjkCZADhZBEyzGyiRg2QYeYSN3yEDDOThHUEyDDzSFpQsmTw6T7I4EGCY/fk2TRo0M72KSuLLMPqp9dyZJBvFQXewRgNtZdJ+tRFYJ5p3a92pA2yCJDBO1htZRJlRwRBM6V74O8bBu6HJbDaqqF1v62u3ZYImqn9h5+HrnxBwP0MX78YWtDoqN332BLBDAb38/O33ScIuJ9vvwy1k0oUbX9EjC0R6lv/dpTt4pBzCzK4mrHhfhrqOSXLs0g/avd9tu9HsOzqO3UASaOL4fZhNI06VKLfY/d9tkVoaP1rB0cFNq73sz8TcB8sAUdsjbQe3dB3ZfLejO5QGjf0V3koeav7eNg84A44f7sx0SbBoLkrk2jAaJQhnW0b1pFP4xtZaN6T62n+8mbSA3MIOAdflJYEFNR21bce3EkZkrEITFdbU4vp0z5UmUNZoKhCZJhbs4ZAfhm+fkFJcFCehUlKwExKBObTtpZq3Rc8opFZzescFYoeXkaF5QsoUFxOIDcYo/doZOCqqumcCiftnBOoIf6rMrqbJJMWweJkW9MWzae9oaJDHYE8ow2qhOA9P/nfDU0FTGFPlCUkQpCxTklRrWnaIgK5wTSGzKDWoxZOTyUCxPI9S6knPN2AEnUAAAAASUVORK5CYII=" /> | |
</defs> | |
</svg> | |
<svg width="69" height="72" viewBox="0 0 69 72" fill="none" xmlns="http://www.w3.org/2000/svg" xlink="http://www.w3.org/1999/xlink" role="img" aria-label="Description of the image"> | |
<rect width="69" height="72" fill="url(#pattern0_12654_28443)" /> | |
<defs> | |
<pattern id="pattern0_12654_28443" patternContentUnits="objectBoundingBox" width="1" height="1"> | |
<use href="#image0_12654_28443" transform="matrix(0.00771642 0 0 0.00699301 -0.0015674 0)" /> | |
</pattern> | |
<image id="image0_12654_28443" width="130" height="143" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIIAAACPCAYAAAA2nQMjAAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAArUSURBVHgB7Z1dbBTXFcfP7CxrQ/xVbEpjF3AgMSRKHAdhAyIKOApSm2Ds5qmRqCD0LQoNfknT5gF4aJU3J7hN3hqj5KFSJb5atX2gQCgoCbYIBZUPpwUTgsHEJjaYYBvPTu4561n2e2ft3Z0Z+/+Tlp3xzo6Hub8599xzx7saZYHO9pZ1PtNoDhLVkakeRGUEEuPTdtZvO7iLXIZGU4AFINPYoRp/HQH7uFCGSYvQ2b5hBwW1nbysB+bQD2rWUOmiZ2h2+UJZB/Hc6j5OV4/9SZY10raseOPgHnIJkxKha3fTh6ZJW3i54sn19KPlzWh8m9w4dYD61EMI6o31rfuPkgvIWITO3RvbyDS3c8NXr3+dih5eRiAzImQYNINGY0Pr30+Tw/gy2fjk7qYtlgRLNrwJCSYJR9C5qitVlPl8+r4v2lqqyWFsi/ApH6xJO3h5vvqPzJ67kMDkWfDcL+VCMomqDZ9xxGkZbIswSzd2qH6kmpPCeSovAFOHu1ZOrlmGcd84RwbHht22ROADNE2thZc5rIHsYOVZgaIKtabVjevGPnIIWyLc1w0lgVnGoSx00CBb8PnkfEvOq6rH8IiMHMCWCGqjtfxcouoEIPtYMnCE4GF5Z/vGHZRnbImgugUuG6vkZimB3CAyvPRmaCVo7sy3DDaTRVNE4MQG5A4+vwue2xpaUTJ0vbdxM+WJtCJYmSwqh/lhbs2zMjxnTDI7OtvUfE4eSCvCyMRMIkTIHzwys2Qgn7HvZNuLdZRjMqosgvzBMlSE6jV5qT5CBBdTteoVNaO7PC/VR4jgchas3RquPk7IkJPqI0RwOTLB91Ko4DRRij5COQAieABrttcqReei+ggRPEKuq48QwUNY1UcZyme5+ggRPAYnjpWrfh5aUTJ8trtpO2UBiOBBuPpYqYaWjG5SWzZK0RDBo/DNQRGl6HenWn2ECB4msvqo+fQpFZwggsfh6qN1I+xUqo8QYRrA+cJUq48QYRqQqPqYqQwQYZoQW300dKMtk/dDhGlEXPVxd5NtGSDCNCOq+mjS9q72phY774MI0xBOHEuqQ3eca6a9z6qACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACECACEDQjn3wWMovi9JMf5lmBur4c/vwlcDe4d7AV2SMfUemNnLa1IKDqbY19ECrn7+qPtVGJo2rnY1T8P53dP9GPwEPocm/dfwBzanwG6Nl6BqAABGAABGAABGAABGAABGAABGA4KcZykPlj9OSZ98Or4+P3aZz/3iNZiozVgR/QQmVVjaE10fuXKOZDLoGIEAEIEAEIEAEIEAEIEwrEXgk4OZ95uL4soWnh4+llStpUf02VRNYFnWS7w6cp+H+83Sl8w80eudrygTeT1XtZvrh0pepsLgq/POh3pPUd2Ev9V3cm/B9sXWJoWuf05WudjlG3h8PVa1jHB+9TQM9hyZ1fLnCkyIUFv+Yap5/J6oOEAk3Cj/mq8bsPdNB/z/xe7IDv+eJn74fJYAF/y55VDVQ9+G34l6PrUvwvSBVY3do8ZrfJtyWj40fXylZrnS2k9N4TgSW4KnmjxI2ViIqa7eQrk58osaLxB8oplq133Thmxvvroo2187sSbldmZKiLImokSxcsU0iRLr95RrPibBwxetREvBJ5BDLoZbh1zgUlz/yQngbbryBS4fC2yQiMmxz+L/bf4H0QAkVVSyj+ctejjmGbbYbzmrkUVW5TLW/vov7ZFun8JwIpVUro9YvqbAf2W9znzvU+7lc3dw/W1Q9vTmlCAznFmcO/CKuQbj8zLmIBUvD3Qhvn639VT61WboJp/DUqIFPWGyXMKgaPRF9F/ZFrReoLiUV3Fj/VZNOia7K3rN74n5eVPE4pSPZ/rjBh2KOOzZK5BtPRQQ+qfyI7MfLVITgbD4WjhLJMvyE+1aJ3WiSiafQ772T8fBvNMVEFndntc0PIhYLzvt3qnvwXB0hNhzXNL4zMYJYSfmkwGaymoxE3Qp3N07huRyBs//QqOFBqLeGYgyP94f7z9HA5X/FhV83wVf+yO1rVFjyQCiOCkPkDJ6LCJxonVUJ2EiSQgyP5avUkJGTxfpNR8KCgNR4ssTMMnR+/LxEh/7Lh5L2q3yFcbexJEFRB0Tj6RJzZELIOQL3seWLX4gr5HBRieVxumgTi7+gOGrdyTrCtJl04nyg92yH6jY2qWjRGNd1sAxugnOc2FGIk7fLeSoicN//UMT4nYeNiRJCPqHdh38jeYJF4RSz/GwTO0/C0SBdgSqXuE4ELvwYY7cThkkess1f+rPwOs8PJBsZcF3Aabi7SnR8HAkWRlQWGR7tOIlrugYOlbXNH1PDpsO0emtXVAnWYuBydImY5xN4XiERi9ScRCSDDpzoJ37yx7hRC0tQm2DSLFFRLJ+4JiJUTszZW/BETL+aKIoMl3x1sQyRE0qL17yt1tdL7SBU/SuWkx/b/9504ETzMfCoha9+rjLysRUUVcUdG4980s2D5BrXiMBhPu5nCUq63Ufeotrij6JyBetegWTwfH8m5eZswQkrRzq++pPlKLzNpRO/I6dxTdfA07CRjEzMIsbCucOpvzRL446kubuHXz/3z9ccm9VLVfhiuLvi2clRF/xxjXbs/cdMcgl81fAtYhzib3bvTTuuDt0VtFJuVSsseVByHv7mvHQpqUrM1lSyRbqsPXYug6e7I4d7/HrkKIX59wc14dc4YlnHOD465KoSuKaZja4SwcukEsHtsAi4nR0IEAEIEAEIEAEIEAEIM/aDMrIN1wJiayFeAiJkCS4cdR/+NXkVdA1AgAhAgAhAgAhA8F+9NHj6/phRl3QDfRY9+shS0gvmUOWqVwh4g1tfHqe7vRfJ9N3ruK8NfpJq23HN3+O/+b9vGo1AgL/FJaEMhQWzSa8upYC/guY9+iIBb3Cv9zqNmDfIFyz9ZPWvOjvSbe9r3U+D+thYo1o+TWDGIjkCZADhZBEyzGyiRg2QYeYSN3yEDDOThHUEyDDzSFpQsmTw6T7I4EGCY/fk2TRo0M72KSuLLMPqp9dyZJBvFQXewRgNtZdJ+tRFYJ5p3a92pA2yCJDBO1htZRJlRwRBM6V74O8bBu6HJbDaqqF1v62u3ZYImqn9h5+HrnxBwP0MX78YWtDoqN332BLBDAb38/O33ScIuJ9vvwy1k0oUbX9EjC0R6lv/dpTt4pBzCzK4mrHhfhrqOSXLs0g/avd9tu9HsOzqO3UASaOL4fZhNI06VKLfY/d9tkVoaP1rB0cFNq73sz8TcB8sAUdsjbQe3dB3ZfLejO5QGjf0V3koeav7eNg84A44f7sx0SbBoLkrk2jAaJQhnW0b1pFP4xtZaN6T62n+8mbSA3MIOAdflJYEFNR21bce3EkZkrEITFdbU4vp0z5UmUNZoKhCZJhbs4ZAfhm+fkFJcFCehUlKwExKBObTtpZq3Rc8opFZzescFYoeXkaF5QsoUFxOIDcYo/doZOCqqumcCiftnBOoIf6rMrqbJJMWweJkW9MWzae9oaJDHYE8ow2qhOA9P/nfDU0FTGFPlCUkQpCxTklRrWnaIgK5wTSGzKDWoxZOTyUCxPI9S6knPN2AEnUAAAAASUVORK5CYII=" /> | |
</defs> | |
</svg> |
🧰 Tools
🪛 Biome
[error] 5-5: Alternative text title element cannot be empty
For accessibility purposes, SVGs should have an alternative text, provided via title element. If the svg element has role="img", you should add the aria-label or aria-labelledby attribute.
(lint/a11y/noSvgWithoutTitle)
import { useTranslation } from "react-i18next"; | ||
import { useHistory } from "react-router-dom/cjs/react-router-dom.min"; | ||
import { useParams } from "react-router-dom"; | ||
import { setAllDocuments } from "@cyntler/react-doc-viewer/dist/esm/store/actions"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Avoid deep imports from third-party libraries
Importing from deep within a library's internal modules ("@cyntler/react-doc-viewer/dist/esm/store/actions"
) can lead to potential issues if the library's internal structure changes. It's recommended to import from the library's public API to ensure stability and maintainability.
const hierarchyType = searchParams.get("hierarchyType"); | ||
const [showPopUp, setShowPopUp] = useState(false); | ||
const stateData = window.history.state; | ||
const [geoPodeData, setGeoPodeData] = useState(false); |
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)
Rename boolean state variable for clarity
The state variable geoPodeData
is used as a boolean flag, but its name suggests it contains data. To improve readability, consider renaming it to hasGeoPodeData
or isGeoPodeDataAvailable
.
} catch (error) { | ||
} |
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.
Handle errors properly in the catch block
The catch
block in your fetchData
function is empty, which means any errors during the API call will be ignored silently. This can make debugging difficult and may hide potential issues. Consider adding error handling logic, such as logging the error or setting an error state to inform the user.
Apply this change:
} catch (error) {
-}
+ console.error('Error fetching data:', error);
+ // Optionally, set an error state to display an error message to the user
}
📝 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.
} catch (error) { | |
} | |
} catch (error) { | |
console.error('Error fetching data:', error); | |
// Optionally, set an error state to display an error message to the user | |
} |
return prevItems.map((item, idx) => { | ||
if(idx===0) | ||
{ | ||
if(newHierarchy) item.parentBoundaryType=null; | ||
else{ | ||
if(boundaryData.length === 0) item.parentBoundaryType=null; | ||
else item.parentBoundaryType = boundaryData[boundaryData.length-1].boundaryType; | ||
|
||
} | ||
} | ||
if (idx > 0) { | ||
item.parentBoundaryType = prevItems[idx - 1].boundaryType; | ||
} | ||
return item; | ||
}); |
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 mutating state directly in addParents
function
Directly mutating state can lead to unexpected behavior in React. In the addParents
function, you're modifying the item
object directly. Instead, create a new object for each item to maintain immutability.
Apply this diff to prevent direct mutation:
return prevItems.map((item, idx) => {
+ const newItem = { ...item };
if(idx === 0) {
if(newHierarchy)
- item.parentBoundaryType = null;
+ newItem.parentBoundaryType = null;
else {
if(boundaryData.length === 0)
- item.parentBoundaryType = null;
+ newItem.parentBoundaryType = null;
else
- item.parentBoundaryType = boundaryData[boundaryData.length-1].boundaryType;
+ newItem.parentBoundaryType = boundaryData[boundaryData.length-1].boundaryType;
}
}
if (idx > 0) {
- item.parentBoundaryType = prevItems[idx - 1].boundaryType;
+ newItem.parentBoundaryType = prevItems[idx - 1].boundaryType;
}
- return item;
+ return newItem;
});
📝 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.
return prevItems.map((item, idx) => { | |
if(idx===0) | |
{ | |
if(newHierarchy) item.parentBoundaryType=null; | |
else{ | |
if(boundaryData.length === 0) item.parentBoundaryType=null; | |
else item.parentBoundaryType = boundaryData[boundaryData.length-1].boundaryType; | |
} | |
} | |
if (idx > 0) { | |
item.parentBoundaryType = prevItems[idx - 1].boundaryType; | |
} | |
return item; | |
}); | |
return prevItems.map((item, idx) => { | |
const newItem = { ...item }; | |
if(idx===0) | |
{ | |
if(newHierarchy) newItem.parentBoundaryType=null; | |
else{ | |
if(boundaryData.length === 0) newItem.parentBoundaryType=null; | |
else newItem.parentBoundaryType = boundaryData[boundaryData.length-1].boundaryType; | |
} | |
} | |
if (idx > 0) { | |
newItem.parentBoundaryType = prevItems[idx - 1].boundaryType; | |
} | |
return newItem; | |
}); |
<div> | ||
<div style={{fontWeight:"600", fontSize:"1.2rem"}}> | ||
{item?.boundaryType} | ||
</div> | ||
<div style={{height:"1rem"}}></div> | ||
<Card type={"primary"} variant={"form"} className={"question-card-container"} > | ||
<div style={{display:"flex", gap:"2rem"}}> | ||
<Svgicon /> | ||
<div style={{display:"flex", alignItems:"center", fontWeight:"600"}}> | ||
{item?.boundaryType}{".shp"} | ||
</div> | ||
</div> | ||
</Card> | ||
<hr style={{borderTop:"1px solid #ccc", margin:"1rem 0"}}/> | ||
</div> | ||
))} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add 'key' prop to list items in boundaryData.map
When rendering lists in React using map()
, each element should have a unique key
prop. This helps React optimize rendering and identify which items have changed or moved.
Apply this diff to add the key
prop:
{boundaryData.map((item, index) => (
- <div>
+ <div key={index}>
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
<div> | |
<div style={{fontWeight:"600", fontSize:"1.2rem"}}> | |
{item?.boundaryType} | |
</div> | |
<div style={{height:"1rem"}}></div> | |
<Card type={"primary"} variant={"form"} className={"question-card-container"} > | |
<div style={{display:"flex", gap:"2rem"}}> | |
<Svgicon /> | |
<div style={{display:"flex", alignItems:"center", fontWeight:"600"}}> | |
{item?.boundaryType}{".shp"} | |
</div> | |
</div> | |
</Card> | |
<hr style={{borderTop:"1px solid #ccc", margin:"1rem 0"}}/> | |
</div> | |
))} | |
{boundaryData.map((item, index) => ( | |
<div key={index}> | |
<div style={{fontWeight:"600", fontSize:"1.2rem"}}> | |
{item?.boundaryType} | |
</div> | |
<div style={{height:"1rem"}}></div> | |
<Card type={"primary"} variant={"form"} className={"question-card-container"} > | |
<div style={{display:"flex", gap:"2rem"}}> | |
<Svgicon /> | |
<div style={{display:"flex", alignItems:"center", fontWeight:"600"}}> | |
{item?.boundaryType}{".shp"} | |
</div> | |
</div> | |
</Card> | |
<hr style={{borderTop:"1px solid #ccc", margin:"1rem 0"}}/> | |
</div> | |
))} |
🧰 Tools
🪛 Biome
[error] 165-165: 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] 161-161: 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)
<div className="dustbin-icon" onClick={() => removeLevel(index)}> | ||
<DustbinIcon /> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace div
with button
for accessibility
For consistency and accessibility, replace the div
element with a button
element to ensure keyboard interaction is possible.
Apply this diff:
-<div className="dustbin-icon" onClick={() => removeLevel(index)}>
+<button className="dustbin-icon" onClick={() => removeLevel(index)} type="button">
<DustbinIcon />
-</div>
+</button>
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
<div className="dustbin-icon" onClick={() => removeLevel(index)}> | |
<DustbinIcon /> | |
</div> | |
<button className="dustbin-icon" onClick={() => removeLevel(index)} type="button"> | |
<DustbinIcon /> | |
</button> |
🧰 Tools
🪛 Biome
[error] 342-342: 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)
<div> | ||
<div style={{display:"flex"}}> | ||
<div style={{width:"20rem", marginTop:"0.6rem", fontWeight:"600"}}>{t("LEVEL")} {index + 1}</div> | ||
<div style={{display:"flex", gap:"1rem"}}> | ||
<TextInput | ||
type={"text"} | ||
populators={{ | ||
resizeSmart: false | ||
}} | ||
style={{width:"27rem", display:"flex", justifyContent:"flex-end"}} | ||
value={item?.boundaryType} | ||
onChange={(event)=>addLevelName(event.target.value, index)} | ||
placeholder={""} | ||
/> | ||
<div className="dustbin-icon" onClick={() => removeLevel(index)}> | ||
<DustbinIcon /> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
<div style={{height:"1.5rem"}}></div> | ||
</div> | ||
)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add 'key' prop to list items in newBoundaryData.map
Again, ensure that each item rendered in the list has a unique key
prop to prevent potential rendering issues.
Apply this diff:
{newBoundaryData.map((item, index) => (
- <div>
+ <div key={index}>
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
<div> | |
<div style={{display:"flex"}}> | |
<div style={{width:"20rem", marginTop:"0.6rem", fontWeight:"600"}}>{t("LEVEL")} {index + 1}</div> | |
<div style={{display:"flex", gap:"1rem"}}> | |
<TextInput | |
type={"text"} | |
populators={{ | |
resizeSmart: false | |
}} | |
style={{width:"27rem", display:"flex", justifyContent:"flex-end"}} | |
value={item?.boundaryType} | |
onChange={(event)=>addLevelName(event.target.value, index)} | |
placeholder={""} | |
/> | |
<div className="dustbin-icon" onClick={() => removeLevel(index)}> | |
<DustbinIcon /> | |
</div> | |
</div> | |
</div> | |
<div style={{height:"1.5rem"}}></div> | |
</div> | |
)) | |
{newBoundaryData.map((item, index) => ( | |
<div key={index}> | |
<div style={{display:"flex"}}> | |
<div style={{width:"20rem", marginTop:"0.6rem", fontWeight:"600"}}>{t("LEVEL")} {index + 1}</div> | |
<div style={{display:"flex", gap:"1rem"}}> | |
<TextInput | |
type={"text"} | |
populators={{ | |
resizeSmart: false | |
}} | |
style={{width:"27rem", display:"flex", justifyContent:"flex-end"}} | |
value={item?.boundaryType} | |
onChange={(event)=>addLevelName(event.target.value, index)} | |
placeholder={""} | |
/> | |
<div className="dustbin-icon" onClick={() => removeLevel(index)}> | |
<DustbinIcon /> | |
</div> | |
</div> | |
</div> | |
<div style={{height:"1.5rem"}}></div> | |
</div> | |
)) |
🧰 Tools
🪛 Biome
[error] 342-342: 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] 348-348: 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] 328-328: 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)
<div> | ||
<div style={{display:"flex"}}> | ||
<div style={{width:"20rem", marginTop:"0.6rem", fontWeight:"600"}}>{t("LEVEL")} {boundaryData.length + index + 1}</div> | ||
<div style={{display:"flex", gap:"1rem"}}> | ||
<TextInput | ||
type={"text"} | ||
populators={{ | ||
resizeSmart: false | ||
}} | ||
style={{width:"27rem", display:"flex", justifyContent:"flex-end"}} | ||
value={item?.boundaryType} | ||
onChange={(event)=>addLevelName(event.target.value, index)} | ||
placeholder={""} | ||
/> | ||
<div className="dustbin-icon" onClick={() => removeLevel(index)}> | ||
<DustbinIcon /> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
<div style={{height:"1.5rem"}}></div> | ||
</div> | ||
)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add 'key' prop to list items in newBoundaryData.map
Similar to the previous comment, please add a unique key
prop to each element in your newBoundaryData.map
to help React manage the list efficiently.
Apply this diff:
{newBoundaryData.map((item, index) => (
- <div>
+ <div key={index}>
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
<div> | |
<div style={{display:"flex"}}> | |
<div style={{width:"20rem", marginTop:"0.6rem", fontWeight:"600"}}>{t("LEVEL")} {boundaryData.length + index + 1}</div> | |
<div style={{display:"flex", gap:"1rem"}}> | |
<TextInput | |
type={"text"} | |
populators={{ | |
resizeSmart: false | |
}} | |
style={{width:"27rem", display:"flex", justifyContent:"flex-end"}} | |
value={item?.boundaryType} | |
onChange={(event)=>addLevelName(event.target.value, index)} | |
placeholder={""} | |
/> | |
<div className="dustbin-icon" onClick={() => removeLevel(index)}> | |
<DustbinIcon /> | |
</div> | |
</div> | |
</div> | |
<div style={{height:"1.5rem"}}></div> | |
</div> | |
)) | |
} | |
{newBoundaryData.map((item, index) => ( | |
<div key={index}> | |
<div style={{display:"flex"}}> | |
<div style={{width:"20rem", marginTop:"0.6rem", fontWeight:"600"}}>{t("LEVEL")} {boundaryData.length + index + 1}</div> | |
<div style={{display:"flex", gap:"1rem"}}> | |
<TextInput | |
type={"text"} | |
populators={{ | |
resizeSmart: false | |
}} | |
style={{width:"27rem", display:"flex", justifyContent:"flex-end"}} | |
value={item?.boundaryType} | |
onChange={(event)=>addLevelName(event.target.value, index)} | |
placeholder={""} | |
/> | |
<div className="dustbin-icon" onClick={() => removeLevel(index)}> | |
<DustbinIcon /> | |
</div> | |
</div> | |
</div> | |
<div style={{height:"1.5rem"}}></div> | |
</div> | |
)) | |
} |
🧰 Tools
🪛 Biome
[error] 205-205: 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] 211-211: 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] 191-191: 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)
…gn-manager/src/components/CampaignCard.js 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: 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/components/CampaignCard.js (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignCard.js (1)
Pattern
**/*.js
: check
{ | ||
label: t("BOUNDARY_MANAGEMENT"), | ||
link: `/${window?.contextPath}/employee/campaign/boundary-management?defaultHierarchyType=HIERARCHYTEST&hierarchyType=DEMOTEST6`, | ||
roles: ROLES.CAMPAIGN_MANAGER, | ||
// count: isLoading?"-":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.
🧹 Nitpick (assertive)
Approve new "Boundary Management" link with suggestion for improvement
The addition of the "Boundary Management" link is approved and aligns with the PR objectives. However, to improve maintainability and flexibility, consider using configuration variables for defaultHierarchyType
and hierarchyType
instead of hardcoding the values.
Consider refactoring the link construction as follows:
const HIERARCHY_CONFIG = {
defaultHierarchyType: "HIERARCHYTEST",
hierarchyType: "DEMOTEST6"
};
// In the links array
{
label: t("BOUNDARY_MANAGEMENT"),
link: `/${window?.contextPath}/employee/campaign/boundary-management?defaultHierarchyType=${HIERARCHY_CONFIG.defaultHierarchyType}&hierarchyType=${HIERARCHY_CONFIG.hierarchyType}`,
roles: ROLES.CAMPAIGN_MANAGER,
}
This approach allows for easier updates to hierarchy types in the future and improves the overall code maintainability.
uiConfig: { | ||
columns: [ | ||
{ | ||
label: "Hierarchy Name", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
transalation
|
||
const callGeoPode = (val)=>{ | ||
|
||
window.history.pushState( |
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.
dont use window .histrory
}, | ||
requestBody: { | ||
BoundaryTypeHierarchySearchCriteria: { | ||
"tenantId": "mz", |
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.
tenantid hardcoded
break; | ||
case "Action": | ||
console.log("download button") | ||
return( |
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 logs
@@ -0,0 +1,65 @@ | |||
import React from "react"; | |||
|
|||
export const ShpFileIcon = () => ( |
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.
move to svg library
clean up the 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.
Actionable comments posted: 27
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
📒 Files selected for processing (7)
- health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/BoundaryPopup.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/FinalPopup.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js (2 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/boundarySearchConfig.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/Boundary.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/GeoPode.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewHierarchy.js (1 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/BoundaryPopup.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/FinalPopup.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/boundarySearchConfig.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/Boundary.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/GeoPode.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewHierarchy.js (1)
Pattern
**/*.js
: check
🪛 Biome
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/BoundaryPopup.js
[error] 13-13: Avoid passing children using a prop
The canonical way to pass children in React is to use JSX elements
(lint/correctness/noChildrenProp)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/FinalPopup.js
[error] 13-13: Avoid passing children using a prop
The canonical way to pass children in React is to use JSX elements
(lint/correctness/noChildrenProp)
[error] 26-34: 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] 35-45: 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)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js
[error] 120-120: 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] 125-125: 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] 126-140: 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] 141-154: 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] 155-164: 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] 158-158: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 89-89: This code is unreachable
... because this statement will return from the function beforehand
(lint/correctness/noUnreachable)
[error] 93-118: This code is unreachable
... because this statement will return from the function beforehand
(lint/correctness/noUnreachable)
[error] 123-123: This code is unreachable
... because this statement will return from the function beforehand
(lint/correctness/noUnreachable)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/Boundary.js
[error] 108-108: 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/pages/employee/GeoPode.js
[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)
[error] 158-158: 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] 198-198: 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] 204-204: 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] 268-268: 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] 272-272: 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] 290-290: 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] 296-296: 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] 33-33: This let declares a variable that is only assigned once.
'receivedData' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 154-154: 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] 184-184: 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] 227-235: 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] 236-245: 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] 276-276: 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] 318-326: 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] 327-336: 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)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewHierarchy.js
[error] 111-111: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 186-186: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 188-188: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 218-218: 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] 230-230: 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] 257-257: 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] 277-277: 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] 362-362: 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] 140-140: This let declares a variable that is only assigned once.
'file' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 141-141: This let declares a variable that is only assigned once.
'fileDataTemp' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 146-146: This let declares a variable that is only assigned once.
'fileStoreIdTemp' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 328-337: 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] 338-347: 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] 366-375: 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] 376-385: 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 (12)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/BoundaryPopup.js (3)
1-6
: LGTM: Imports and component declaration are well-structured.The imports are appropriate, and the component declaration follows React best practices. The use of destructured props improves readability.
55-55
: LGTM: Proper component export.The component is correctly exported as the default export, which is a standard practice for React components.
1-55
: Overall, well-implemented component with minor suggestions for improvement.The
BoundaryPopup
component is well-structured and follows React best practices. It makes good use of the UI component library, internationalization, and conditional rendering. The main points for improvement are:
- Remove the unnecessary empty
children
prop from the PopUp component.- Consider using responsive styling for the PopUp and buttons instead of fixed dimensions.
- Ensure proper error handling and user feedback for the
callGeoPode
function (not visible in this file, but important for the component's functionality).These changes will enhance the component's responsiveness and maintainability.
🧰 Tools
🪛 Biome
[error] 13-13: Avoid passing children using a prop
The canonical way to pass children in React is to use JSX elements
(lint/correctness/noChildrenProp)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/FinalPopup.js (3)
1-6
: LGTM: Imports and component declaration are well-structured.The imports are appropriate for the component's needs, and the component declaration follows React best practices with proper prop destructuring.
8-24
: LGTM: PopUp component usage is correct and well-structured.The PopUp component is conditionally rendered and configured properly with appropriate props for styling and event handling. The
children
prop usage here is specific to the PopUp component and doesn't represent a misuse of React's children prop.Regarding the static analysis hint about the
children
prop: This is a false positive. Thechildren
prop here is specific to the PopUp component's API and is used correctly.Also applies to: 47-53
🧰 Tools
🪛 Biome
[error] 13-13: Avoid passing children using a prop
The canonical way to pass children in React is to use JSX elements
(lint/correctness/noChildrenProp)
1-58
: LGTM: Overall component structure and export are well-implemented.The FinalPopup component is logically structured and follows React best practices. The default export is appropriate for this single-component file.
🧰 Tools
🪛 Biome
[error] 13-13: Avoid passing children using a prop
The canonical way to pass children in React is to use JSX elements
(lint/correctness/noChildrenProp)
[error] 26-34: 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] 35-45: 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)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/boundarySearchConfig.js (4)
27-27
: ConfirmminParametersForSearchForm
value.The
minParametersForSearchForm
is set to0
, which allows searches without any parameters. Is this the intended behavior? If not, consider setting an appropriate minimum number of required fields to prevent empty searches.
41-49
: Ensure proper field configuration for "HIERARCHY_NAME".The field
HIERARCHY_NAME
has the key"Name"
and populators withname: "Name"
andoptionsKey: "code"
. Please confirm that these configurations correctly correspond to the data model and that the keys match the expected request parameters.
28-30
: Possible inconsistency in JSON paths configuration.The properties
tableFormJsonPath
,filterFormJsonPath
, andsearchFormJsonPath
are set to"requestParam"
and"requestBody"
. Ensure that these paths correctly reflect the structure of your request configuration and are used appropriately within your application.
72-90
:⚠️ Potential issueInconsistent property name and possible mismatches in
jsonpath
.
The property name
jsonPath
in line 88 is inconsistently capitalized compared to other columns usingjsonpath
. To maintain consistency, consider renamingjsonPath
tojsonpath
.The "LEVELS" column uses
jsonpath: "auditDetails.createdBy"
. IscreatedBy
the appropriate field for displaying "LEVELS"? Typically,createdBy
contains information about who created the entry rather than its hierarchical levels. Please verify that thejsonpath
values correctly correspond to the intended data fields.health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/GeoPode.js (1)
270-270
: Ensure translation key "MSG" existsThe translation key
MSG
used with thet
function might not exist, which could lead to displaying the key itself instead of the intended message.Please verify that the translation key
MSG
is defined in your localization files. Run the following script to search for the key in your localization files:health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js (1)
170-170
: 🧹 Nitpick (assertive)Update the button icon to match the action
The
DOWNLOAD
button uses the"Add"
icon at line 170, which might be misleading. Consider using an icon that represents downloading to enhance user experience.Apply this diff:
< Button type={"button"} size={"medium"} - icon={"Add"} + icon={"Download"} variation={"secondary"} label={t("DOWNLOAD")} onClick={()=>{ downloadExcelTemplate(); }} />Likely invalid or redundant comment.
showPopUp && ( | ||
<PopUp | ||
className={"custom-popup-boundary"} | ||
type={"default"} | ||
heading={t("CHOOSE_MEANS_TO_CREATE_BOUNDARY")} | ||
children={[ | ||
]} | ||
onClose={()=>{ | ||
setShowPopUp(false); | ||
}} | ||
style={{ | ||
height:"11rem", | ||
width: "48rem" | ||
}} | ||
footerChildren={[ | ||
]} | ||
sortFooterChildren={true} | ||
> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Remove unnecessary children prop and consider responsive styling.
The PopUp component structure is generally good, but there are two areas for improvement:
- The
children
prop is empty and unnecessary. Remove it to address the static analysis warning. - The
style
prop uses fixed dimensions, which might not be responsive on different screen sizes.
Consider applying these changes:
- Remove the empty children prop:
- children={[
- ]}
- Replace fixed dimensions with responsive units:
style={{
- height:"11rem",
- width: "48rem"
+ height: "auto",
+ width: "90%",
+ maxWidth: "48rem"
}}
This will make the popup more adaptable to different screen sizes while maintaining a maximum width.
📝 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.
showPopUp && ( | |
<PopUp | |
className={"custom-popup-boundary"} | |
type={"default"} | |
heading={t("CHOOSE_MEANS_TO_CREATE_BOUNDARY")} | |
children={[ | |
]} | |
onClose={()=>{ | |
setShowPopUp(false); | |
}} | |
style={{ | |
height:"11rem", | |
width: "48rem" | |
}} | |
footerChildren={[ | |
]} | |
sortFooterChildren={true} | |
> | |
showPopUp && ( | |
<PopUp | |
className={"custom-popup-boundary"} | |
type={"default"} | |
heading={t("CHOOSE_MEANS_TO_CREATE_BOUNDARY")} | |
onClose={()=>{ | |
setShowPopUp(false); | |
}} | |
style={{ | |
height: "auto", | |
width: "90%", | |
maxWidth: "48rem" | |
}} | |
footerChildren={[ | |
]} | |
sortFooterChildren={true} | |
> |
🧰 Tools
🪛 Biome
[error] 13-13: Avoid passing children using a prop
The canonical way to pass children in React is to use JSX elements
(lint/correctness/noChildrenProp)
<div style={{display:"flex", gap:"1rem", justifyContent:"space-around"}}> | ||
<Button | ||
type={"button"} | ||
size={"large"} | ||
isDisabled={!geoPodeData} | ||
variation={"secondary"} | ||
label={t("GET_BOUNDARY_DATA_FROM_GEOPODE")} | ||
onClick={() => { | ||
callGeoPode(false); | ||
}} | ||
style={{height:"4rem"}} | ||
/> | ||
<Button | ||
type={"button"} | ||
size={"large"} | ||
variation={"secondary"} | ||
label={t("CREATE_MY_OWN_BOUNDARY_DATA")} | ||
onClick={() => { | ||
callGeoPode(true); | ||
}} | ||
style={{height:"4rem"}} | ||
/> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Good use of internationalization and conditional disabling, but consider removing fixed button heights.
The button container and buttons are well-implemented with good practices:
- Proper use of internationalization for button labels.
- Conditional disabling of the first button based on
geoPodeData
. - Good use of flexbox for layout.
However, the fixed height on buttons might not be necessary and could potentially cause issues on different devices or with different text lengths.
Consider removing the fixed height from both buttons:
- style={{height:"4rem"}}
This will allow the buttons to adapt to their content and maintain consistency with the UI library's default styling.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
<div style={{display:"flex", gap:"1rem", justifyContent:"space-around"}}> | |
<Button | |
type={"button"} | |
size={"large"} | |
isDisabled={!geoPodeData} | |
variation={"secondary"} | |
label={t("GET_BOUNDARY_DATA_FROM_GEOPODE")} | |
onClick={() => { | |
callGeoPode(false); | |
}} | |
style={{height:"4rem"}} | |
/> | |
<Button | |
type={"button"} | |
size={"large"} | |
variation={"secondary"} | |
label={t("CREATE_MY_OWN_BOUNDARY_DATA")} | |
onClick={() => { | |
callGeoPode(true); | |
}} | |
style={{height:"4rem"}} | |
/> | |
</div> | |
<div style={{display:"flex", gap:"1rem", justifyContent:"space-around"}}> | |
<Button | |
type={"button"} | |
size={"large"} | |
isDisabled={!geoPodeData} | |
variation={"secondary"} | |
label={t("GET_BOUNDARY_DATA_FROM_GEOPODE")} | |
onClick={() => { | |
callGeoPode(false); | |
}} | |
/> | |
<Button | |
type={"button"} | |
size={"large"} | |
variation={"secondary"} | |
label={t("CREATE_MY_OWN_BOUNDARY_DATA")} | |
onClick={() => { | |
callGeoPode(true); | |
}} | |
/> | |
</div> |
footerChildren={[ | ||
<Button | ||
type={"button"} | ||
size={"large"} | ||
variation={"secondary"} | ||
label={t("CANCEL")} | ||
onClick={() => { | ||
setShowFinalPopup(false); | ||
}} | ||
/>, | ||
<Button | ||
type={"button"} | ||
size={"large"} | ||
variation={"primary"} | ||
label={t("CREATE")} | ||
onClick={() => { | ||
addParents(); | ||
createNewHierarchy(); | ||
setShowFinalPopup(false); | ||
}} | ||
/> | ||
]} |
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 key props to Button components in footerChildren array.
While the buttons are implemented correctly, they're missing key
props. Since these buttons are part of an array passed to footerChildren
, each should have a unique key
prop to help React efficiently update the DOM.
Apply this change to both Button components:
<Button
+ key="cancel-button"
type={"button"}
size={"large"}
variation={"secondary"}
label={t("CANCEL")}
onClick={() => {
setShowFinalPopup(false);
}}
/>
<Button
+ key="create-button"
type={"button"}
size={"large"}
variation={"primary"}
label={t("CREATE")}
onClick={() => {
addParents();
createNewHierarchy();
setShowFinalPopup(false);
}}
/>
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
footerChildren={[ | |
<Button | |
type={"button"} | |
size={"large"} | |
variation={"secondary"} | |
label={t("CANCEL")} | |
onClick={() => { | |
setShowFinalPopup(false); | |
}} | |
/>, | |
<Button | |
type={"button"} | |
size={"large"} | |
variation={"primary"} | |
label={t("CREATE")} | |
onClick={() => { | |
addParents(); | |
createNewHierarchy(); | |
setShowFinalPopup(false); | |
}} | |
/> | |
]} | |
footerChildren={[ | |
<Button | |
key="cancel-button" | |
type={"button"} | |
size={"large"} | |
variation={"secondary"} | |
label={t("CANCEL")} | |
onClick={() => { | |
setShowFinalPopup(false); | |
}} | |
/>, | |
<Button | |
key="create-button" | |
type={"button"} | |
size={"large"} | |
variation={"primary"} | |
label={t("CREATE")} | |
onClick={() => { | |
addParents(); | |
createNewHierarchy(); | |
setShowFinalPopup(false); | |
}} | |
/> | |
]} |
🧰 Tools
🪛 Biome
[error] 26-34: 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] 35-45: 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)
const tenantId = Digit.ULBService.getCurrentTenantId(); | ||
export const boundarySearchConfig = [ | ||
{ | ||
// label: "Search", |
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 removing unnecessary commented-out code.
The line // label: "Search",
is commented out. If this code is no longer needed, consider removing it to keep the code clean and maintainable.
masterName: "commonUiConfig", | ||
moduleName: "MyBoundarySearchConfig", |
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.
Verify the masterName
and moduleName
values.
The masterName
is set to "commonUiConfig"
, and the moduleName
is set to "MyBoundarySearchConfig"
. Please verify if these values are correct and necessary. If they are not used elsewhere, consider updating or removing them to simplify the configuration.
const fun = async ()=>{ | ||
res = await callSearch(); | ||
} | ||
// fun(); |
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 unused function or ensure it's called
The function fun
defined at lines 82-84 is commented out at line 85 and is not being called. If this function is no longer needed, consider removing it. If it's required, ensure it's called appropriately.
Apply this diff to remove the unused function:
- const fun = async () => {
- res = await callSearch();
- };
- // fun();
Or, if it should be called, uncomment the function call:
// Ensure the function is called if needed
- // fun();
+ fun();
Committable suggestion was skipped due to low confidence.
switch (key) { | ||
case "HIERARCHY_NAME": | ||
return row?.hierarchyType; | ||
break; |
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 unreachable 'break' statement after 'return'
The break
statement at line 89 is unreachable because the return
statement before it exits the function. Removing the break
statement cleans up the code.
Apply this diff:
case "HIERARCHY_NAME":
return row?.hierarchyType;
- break;
📝 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.
break; |
🧰 Tools
🪛 Biome
[error] 89-89: This code is unreachable
... because this statement will return from the function beforehand
(lint/correctness/noUnreachable)
let epoch = row?.auditDetails?.createdTime; | ||
return Digit.DateUtils.ConvertEpochToDate(epoch); | ||
// return row?.auditDetails?.createdTime; | ||
break; |
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 unreachable 'break' statement after 'return'
The break
statement at line 123 is unreachable due to the preceding return
statement. Removing it will clean up the code.
Apply this diff:
case "CREATION_DATE":
let epoch = row?.auditDetails?.createdTime;
return Digit.DateUtils.ConvertEpochToDate(epoch);
// return row?.auditDetails?.createdTime;
- break;
📝 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.
break; | |
case "CREATION_DATE": | |
let epoch = row?.auditDetails?.createdTime; | |
return Digit.DateUtils.ConvertEpochToDate(epoch); | |
// return row?.auditDetails?.createdTime; |
🧰 Tools
🪛 Biome
[error] 123-123: This code is unreachable
... because this statement will return from the function beforehand
(lint/correctness/noUnreachable)
const tenantId = Digit.ULBService.getCurrentTenantId(); | ||
const generateFile = async()=>{ | ||
const res = await Digit.CustomService.getResponse({ | ||
url: `/project-factory/v1/data/_generate`, | ||
body: { | ||
}, | ||
params: { | ||
tenantId: tenantId, | ||
type: "boundaryManagement", | ||
forceUpdate: true, | ||
hierarchyType: row?.hierarchyType, | ||
campaignId: "default" | ||
} | ||
}); | ||
return res; | ||
} | ||
const generateTemplate = async() => { | ||
const res = await Digit.CustomService.getResponse({ | ||
url: `/project-factory/v1/data/_download`, | ||
body: { | ||
}, | ||
params: { | ||
tenantId: tenantId , | ||
type: "boundaryManagement", | ||
hierarchyType: row?.hierarchyType, | ||
campaignId: "default" | ||
} | ||
}); | ||
return res; | ||
} | ||
const downloadExcelTemplate = async() => { | ||
const res = await generateFile(); | ||
const resFile = await generateTemplate(); | ||
if (resFile && resFile?.GeneratedResource?.[0]?.fileStoreid) { | ||
// Splitting filename before .xlsx or .xls | ||
const fileNameWithoutExtension = row?.hierarchyType ; | ||
|
||
Digit.Utils.campaign.downloadExcelWithCustomName({ fileStoreId: resFile?.GeneratedResource?.[0]?.fileStoreid, customName: fileNameWithoutExtension }); | ||
} | ||
} |
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.
Wrap 'case' blocks in braces to restrict variable scope
Variables declared within case
blocks without braces are hoisted to the switch scope, which can cause unexpected behavior if cases share variable names. To properly scope variables like tenantId
, generateFile
, generateTemplate
, and downloadExcelTemplate
, wrap the case "ACTION":
block in braces.
Apply this diff to wrap the case block:
case "ACTION":
+ {
const tenantId = Digit.ULBService.getCurrentTenantId();
const generateFile = async () => {
// function body
};
const generateTemplate = async () => {
// function body
};
const downloadExcelTemplate = async () => {
// function body
};
return (
// JSX code
);
+ }
Committable suggestion was skipped due to low confidence.
🧰 Tools
🪛 Biome
[error] 125-125: 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] 126-140: 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] 141-154: 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] 155-164: 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] 158-158: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
return row?.boundaryHierarchy?.length | ||
|
||
return ( | ||
( | ||
<> | ||
{/* <span data-tip data-for="dynamicTooltip">{row?.boundaryHierarchy?.length}</span> | ||
<ReactTooltip id="dynamicTooltip" getContent={() => tooltipContent} /> */} | ||
<TooltipWrapper | ||
arrow={false} | ||
content={res} | ||
enterDelay={100} | ||
leaveDelay={0} | ||
placement="bottom" | ||
style={{}} | ||
> | ||
{row?.boundaryHierarchy?.length} | ||
</TooltipWrapper> | ||
{/* <Tooltip | ||
className="" | ||
content="Tooltipkbjkjnjknk" | ||
description="" | ||
header="" | ||
style={{}} | ||
/> */} | ||
</> | ||
) | ||
) | ||
break; |
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 unreachable code after 'return' statement
In the case "LEVELS":
block, the code after the return
statement at line 91 is unreachable and will never execute. This unreachable code should be removed to clean up the codebase.
Apply this diff to remove the unreachable code:
case "LEVELS":
return row?.boundaryHierarchy?.length;
-
- return (
- (
- <>
- {/* Tooltip or additional JSX code */}
- </>
- )
- )
break;
Committable suggestion was skipped due to low confidence.
🧰 Tools
🪛 Biome
[error] 93-118: This code is unreachable
... because this statement will return from the function beforehand
(lint/correctness/noUnreachable)
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)
- health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/downloadTemplate.js (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/downloadTemplate.js (1)
Pattern
**/*.js
: check
🪛 Biome
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/downloadTemplate.js
[error] 49-49: This let declares a variable that is only assigned once.
'child' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 55-55: This let declares a variable that is only assigned once.
'allDatas' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 162-162: Use Number.parseInt instead of the equivalent global.
ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.parseInt instead.(lint/style/useNumberNamespace)
[error] 292-292: This let declares a variable that is only assigned once.
'messages' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 302-302: This let declares a variable that is only assigned once.
'hierarchy' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 314-314: This let declares a variable that is only assigned once.
'localisedArray' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 320-320: This let declares a variable that is only assigned once.
'localisedData' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 329-329: This let declares a variable that is only assigned once.
'expectedName' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
const addParents = ()=>{ | ||
setNewBoundaryData((prevItems) => { | ||
// Loop through the array starting from the second element | ||
return prevItems.map((item, idx) => { | ||
if(idx===0) | ||
{ | ||
if(boundaryData.length===0) item.parentBoundaryType=null; | ||
else item.parentBoundaryType = boundaryData[boundaryData.length-1].boundaryType; | ||
} | ||
if (idx > 0) { | ||
// Set the parent name to the previous element's name | ||
item.parentBoundaryType = prevItems[idx - 1].boundaryType; | ||
} | ||
return item; // Return the updated item | ||
}); | ||
}); | ||
|
||
} | ||
|
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.
Undefined variables 'setNewBoundaryData' and 'boundaryData'
The function addParents
uses setNewBoundaryData
and boundaryData
, which are not defined within the scope of this file. This will result in ReferenceError
s at runtime.
To resolve this issue, ensure that setNewBoundaryData
and boundaryData
are properly defined or imported before they are used in this function.
let request | ||
// const locale = getLocaleFromRequest(request); | ||
// Extract msgId from request body | ||
const msgId = request?.body?.RequestInfo?.msgId; | ||
// Split msgId by '|' delimiter and get the second part (index 1) | ||
// If splitting fails or no second part is found, use default locale from config | ||
// locale = msgId.split("|")?.[1] || "en_MZ"; | ||
locale = "en_MZ"; | ||
|
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.
Variable 'request' is declared but not initialized
In the downloadExcelTemplate
function, the variable request
is declared but never assigned a value before being used to access request.body.RequestInfo.msgId
. This will result in TypeError
due to accessing properties of undefined
.
Consider initializing request
with the required value or removing its usage if it's unnecessary. If request
is intended to come from props or context, ensure it is correctly passed to the function.
* Feature/boundary ss (#1490) * boundary-hierarchy * boundary-hierarchy * localization changes * ui changes * Update health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignCard.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * pr review changes * removed all logs --------- Co-authored-by: suryansh-egov <suryansh.singh.egovernments.org> Co-authored-by: Jagankumar <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * checklist-bugs-fixes (#1513) * checklist-bugs-fixes * cahgnes --------- Co-authored-by: suryansh-egov <suryansh.singh.egovernments.org> * changesnew --------- Co-authored-by: suryansh-egov <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: suryansh-egov <suryansh.singh.egovernments.org>
Summary by CodeRabbit
Release Notes
New Features
Boundary
,GeoPode
,ViewBoundary
, andViewHierarchy
.Enhancements
Bug Fixes