-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 #2563
base: master
Are you sure you want to change the base?
Develop #2563
Conversation
src/components/TodoList/TodoList.tsx
Outdated
{todos.map(todo => ( | ||
<tbody key={todo.id}> | ||
<tr |
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.
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.
.then(todosFromServer => { | ||
setTodos(todosFromServer); | ||
}) | ||
.then(() => { | ||
setLoader(false); | ||
}); |
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.
.then(todosFromServer => { | |
setTodos(todosFromServer); | |
}) | |
.then(() => { | |
setLoader(false); | |
}); | |
.then(setTodos) | |
.then(() => setLoader(false)); |
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.
src/App.tsx
Outdated
if (completedSearch !== 'all') { | ||
if (completedSearch === 'completed') { | ||
visTodos = visTodos.filter(todo => todo.completed === true); | ||
} | ||
|
||
if (completedSearch === 'active') { |
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.
Create a enum for 'all', 'active', 'completed' and use it everywhere
src/App.tsx
Outdated
|
||
if (completedSearch !== 'all') { | ||
if (completedSearch === 'completed') { | ||
visTodos = visTodos.filter(todo => todo.completed === true); |
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.
visTodos = visTodos.filter(todo => todo.completed === true); | |
visTodos = visTodos.filter(todo => todo.completed); |
src/App.tsx
Outdated
} | ||
|
||
if (completedSearch === 'active') { | ||
visTodos = visTodos.filter(todo => todo.completed === false); |
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.
visTodos = visTodos.filter(todo => todo.completed === false); | |
visTodos = visTodos.filter(todo => !todo.completed); |
src/components/TodoList/TodoList.tsx
Outdated
<tr | ||
key={todo.id} | ||
data-cy="todo" | ||
className={cn({ | ||
'has-background-info-light': todo.id === modalId, | ||
})} | ||
> | ||
<td className="is-vcentered">{todo.id}</td> | ||
<td className="is-vcentered"> | ||
{todo.completed && ( | ||
<span className="icon" data-cy="iconCompleted"> | ||
<i className="fas fa-check" /> | ||
</span> | ||
)} | ||
</td> | ||
<td className="is-vcentered is-expanded"> | ||
<p | ||
className={cn({ | ||
'has-text-danger': !todo.completed, | ||
'has-text-success': todo.completed, | ||
})} | ||
> | ||
{todo.title} |
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.
Move this logic to the TodoItem
component
src/components/TodoList/TodoList.tsx
Outdated
> | ||
<td className="is-vcentered">{todo.id}</td> | ||
<td className="is-vcentered"> | ||
{todo.completed && ( |
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.
Use destructuring for todo
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.
Hi, the comments from the previous review still not fixed, you need to fix all comments and don't forget to make a deploy again after your changes
|
.then(todosFromServer => { | ||
setTodos(todosFromServer); | ||
}) | ||
.then(() => { | ||
setLoader(false); | ||
}); |
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.
DEMO LINK
два теста падають але в мене немає таких todo які є в тесті