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

develop #1496

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

develop #1496

wants to merge 2 commits into from

Conversation

Ostkreuzzz
Copy link

Copy link

@hma-3 hma-3 left a comment

Choose a reason for hiding this comment

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

LGTM!
Have just a few suggestions below⬇️

Comment on lines 74 to 79
// todos.forEach(todo =>
// onUpdate({
// ...todo,
// completed: isAllCompleted ? false : true,
// }),
// );
Copy link

Choose a reason for hiding this comment

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

remove all comments

Choose a reason for hiding this comment

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

Good point!


const handleUpdate = () => {
if (!newTitle) {
setIsEditing(true);
Copy link

Choose a reason for hiding this comment

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

maybe setIsEditing(false)?

Choose a reason for hiding this comment

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

Fix it

Copy link
Author

Choose a reason for hiding this comment

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

Edit Form
if title became empty
should stay open on fail:

return;
}

if (newTitle.trim() === todo.title) {
Copy link

Choose a reason for hiding this comment

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

you can create a variable for newTitle.trim() since you use it more than once

Choose a reason for hiding this comment

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

Good point!

const [isEditing, setIsEditing] = useState(false);
const [newTitle, setNewTitle] = useState(todo.title);
const [isUpdating, setIsUpdating] = useState(false);
const [isChecked, setIsChecked] = useState(todo.completed);
Copy link

Choose a reason for hiding this comment

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

why do you need the isChecked state? I haven't seen that you use it

Choose a reason for hiding this comment

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

Why do you need the isChecked state? You can use todo.completed

Copy link

@igorkruz igorkruz 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 👍
let's improve your solution

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

Choose a reason for hiding this comment

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

Suggested change
{`${activeTodosCount} items left`}
{activeTodosCount} items left

completedTodosIds: number[];
}

export const TodoFooter: React.FC<Props> = ({

Choose a reason for hiding this comment

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

Suggested change
export const TodoFooter: React.FC<Props> = ({
export const TodoFooter: FC<Props> = ({

Comment on lines 74 to 79
// todos.forEach(todo =>
// onUpdate({
// ...todo,
// completed: isAllCompleted ? false : true,
// }),
// );

Choose a reason for hiding this comment

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

Good point!

const [isEditing, setIsEditing] = useState(false);
const [newTitle, setNewTitle] = useState(todo.title);
const [isUpdating, setIsUpdating] = useState(false);
const [isChecked, setIsChecked] = useState(todo.completed);

Choose a reason for hiding this comment

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

Why do you need the isChecked state? You can use todo.completed


const handleUpdate = () => {
if (!newTitle) {
setIsEditing(true);

Choose a reason for hiding this comment

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

Fix it

return;
}

if (newTitle.trim() === todo.title) {

Choose a reason for hiding this comment

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

Good point!

Copy link

@igorkruz igorkruz 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