Skip to content

peremoga - #1330

Open
Kit3AWP wants to merge 2 commits into
mate-academy:masterfrom
Kit3AWP:develop
Open

peremoga#1330
Kit3AWP wants to merge 2 commits into
mate-academy:masterfrom
Kit3AWP:develop

Conversation

@Kit3AWP

@Kit3AWP Kit3AWP commented Jul 26, 2026

Copy link
Copy Markdown

@brespect brespect left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Almost done, let's fix few comments and the UI:
Image

Comment thread src/components/TodoList.tsx Outdated
Comment on lines +9 to +17
if (filter === 'Active') {
return !todo.completed;
}

if (filter === 'Completed') {
return todo.completed;
}

return true;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

better to use switch here with enum values

Comment on lines +17 to +21
if (normalizedTitle === '') {
deleteTodo(todo.id);
} else if (normalizedTitle !== todo.title) {
renameTodo(todo.id, normalizedTitle);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

no need of else

Comment thread src/components/TodoItem.tsx Outdated
Comment on lines +57 to +62
onKeyUp={event => {
if (event.key === 'Escape') {
setEditText(todo.title);
setIsEditing(false);
}
}}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

move to separate handler

Comment thread src/components/TodoItem.tsx Outdated
Comment on lines +79 to +89
onClick={() => {
deleteTodo(todo.id);

const newTodoField = document.querySelector(
'[data-cy="NewTodoField"]',
) as HTMLInputElement;

if (newTodoField) {
newTodoField.focus();
}
}}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

create a separate handler for burger functions

Comment thread src/components/Footer.tsx
Comment on lines +16 to +43
<nav className="filter" data-cy="Filter">
<a
href="#/"
className={`filter__link ${filter === 'All' ? 'selected' : ''}`}
data-cy="FilterLinkAll"
onClick={() => setFilter('All')}
>
All
</a>

<a
href="#/active"
className={`filter__link ${filter === 'Active' ? 'selected' : ''}`}
data-cy="FilterLinkActive"
onClick={() => setFilter('Active')}
>
Active
</a>

<a
href="#/completed"
className={`filter__link ${filter === 'Completed' ? 'selected' : ''}`}
data-cy="FilterLinkCompleted"
onClick={() => setFilter('Completed')}
>
Completed
</a>
</nav>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

simplify this using Array.map()

Comment thread src/components/Footer.tsx Outdated
Comment on lines +49 to +59
onClick={() => {
clearCompleted();

const newTodoField = document.querySelector(
'[data-cy="NewTodoField"]',
) as HTMLInputElement;

if (newTodoField) {
newTodoField.focus();
}
}}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

make separate handler

Comment thread src/components/TodoItem.tsx Outdated
return (
<div
data-cy="Todo"
className={`todo ${todo.completed ? 'completed' : ''} ${isEditing ? 'editing' : ''}`}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

move to separate top level condition

@Kit3AWP
Kit3AWP requested a review from brespect July 26, 2026 21:31

@brespect brespect left a comment

Copy link
Copy Markdown

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