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

solved #2738

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

solved #2738

wants to merge 2 commits into from

Conversation

NickDevX
Copy link

@NickDevX NickDevX commented Feb 1, 2025

Solved

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 core functionality and meeting the task requirements! 🎉 While there are a few minor improvements suggested, such as refining the URL validation and updating some onChange handlers for better consistency, these do not impact the overall functionality of your code. Keep up the good work, and consider these suggestions for future enhancements! 😊

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

src/App.tsx Outdated

export const App = () => {
const [movies, setMovie] = useState([...moviesFromServer]);

Choose a reason for hiding this comment

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

Consider renaming setMovie to setMovies to match the plural form of the movies state variable. This will improve code readability and maintain consistency in naming conventions.

value=""
onChange={() => {}}
value={title}
onChange={setTitle}

Choose a reason for hiding this comment

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

The onChange prop for TextField should be a function that takes an event and updates the state. Currently, setTitle is passed directly, which will not work as expected. Consider using an arrow function: onChange={(e) => setTitle(e.target.value)}.

name="description"
label="Description"
value={descr}
onChange={setDescr}

Choose a reason for hiding this comment

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

Similar to the previous comment, the onChange handler for description should be updated to: onChange={(e) => setDescr(e.target.value)}.

name="imgUrl"
label="Image URL"
value={img}
onChange={setImg}

Choose a reason for hiding this comment

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

The onChange handler for imgUrl should be updated to: onChange={(e) => setImg(e.target.value)}.

name="imdbUrl"
label="Imdb URL"
value={url}
onChange={setUrl}

Choose a reason for hiding this comment

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

The onChange handler for imdbUrl should be updated to: onChange={(e) => setUrl(e.target.value)}.

name="imdbId"
label="Imdb ID"
value={id}
onChange={setId}

Choose a reason for hiding this comment

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

The onChange handler for imdbId should be updated to: onChange={(e) => setId(e.target.value)}.

@@ -14,6 +14,9 @@
return Math.random().toFixed(16).slice(2);
}

const pattern =
/^((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www\.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w-_]*)?\??(?:[-+=&;%@,.\w_]*)#?(?:[,.!/\\\w]*))?)$/;

Choose a reason for hiding this comment

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

The URL validation pattern seems overly complex and might not cover all valid URL cases. Consider simplifying the regex or using a library for URL validation to ensure comprehensive coverage.

@@ -46,11 +50,23 @@
placeholder={placeholder}
value={value}
onChange={event => onChange(event.target.value)}

Choose a reason for hiding this comment

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

The onChange handler correctly updates the parent component's state with the new input value. Ensure that the parent component's onChange prop is correctly implemented to handle this value.

/>
</div>

{hasError && <p className="help is-danger">{`${label} is required`}</p>}
{validMessage && <p className="help is-danger">{`Not valid URL`}</p>}

Choose a reason for hiding this comment

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

The validation message 'Not valid URL' is hardcoded. Consider using the validMessage state variable to display the message, which allows for more flexibility and localization if needed.

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.

3 participants