Skip to content
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

solution #879

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

solution #879

wants to merge 2 commits into from

Conversation

dseq0
Copy link

@dseq0 dseq0 commented Oct 20, 2023

Copy link

@IvanFesenko IvanFesenko left a comment

Choose a reason for hiding this comment

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

  • Those buuton should be more centered
    2023-10-20_16h27_13

  • Typo: should be 1 item left
    2023-10-20_16h28_44

src/App.tsx Outdated
Comment on lines 115 to 117
if (updatedCompletedTodo.completed
!== prevTodos.find((todo) => todo.id
=== updatedCompletedTodo.id)?.completed) {

Choose a reason for hiding this comment

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

Move condition into variable - it's hard readable

Comment on lines 21 to 59
}, [todos]);

return (
<footer className="todoapp__footer" data-cy="Footer">
<span className="todo-count" data-cy="TodosCounter">
{`${activeTodosCount} items left`}
</span>

<nav className="filter" data-cy="Filter">
<a
href="#/"
className={classNames('filter__link', {
selected: filterBy === Filter.All,
})}
data-cy="FilterLinkAll"
onClick={() => setFilterBy(Filter.All)}
>
All
</a>

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

<a
href="#/completed"
className={classNames('filter__link', {
selected: filterBy === Filter.Completed,
})}
data-cy="FilterLinkCompleted"
onClick={() => setFilterBy(Filter.Completed)}
>

Choose a reason for hiding this comment

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

Better will do this way, instead of usign anonymous function

Suggested change
}, [todos]);
return (
<footer className="todoapp__footer" data-cy="Footer">
<span className="todo-count" data-cy="TodosCounter">
{`${activeTodosCount} items left`}
</span>
<nav className="filter" data-cy="Filter">
<a
href="#/"
className={classNames('filter__link', {
selected: filterBy === Filter.All,
})}
data-cy="FilterLinkAll"
onClick={() => setFilterBy(Filter.All)}
>
All
</a>
<a
href="#/active"
className={classNames('filter__link', {
selected: filterBy === Filter.Active,
})}
data-cy="FilterLinkActive"
onClick={() => setFilterBy(Filter.Active)}
>
Active
</a>
<a
href="#/completed"
className={classNames('filter__link', {
selected: filterBy === Filter.Completed,
})}
data-cy="FilterLinkCompleted"
onClick={() => setFilterBy(Filter.Completed)}
>
}, [todos]);
const onFilterSelect = (fillter: Filter) => () => {
setFilterBy(fillter);
}
return (
<footer className="todoapp__footer" data-cy="Footer">
<span className="todo-count" data-cy="TodosCounter">
{`${activeTodosCount} items left`}
</span>
<nav className="filter" data-cy="Filter">
<a
href="#/"
className={classNames('filter__link', {
selected: filterBy === Filter.All,
})}
data-cy="FilterLinkAll"
onClick={onFilterSelect(Filter.All)}
>
All
</a>
<a
href="#/active"
className={classNames('filter__link', {
selected: filterBy === Filter.Active,
})}
data-cy="FilterLinkActive"
onClick={onFilterSelect(Filter.Active)}
>
Active
</a>
<a
href="#/completed"
className={classNames('filter__link', {
selected: filterBy === Filter.Completed,
})}
data-cy="FilterLinkCompleted"
onClick={onFilterSelect(Filter.Completed)}
>

Comment on lines 94 to 97
onSubmit={(e) => {
e.preventDefault();
handleEditSubmit();
}}

Choose a reason for hiding this comment

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

move e.preventDefault(); into handleEditSubmit handler

Suggested change
onSubmit={(e) => {
e.preventDefault();
handleEditSubmit();
}}
onSubmit={handleEditSubmit}

@dseq0 dseq0 requested a review from IvanFesenko October 24, 2023 10:52
Copy link

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

A lot of tests are failed.
Please try to fix them.
For example hide error message in 3 seconds.
In general tests describes what behavior they are expecting.

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