Skip to content

task solution#2140

Open
VitaliyHoroshko wants to merge 2 commits intomate-academy:masterfrom
VitaliyHoroshko:develop
Open

task solution#2140
VitaliyHoroshko wants to merge 2 commits intomate-academy:masterfrom
VitaliyHoroshko:develop

Conversation

@VitaliyHoroshko
Copy link

Copy link

@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! 👏

here are some improvements below ⬇️

Comment on lines +26 to +53
<a
href="#/"
className={classNames('filter__link', { selected: filter === 'all' })}
data-cy="FilterLinkAll"
onClick={() => setFilter('all')}
>
All
</a>
<a
href="#/active"
className={classNames('filter__link', {
selected: filter === 'active',
})}
data-cy="FilterLinkActive"
onClick={() => setFilter('active')}
>
Active
</a>
<a
href="#/completed"
className={classNames('filter__link', {
selected: filter === 'completed',
})}
data-cy="FilterLinkCompleted"
onClick={() => setFilter('completed')}
>
Completed
</a>
Copy link

Choose a reason for hiding this comment

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

you may create separate enum with filter values and map through it

Comment on lines +6 to +7
filter: 'all' | 'active' | 'completed';
setFilter: (filter: 'all' | 'active' | 'completed') => void;
Copy link

Choose a reason for hiding this comment

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

also it's better to use enum there

Comment on lines +87 to +96
onKeyUp={e => {
if (e.key === 'Enter') {
handleSubmit();
}

if (e.key === 'Escape') {
setNewTitle(todo.title);
onEdit(null);
}
}}
Copy link

Choose a reason for hiding this comment

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

move to separate fn

src/App.tsx Outdated

newTodoRef.current?.focus();
} catch {
setError('Unable to delete a todo');
Copy link

Choose a reason for hiding this comment

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

in future, when you will have more that one error message, it's better to move your messages into separate enum

@VitaliyHoroshko VitaliyHoroshko requested a review from 2pasha March 9, 2026 04:21
Copy link

@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