-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
base: master
Are you sure you want to change the base?
solution :) #2784
Conversation
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.
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.
src/components/NewMovie/NewMovie.tsx
Outdated
onChange={event => { | ||
setTitleValue(event.valueOf()); |
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.
The onChange
handler is using event.valueOf()
which is incorrect. You should use event.target.value
to get the value from the input field.
src/components/NewMovie/NewMovie.tsx
Outdated
name="description" | ||
label="Description" | ||
value={descriptionValue} | ||
onChange={event => setDescriptionValue(event.valueOf())} |
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.
The onChange
handler is using event.valueOf()
which is incorrect. You should use event.target.value
to get the value from the input field.
src/components/NewMovie/NewMovie.tsx
Outdated
onChange={event => { | ||
setImgUrlValue(event.valueOf()); |
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.
The onChange
handler is using event.valueOf()
which is incorrect. You should use event.target.value
to get the value from the input field.
src/components/NewMovie/NewMovie.tsx
Outdated
onChange={event => { | ||
setImdbUrlValue(event.valueOf()); |
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.
The onChange
handler is using event.valueOf()
which is incorrect. You should use event.target.value
to get the value from the input field.
src/components/NewMovie/NewMovie.tsx
Outdated
onChange={event => { | ||
setImdbIdValue(event.valueOf()); |
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.
The onChange
handler is using event.valueOf()
which is incorrect. You should use event.target.value
to get the value from the input field.
const isUrlError = isUrlField && isValidUrl(value); | ||
const hasUrlError = isUrlField && value !== '' && isUrlError; |
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.
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.
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.
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:
-
NewMovie.tsx
Component:- You've successfully corrected the
onChange
handler to useevent.target.value
, ensuring that input values are captured correctly. This is crucial for the form's functionality.
- You've successfully corrected the
-
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.
- 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
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)} |
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.
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)} |
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.
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)} |
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.
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)} |
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.
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)} |
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.
The onChange
handler should use event.target.value
instead of newValue
. This ensures that the input value is correctly captured from the event object.
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); | ||
} |
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.
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.
No description provided.