-
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
ready #2570
base: master
Are you sure you want to change the base?
ready #2570
Conversation
src/App.tsx
Outdated
type Todo = { | ||
userId: number; | ||
id: number; | ||
title: string; | ||
completed: boolean; | ||
}; |
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 it to some separate file
src/components/TodoList/TodoList.tsx
Outdated
useEffect(() => { | ||
getTodos() | ||
.then(todosData => { | ||
setTodos(todosData); | ||
setLoading(false); | ||
}) | ||
.catch(error => { | ||
// eslint-disable-next-line no-console | ||
console.error('Ошибка при загрузке задач:', error); | ||
}); | ||
}, []); |
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.
you can move this logic to the App.tsx
src/components/TodoList/TodoList.tsx
Outdated
let filteredTodos = todos.filter(todo => | ||
todo.title.toLowerCase().includes(filterBy.toLowerCase()), | ||
); | ||
|
||
<tr data-cy="todo" className=""> | ||
<td className="is-vcentered">8</td> | ||
<td className="is-vcentered"> | ||
<span className="icon" data-cy="iconCompleted"> | ||
<i className="fas fa-check" /> | ||
</span> | ||
</td> | ||
<td className="is-vcentered is-expanded"> | ||
<p className="has-text-success">quo adipisci enim quam ut ab</p> | ||
</td> | ||
<td className="has-text-right is-vcentered"> | ||
<button data-cy="selectButton" className="button" type="button"> | ||
if (filterBySelect !== 'all') { | ||
if (filterBySelect === 'completed') { | ||
filteredTodos = filteredTodos.filter(todo => todo.completed === true); | ||
} else { | ||
filteredTodos = filteredTodos.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.
same with this logic
type Todo = { | ||
userId: number; | ||
id: number; | ||
title: string; | ||
completed: boolean; | ||
}; |
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.
just import the Todo type here
|
||
const todo = todos.find(cTodo => cTodo.id === modalShowId); // Поиск задачи по ID | ||
|
||
// Загружаем данные пользователя при наличии 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.
Remove comment. Try to write obvious code that explains all we need without comments)
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.
Great work!
DEMO LINK