Skip to content

added solution#3563

Open
y-ivsnko wants to merge 2 commits intomate-academy:masterfrom
y-ivsnko:develop
Open

added solution#3563
y-ivsnko wants to merge 2 commits intomate-academy:masterfrom
y-ivsnko:develop

Conversation

@y-ivsnko
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.

Review Summary

Great work on implementing the core functionality! The form submission and validation logic are working correctly. However, one change is required to align with the project's coding standards. In src/App.tsx, you've used a one-letter variable e for event handlers, which violates our checklist rule about descriptive variable naming [CHECKLIST ITEM #1]. Please rename it to something more descriptive, like event.

I also noticed a couple of minor things you could clean up:

  • Remove the large block of commented-out code in src/components/UserInfo/UserInfo.tsx.
  • Remove the redundant key prop from the <article> element inside src/components/TodoInfo/TodoInfo.tsx.

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

Important

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

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

src/App.tsx Outdated
placeholder="Enter a title"
data-cy="titleInput"
value={title}
onChange={e => {

Choose a reason for hiding this comment

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

This violates checklist item #1: "Don't use one-letter variable naming." Please use a more descriptive name for the event object, such as event or changeEvent.

src/App.tsx Outdated
id="userId"
data-cy="userSelect"
value={selectedUserId}
onChange={e => {

Choose a reason for hiding this comment

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

This violates checklist item #1: "Don't use one-letter variable naming." Please use a more descriptive name for the event object, like event.

Comment on lines +12 to +37
// <div className="field">
// <label htmlFor="user">User: </label>

// <select
// id="user"
// name="user"
// data-cy="userSelect"
// defaultValue={user}
// onChange={event => {
// setUser(+event.target.value);
// isError = false;
// }}
// >
// <option value={0} disabled>
// Choose a user
// </option>

// {usersFromServes.map(person => (
// <option value={person.id + 1} key={person.id}>
// {person.name}
// </option>
// ))}
// </select>

// {isError && <span className="error">Please choose a user</span>}
// </div>

Choose a reason for hiding this comment

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

This large block of commented-out code should be removed. It's not used and makes the component harder to read.

className={classNames('TodoInfo', {
'TodoInfo--completed': todo.completed,
})}
key={todo.id}

Choose a reason for hiding this comment

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

The key prop is used by React to identify which items have changed, are added, or are removed in a list. It should be applied to the component when it is rendered within a map function (as is correctly done in TodoList.tsx). Placing the key prop on an element inside the component itself is redundant and has no effect, as key is a special prop that is not passed down to the component's children.

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

Excellent work on this PR! You've successfully implemented all the core requirements and addressed the most important feedback from the last review. I am approving your solution.

I have two minor suggestions for you to consider for future improvements:

  • In src/App.tsx, there is a small typo where preson should be person.
  • In src/components/TodoInfo/TodoInfo.tsx, the key prop on the <article> element is redundant. Since the key is already correctly applied where you map over the components in TodoList.tsx, it's not needed inside TodoInfo itself.

These are just small cleanups, and the functionality is perfect. Great job!


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

Footnotes

  1. Rate AI review example

import { User } from './types/User';

function getUserById(userId: number): User {
const user = usersFromServer.find(preson => preson.id === userId);

Choose a reason for hiding this comment

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

This is a minor typo. It looks like preson should be person for better clarity.

className={classNames('TodoInfo', {
'TodoInfo--completed': todo.completed,
})}
key={todo.id}

Choose a reason for hiding this comment

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

This key prop is redundant. The key is already being correctly applied to the <TodoInfo /> component where it's mapped in the TodoList component. The key should be on the elements in the array, not on the root element inside the component itself.

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