-
Notifications
You must be signed in to change notification settings - Fork 215
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
Fixed #384 Added Close Icon on Add Restaurant Overlay #385
base: main
Are you sure you want to change the base?
Fixed #384 Added Close Icon on Add Restaurant Overlay #385
Conversation
WalkthroughThe recent update in the Enatega multivendor admin app enhances user experience by addressing a critical usability issue. It introduces a more intuitive way to close the Add Restaurant overlay, through both a newly added close button and improved background click behavior. This change ensures that users can securely close the overlay without inadvertently losing their input data, aligning with the request for a more user-friendly interface. Changes
Assessment against linked issues
Poem
🥕🎉 Recent Review DetailsConfiguration used: CodeRabbit UI Files selected for processing (1)
Files skipped from review as they are similar to previous changes (1)
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
✅ Deploy Preview for polite-fairy-234917 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for cheery-zabaione-34f12e ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (1)
- enatega-multivendor-admin/src/components/Restaurant/CreateRestaurant.jsx (6 hunks)
Additional Context Used
Additional comments not posted (3)
enatega-multivendor-admin/src/components/Restaurant/CreateRestaurant.jsx (3)
71-71
: The introduction of theisOpen
state variable is a good practice for managing the visibility of the component. However, it's initialized astrue
, which means the overlay will be open by default. Consider if this behavior aligns with the user experience you intend to provide. If the overlay should not be visible until triggered by a user action, initializingisOpen
asfalse
might be more appropriate.
253-259
: The implementation ofhandleClose
andhandleContainerClick
functions is clear and concise. However, it's important to ensure thathandleContainerClick
is correctly bound to a container element that represents the overlay's backdrop. This is to prevent the overlay from closing when interacting with its content directly. Please verify that theonClick
handler for the container is correctly set up to callhandleContainerClick
.Verification successful
The verification process has successfully confirmed that the
handleContainerClick
function is correctly bound to an element within theCreateRestaurant.jsx
file. Specifically, it is bound to a<Box>
component that likely serves as the container mentioned in the review comment. This aligns with the initial comment's concern about ensuring thathandleContainerClick
prevents the overlay from closing when interacting with its content directly.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that handleContainerClick is bound to the correct element rg "onClick={handleContainerClick}" src/components/Restaurant/CreateRestaurant.jsxLength of output: 206
Script:
#!/bin/bash # Correcting the regex pattern by escaping curly braces rg "onClick=\{handleContainerClick\}" src/components/Restaurant/CreateRestaurant.jsxLength of output: 173
Script:
#!/bin/bash # Search for CreateRestaurant.jsx in the entire repository to find its correct path fd CreateRestaurant.jsxLength of output: 98
Script:
#!/bin/bash # Verify that handleContainerClick is bound to the correct element using the correct file path rg "onClick=\{handleContainerClick\}" enatega-multivendor-admin/src/components/Restaurant/CreateRestaurant.jsxLength of output: 192
286-295
: > 📝 NOTEThis review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [278-291]
The use of
IconButton
withCloseIcon
for implementing the close button is well-integrated and follows best practices for using Material-UI components. This approach enhances the user interface's consistency and intuitiveness. However, ensure that theIconButton
's placement and styling are consistent with the overall design language of the application. Additionally, consider adding anaria-label
to theIconButton
for accessibility purposes, providing screen reader users with context about the button's function.- <IconButton onClick={handleClose}> + <IconButton onClick={handleClose} aria-label="Close">
enatega-multivendor-admin/src/components/Restaurant/CreateRestaurant.jsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (1)
- enatega-multivendor-admin/src/components/Restaurant/CreateRestaurant.jsx (8 hunks)
Files skipped from review as they are similar to previous changes (1)
- enatega-multivendor-admin/src/components/Restaurant/CreateRestaurant.jsx
Additional Context Used
enatega-multivendor-admin/src/components/Restaurant/CreateRestaurant.jsx
Outdated
Show resolved
Hide resolved
enatega-multivendor-admin/src/components/Restaurant/CreateRestaurant.jsx
Show resolved
Hide resolved
enatega-multivendor-admin/src/components/Restaurant/CreateRestaurant.jsx
Show resolved
Hide resolved
Hey @usama-sattar please have a check ! |
// const [shopType, setShopType] = useState(SHOP_TYPE.RESTAURANT) | ||
const [errors, setErrors] = useState('') | ||
const [success, setSuccess] = useState('') | ||
const [open, setOpen] = React.useState(true) | ||
|
||
const handleOpen = () => setOpen(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.
This function is not called anywhere in this component, you are setting state to false on close click, but what if user again wants to open a modal, will click from parent component opens the modal ? as local state of this component is already false.
In my previous change, I requested to update the parent state directly instead of creating new local state.
What this PR do ?
Fixed #384
"Add close functionality with IconButton in CreateRestaurant component
Summary by CodeRabbit