Skip to content

Solution 3/3#2207

Open
tavokina wants to merge 4 commits into
mate-academy:masterfrom
tavokina:develop
Open

Solution 3/3#2207
tavokina wants to merge 4 commits into
mate-academy:masterfrom
tavokina:develop

Conversation

@tavokina
Copy link
Copy Markdown

Copy link
Copy Markdown

@brespect brespect left a comment

Choose a reason for hiding this comment

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

Seems like your DEMO LINK is not working:
Image

@tavokina tavokina requested a review from brespect May 18, 2026 18:55
Copy link
Copy Markdown

@2pasha 2pasha left a comment

Choose a reason for hiding this comment

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

good job! 👏

take a look on comments below ⬇️

Comment thread src/components/TodoItem.tsx Outdated
Comment on lines +103 to +115
onBlur={() => {
if (!isCancelledRef.current) {
handleSubmit();
}

isCancelledRef.current = false;
}}
onKeyUp={e => {
if (e.key === 'Escape') {
setIsEditing(false);
setEditingTitle(todo.title);
isCancelledRef.current = 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.

move to separate functions

Comment thread src/App.tsx Outdated
Comment on lines +12 to +18
const ERROR_MESSAGES = {
load: 'Unable to load todos',
title: 'Title should not be empty',
add: 'Unable to add a todo',
delete: 'Unable to delete a todo',
update: 'Unable to update a todo',
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

you may move this to /types and use enum instead

Comment thread src/App.tsx Outdated
Comment on lines +163 to +187
onSubmit={e => {
e.preventDefault();

if (!normalizedTitle) {
setErrorMessage(ERROR_MESSAGES.title);

return;
}

setTempTodo({
...newTodo(normalizedTitle),
id: 0,
});
todoService
.addTodo(newTodo(normalizedTitle))
.then(addedTodo => {
setTodos([...todos, addedTodo]);
setTitle('');
setTempTodo(null);
})
.catch(() => {
setErrorMessage(ERROR_MESSAGES.add);
setTempTodo(null);
});
}}
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 fn

Comment thread src/App.tsx Outdated
Comment on lines +229 to +260
<a
href="#/"
className={classNames('filter__link', {
selected: status === '',
})}
data-cy="FilterLinkAll"
onClick={() => setStatus('')}
>
All
</a>

<a
href="#/active"
className={classNames('filter__link', {
selected: status === 'active',
})}
data-cy="FilterLinkActive"
onClick={() => setStatus('active')}
>
Active
</a>

<a
href="#/completed"
className={classNames('filter__link', {
selected: status === 'completed',
})}
data-cy="FilterLinkCompleted"
onClick={() => setStatus('completed')}
>
Completed
</a>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

you may add all your filter values to enum and map through it

Comment thread src/App.tsx Outdated
</span>

{/* Active link should have the 'selected' class */}
<nav className="filter" data-cy="Filter">
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 separate Filter component

@tavokina tavokina requested a review from 2pasha May 19, 2026 08:38
Copy link
Copy Markdown

@brespect brespect 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.

3 participants