Skip to content
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

https://Pavlo-lab-max-Kopalko.github.io/react_movies-list-add-form/ #2747

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Pavlo-lab-max-Kopalko
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Thank you for your hard work on this pull request! 😊 While your implementation is on the right track, there are a few critical issues that need to be addressed to meet the task requirements fully:

  1. Form Submission Handling: The onSubmit handler should be placed on the <form> element, not the <button>. This ensures proper form submission handling and allows the form to be submitted using the Enter key.

  2. Prevent Default Behavior: The onSubmit function should include event.preventDefault() to prevent the default form submission behavior, allowing you to handle the form data as needed.

  3. Form Clearing: After a movie is added, the form should be cleared, and errors should not be shown. This logic is currently missing.

  4. Trimming Input Values: Ensure that spaces are trimmed from input values before enabling the submit button. This logic needs to be implemented.

Please address these issues to ensure the functionality aligns with the task requirements. Keep up the great work, and don't hesitate to reach out if you need any help! 🚀

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review button in the Reviewers tab.

Comment on lines 86 to 87
onClick={() => setCount(count + 1)}
onSubmit={() => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The onSubmit handler should be placed on the <form> element instead of the <button> element. This ensures that the form submission is handled correctly when the form is submitted.

Comment on lines 87 to 93
onSubmit={() => {
infoTitle.trim();
infoDescription.trim();
infoImageURL.trim();
infoImdbURL.trim();
infoImdbID.trim();
}}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The onSubmit function currently only trims the input values but does not prevent the default form submission behavior or handle the form data. Consider using event.preventDefault() to prevent the default form submission and then handle the form data as needed.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, the pull request review was unsuccessful for the following reasons:

Warning

No changes were made in the pull request since the last review. Please make sure that you have added files to the pull request and committed the changes.
[CODE: 7]

If the issue is within your control, please address it.
The next review attempt will automatically launch in 1 hour.
If you believe this is an error or need assistance, please contact the support team.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Great Work!

Your implementation is well on its way, and you've addressed many of the previous issues effectively. Here are some key points from the review:

  • Form Submission Handling: You've correctly placed the onSubmit handler on the <form> element in the NewMovie component, ensuring proper form submission handling.
  • Prevent Default Behavior: The inclusion of event.preventDefault() in the onSubmit function is a good practice to prevent default form submission behavior.
  • Form Clearing: The form is cleared after a movie is added by incrementing the count state, which is a clever way to reset the form.
  • Trimming Input Values: It's great to see that spaces are trimmed from input values before enabling the submit button.

🚀 Suggestions for Improvement:

  • Naming Consistency: Consider renaming handleChangeinfoDescription to handleChangeInfoDescription to maintain consistent camelCase naming.
  • Form Reset: While the form is cleared by changing the form's key, consider resetting the form fields directly after a movie is added to ensure clarity and maintainability.

Your code meets the task requirements, and the decision to approve is to help you move forward with your learning journey. Please review the comments to further enhance your code. Keep up the great work and continue improving! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

Comment on lines +45 to +55
const handleSubmit = () => {
const objMovie = {
title: infoTitle.trim(),
description: infoDescription.trim(),
imgUrl: infoImageURL.trim(),
imdbUrl: infoImdbURL.trim(),
imdbId: infoImdbID.trim(),
};

onAdd(objMovie);
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider resetting the form fields after a movie is added to ensure the form is cleared. This can be done by setting the state variables (infoTitle, infoDescription, etc.) back to their initial values.

Comment on lines +27 to +31
const handleChangeinfoDescription = (
event: React.ChangeEvent<HTMLInputElement>,
) => {
setInfoDescription(event.target.value);
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a minor inconsistency in the naming convention. Consider renaming handleChangeinfoDescription to handleChangeInfoDescription to maintain consistent camelCase naming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants