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

solution :) #2784

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

solution :) #2784

wants to merge 2 commits into from

Conversation

Artemida1609
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 project! There are a couple of critical issues that need to be addressed before we can approve the pull request. The onChange handler in the NewMovie.tsx component is incorrectly using event.valueOf() instead of event.target.value, which could lead to improper form functionality. Additionally, the URL validation logic in the TextField.tsx component needs correction to ensure accurate error message display. Once these issues are resolved, your code will be in great shape! Keep up the great work! 😊

✨ 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 49 to 50
onChange={event => {
setTitleValue(event.valueOf());

Choose a reason for hiding this comment

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

The onChange handler is using event.valueOf() which is incorrect. You should use event.target.value to get the value from the input field.

name="description"
label="Description"
value={descriptionValue}
onChange={event => setDescriptionValue(event.valueOf())}

Choose a reason for hiding this comment

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

The onChange handler is using event.valueOf() which is incorrect. You should use event.target.value to get the value from the input field.

Comment on lines 67 to 68
onChange={event => {
setImgUrlValue(event.valueOf());

Choose a reason for hiding this comment

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

The onChange handler is using event.valueOf() which is incorrect. You should use event.target.value to get the value from the input field.

Comment on lines 77 to 78
onChange={event => {
setImdbUrlValue(event.valueOf());

Choose a reason for hiding this comment

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

The onChange handler is using event.valueOf() which is incorrect. You should use event.target.value to get the value from the input field.

Comment on lines 87 to 88
onChange={event => {
setImdbIdValue(event.valueOf());

Choose a reason for hiding this comment

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

The onChange handler is using event.valueOf() which is incorrect. You should use event.target.value to get the value from the input field.

Comment on lines 42 to 43
const isUrlError = isUrlField && isValidUrl(value);
const hasUrlError = isUrlField && value !== '' && isUrlError;

Choose a reason for hiding this comment

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

The logic for isUrlError is incorrect. It should be !isValidUrl(value) to correctly identify when the URL is invalid. This affects the hasUrlError condition and subsequently the error message display.

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.

Review Summary

Great job on addressing the issues from the previous review! 🎉 Your implementation of the App.tsx and NewMovie.tsx components aligns well with the task requirements. Here are some key points and suggestions for further improvement:

  1. NewMovie.tsx Component:

    • You've successfully corrected the onChange handler to use event.target.value, ensuring that input values are captured correctly. This is crucial for the form's functionality.
  2. TextField.tsx Component:

    • While the URL validation logic is implemented, the regular expression might not cover all valid URL formats. Consider using a more comprehensive regex or a library like validator.js for more accurate validation. This will help prevent incorrect error messages.

Overall, your code meets the task requirements, and you've resolved previous issues effectively. Keep in mind the importance of accurate validation logic, as it plays a critical role in user experience. Moving forward, continue to refine your skills and learn from these experiences. Keep up the great work! 🚀

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

value=""
onChange={() => {}}
value={titleValue}
onChange={newValue => setTitleValue(newValue)}

Choose a reason for hiding this comment

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

The onChange handler should use event.target.value instead of newValue. This ensures that the input value is correctly captured from the event object.

name="description"
label="Description"
value={descriptionValue}
onChange={newValue => setDescriptionValue(newValue)}

Choose a reason for hiding this comment

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

The onChange handler should use event.target.value instead of newValue. This ensures that the input value is correctly captured from the event object.

label="Image URL"
value={imgUrlValue}
required
onChange={newValue => setImgUrlValue(newValue)}

Choose a reason for hiding this comment

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

The onChange handler should use event.target.value instead of newValue. This ensures that the input value is correctly captured from the event object.

label="Imdb URL"
value={imdbUrlValue}
required
onChange={newValue => setImdbUrlValue(newValue)}

Choose a reason for hiding this comment

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

The onChange handler should use event.target.value instead of newValue. This ensures that the input value is correctly captured from the event object.

label="Imdb ID"
value={imdbIdValue}
required
onChange={newValue => setImdbIdValue(newValue)}

Choose a reason for hiding this comment

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

The onChange handler should use event.target.value instead of newValue. This ensures that the input value is correctly captured from the event object.

Comment on lines +17 to +27
function isValidUrl(url: string) {
const pattern = new RegExp(
'^(https?:\\/\\/)?' +
'((([a-zA-Z0-9$-_@.&+!*\\(\\),]+)\\.)+' +
'[a-zA-Z]{2,})' +
'(\\/[a-zA-Z0-9$-_@.&+!*\\(\\),]*)*$',
'i',
);

return pattern.test(url);
}

Choose a reason for hiding this comment

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

The URL validation regex might not cover all valid URL formats. Consider using a more comprehensive regex or a library like validator.js for more accurate URL validation.

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