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

Develop #848

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

Conversation

ivannaromanovych
Copy link

Copy link

@roman-mirzoian roman-mirzoian left a comment

Choose a reason for hiding this comment

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

Good work, but some comments on the code and the application itself:

  1. If we try to create a todo with an empty name, we will see an error, but after that the input becomes inactive and we will not be able to add anything new, only after reloading the page:
    https://gyazo.com/bc0b7e5aaf5f416faa31f3a517b631d1
  2. If we exit the edit mode using the Escape key, the new name will not be saved, but the next time we enter the edit mode, we will see the next state from the previous entry into the edit mode:
    https://gyazo.com/1f59971ebddccd3694d2814a556551d0

src/App.tsx Outdated
Comment on lines 1 to 2
/* eslint-disable max-len */
/* eslint-disable jsx-a11y/control-has-associated-label */

Choose a reason for hiding this comment

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

Try to rewrite the code so that it is not necessary to disable the linter

src/App.tsx Outdated
completed: false,
});

// eslint-disable-next-line consistent-return

Choose a reason for hiding this comment

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

Try to rewrite the code so that it is not necessary to disable the linter

src/App.tsx Outdated
Comment on lines 154 to 156
todos
.filter(todo => todo.completed)
.forEach(todo => handleTodoDelete(todo.id));

Choose a reason for hiding this comment

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

No need to do extra filtering, this condition can be transferred to the middle of the forEach method

src/App.tsx Outdated
Comment on lines 163 to 165
todos
.filter(todo => !todo.completed)
.forEach(handleTodoToggle);

Choose a reason for hiding this comment

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

The same about extra filtering.

src/App.tsx Outdated
Comment on lines 160 to 163
if (isEveryCompleted) {
todos.forEach(handleTodoToggle);
} else {
todos

Choose a reason for hiding this comment

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

Suggested change
if (isEveryCompleted) {
todos.forEach(handleTodoToggle);
} else {
todos
if (isEveryCompleted) {
return todos.forEach(handleTodoToggle);
}
todos

src/App.tsx Outdated
{todos.length > 0 && (
<footer className="todoapp__footer" data-cy="Footer">
<span className="todo-count" data-cy="TodosCounter">
{`${activeTodosCounter} items left`}

Choose a reason for hiding this comment

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

If there is one item, there should not be a plural in the text.

@@ -0,0 +1,81 @@
/* eslint-disable jsx-a11y/control-has-associated-label */

Choose a reason for hiding this comment

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

Try to rewrite the code so that it is not necessary to disable the linter

.then(() => {
setTodoTitle('');
})
.finally(() => {

Choose a reason for hiding this comment

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

Add a catch block.

Comment on lines 40 to 42
if (todoTitle.trim()) {
if (todoTitle.trim() !== todo.title) {
onTodoRename(todoTitle.trim());

Choose a reason for hiding this comment

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

You call todoTitle.trim() three times - you should put it in a separate variable.

</button>
</>
)}
{/* overlay will cover the todo while it is being updated */}

Choose a reason for hiding this comment

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

Do not leave unnecessary comments.

Copy link

@roman-mirzoian roman-mirzoian left a comment

Choose a reason for hiding this comment

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

Well done 👍

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