-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Facility catchment Popup for unassign #1818
base: console
Are you sure you want to change the base?
Conversation
📝 Walkthrough📝 WalkthroughWalkthroughThe changes in Changes
Possibly related PRs
Suggested reviewers
Poem
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: 4
🧹 Outside diff range comments (1)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FacilityPopup.js (1)
Line range hint
284-331
: Refactor handler functions for better maintainabilityIssues found:
- Typo in function names ("Unsaasign" vs "Unassign")
- Use of
var
instead ofconst
handleAssignUnassign
only handles unassign case despite the name suggesting both operations- const handleUnsaasignTrue = async () => { + const handleUnassignConfirm = async () => { setLoader(true); - var newDetails = JSON.parse(JSON.stringify(details)); + const newDetails = JSON.parse(JSON.stringify(details)); // ... rest of the code } - const handleAssignUnassign = async () => { + const handleFacilityAction = async () => { setLoader(true); - var newDetails = JSON.parse(JSON.stringify(details)); + const newDetails = JSON.parse(JSON.stringify(details)); if (facilityAssignedStatus) { setConfirmUnasignPopup(true); // ... unassign logic + } else { + // ... assign logic should be here } setLoader(false); };Also applies to: 333-348
🧰 Tools
🪛 Biome
[error] 288-288: Use let or const instead of var.
A variable declared with var is accessible in the whole body of the function. Thus, the variable can be accessed before its initialization and outside the block where it is declared.
See MDN web docs for more details.
Unsafe fix: Use 'const' instead.(lint/style/noVar)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
📒 Files selected for processing (1)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FacilityPopup.js
(6 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FacilityPopup.js (1)
Pattern **/*.js
: check
🪛 Biome
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FacilityPopup.js
[error] 288-288: Use let or const instead of var.
A variable declared with var is accessible in the whole body of the function. Thus, the variable can be accessed before its initialization and outside the block where it is declared.
See MDN web docs for more details.
Unsafe fix: Use 'const' instead.
(lint/style/noVar)
[error] 337-337: Use let or const instead of var.
A variable declared with var is accessible in the whole body of the function. Thus, the variable can be accessed before its initialization and outside the block where it is declared.
See MDN web docs for more details.
Unsafe fix: Use 'const' instead.
(lint/style/noVar)
[error] 510-540: 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] 515-515: Avoid passing children using a prop
The canonical way to pass children in React is to use JSX elements
(lint/correctness/noChildrenProp)
[error] 516-516: 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] 524-533: 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] 534-534: 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)
...h/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FacilityPopup.js
Show resolved
Hide resolved
@@ -30,6 +30,7 @@ const FacilityPopUp = ({ details, onClose, updateDetails }) => { | |||
const [currentPage, setCurrentPage] = useState(1); | |||
const [rowsPerPage, setRowsPerPage] = useState(10); | |||
const [boundaryData, setBoundaryData] = useState([]); | |||
const [confirmUnasignPopup,setConfirmUnasignPopup]=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.
🛠️ Refactor suggestion
Fix state variable naming convention and typo
The state variable name should follow React naming conventions and correct spelling:
- Use camelCase
- Fix typo in "Unasign"
- const [confirmUnasignPopup,setConfirmUnasignPopup]=useState(false);
+ const [confirmUnassignPopup, setConfirmUnassignPopup] = useState(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.
const [confirmUnasignPopup,setConfirmUnasignPopup]=useState(false); | |
const [confirmUnassignPopup, setConfirmUnassignPopup] = 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.
@abishekTa-egov check for typos, if it is less time consuming.. can u fix the typos
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.
Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!
...h/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FacilityPopup.js
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Outside diff range comments (1)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FacilityPopup.js (1)
Line range hint
284-331
: Fix naming convention and use constThe function has a typo in its name and uses var instead of const.
-const handleUnsaasignTrue = async () => { +const handleUnassignConfirm = async () => { setLoader(true); - var newDetails = JSON.parse(JSON.stringify(details)); + const newDetails = JSON.parse(JSON.stringify(details));🧰 Tools
🪛 Biome
[error] 288-288: Use let or const instead of var.
A variable declared with var is accessible in the whole body of the function. Thus, the variable can be accessed before its initialization and outside the block where it is declared.
See MDN web docs for more details.
Unsafe fix: Use 'const' instead.(lint/style/noVar)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
📒 Files selected for processing (1)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FacilityPopup.js
(6 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FacilityPopup.js (1)
Pattern **/*.js
: check
🪛 Biome
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FacilityPopup.js
[error] 288-288: Use let or const instead of var.
A variable declared with var is accessible in the whole body of the function. Thus, the variable can be accessed before its initialization and outside the block where it is declared.
See MDN web docs for more details.
Unsafe fix: Use 'const' instead.
(lint/style/noVar)
[error] 337-337: Use let or const instead of var.
A variable declared with var is accessible in the whole body of the function. Thus, the variable can be accessed before its initialization and outside the block where it is declared.
See MDN web docs for more details.
Unsafe fix: Use 'const' instead.
(lint/style/noVar)
[error] 538-568: 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] 543-543: Avoid passing children using a prop
The canonical way to pass children in React is to use JSX elements
(lint/correctness/noChildrenProp)
[error] 544-544: 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] 552-561: 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] 562-562: 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 (3)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FacilityPopup.js (3)
217-262
: LGTM: Table columns implementation
The table columns implementation with accessibility improvements looks good. The cells are properly structured with title attributes and cursor styling for better user interaction.
278-282
: 🛠️ Refactor suggestion
Remove unnecessary function and return statement
The handleUnsaasignFalse
function can be simplified to an inline handler.
-const handleUnsaasignFalse = async () => {
- setConfirmUnasignPopup(false);
- return
-}
Update the button onClick to:
-onClick={handleUnsaasignFalse}
+onClick={() => setConfirmUnassignPopup(false)}
Likely invalid or redundant comment.
33-33
:
Fix state variable naming convention and typo
The state variable has a typo in "Unasign" and should follow React naming conventions.
-const [confirmUnasignPopup,setConfirmUnasignPopup]=useState(false);
+const [confirmUnassignPopup, setConfirmUnassignPopup] = useState(false);
Likely invalid or redundant comment.
Facility catchment Popup for unassign
Summary by CodeRabbit
New Features
Bug Fixes