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 #2674

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

solution #2674

wants to merge 1 commit into from

Conversation

YevhenRDoIT
Copy link

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 job on implementing the task requirements! 🎉 Your code meets all the necessary functionality and constraints, and you've done well in handling form validation, state management, and component structure. Keep up the excellent work, and continue refining your skills! 😊

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

export const App = () => {
// write code
export const App: React.FC = () => {
const [movies, setMovies] = useState(moviesFromServer);

Choose a reason for hiding this comment

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

Ensure that moviesFromServer is correctly imported and contains the expected data structure. It should be an array of movie objects matching the structure used in handleAddMovie.

return (
<div className="page">
<div className="page-content">
<MoviesList movies={moviesFromServer} />
<MoviesList movies={movies} />

Choose a reason for hiding this comment

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

Verify that the MoviesList component is implemented to correctly receive and display the movies prop. It should be able to handle an array of movie objects.

</div>
<div className="sidebar">
<NewMovie /* onAdd={(movie) => {}} */ />
<NewMovie onAdd={handleAddMovie} />

Choose a reason for hiding this comment

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

Ensure that the NewMovie component is implemented to correctly call the onAdd prop function with a new movie object. The object should match the structure expected by handleAddMovie.

// Increase the count after successful form submission
// to reset touched status of all the `Field`s
const [count] = useState(0);
const urlPattern =

Choose a reason for hiding this comment

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

Ensure that the urlPattern is correctly defined to match valid URLs. It should be comprehensive enough to cover the expected URL formats for imgUrl and imdbUrl.

onChange={value => handleInputChange('imgUrl', value)}
onBlur={() => handleBlur('imgUrl')}
required
validationCallback={value => urlPattern.test(value)}

Choose a reason for hiding this comment

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

Verify that the TextField component correctly utilizes the validationCallback prop to validate the input value. It should provide feedback based on the result of the validation.

@@ -8,6 +8,7 @@ type Props = {
placeholder?: string;
required?: boolean;
onChange?: (newValue: string) => void;
validationCallback?: (value: string) => boolean; // for custom validation

Choose a reason for hiding this comment

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

Ensure that the validationCallback function is correctly passed from the parent component and that it performs the necessary validation logic for the input value.


// Check if the field has an error
const hasError =
touched && ((required && !value.trim()) || !validationCallback(value));

Choose a reason for hiding this comment

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

The hasError logic correctly checks if the field is required and if the custom validation fails. Ensure that the error message is appropriate for the validation being performed.

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