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 #1089

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

Develop #1089

wants to merge 8 commits into from

Conversation

minimal005
Copy link

@minimal005 minimal005 commented Dec 23, 2024

DEMO LINK

I don't know, I passed all 118 tests 😳

@minimal005
Copy link
Author

)))

Copy link

@StasSokolov1 StasSokolov1 left a comment

Choose a reason for hiding this comment

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

Overall it looks good, but let's improve your solution a bit more!

Comment on lines 1 to 15
// import React from 'react';

// export const UserWarning: React.FC = () => (
// <section className="section">
// <p className="box is-size-3">
// Please get your <b> userId </b>{' '}
// <a href="https://mate-academy.github.io/react_student-registration">
// here
// </a>{' '}
// and save it in the app <pre>const USER_ID = ...</pre>
// All requests to the API must be sent with this
// <b> userId.</b>
// </p>
// </section>
// );

Choose a reason for hiding this comment

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

please remove redundant comments

type="button"
className="todoapp__clear-completed"
data-cy="ClearCompletedButton"
disabled={todos.length === completedTodosLength}

Choose a reason for hiding this comment

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

Suggested change
disabled={todos.length === completedTodosLength}
disabled={completedTodosLength === 0}

it seems that it will be more informative

Copy link
Author

Choose a reason for hiding this comment

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

Цей момент не спрацьовує, оскільки він не подібний, при переписуванні валяться тести на цю кнопку

<header className="todoapp__header">
{!!todos.length && (
<button
onClick={() => changeCompleteAll()}

Choose a reason for hiding this comment

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

Suggested change
onClick={() => changeCompleteAll()}
onClick={changeCompleteAll}

can be a bit simplify


const handleAddTodo = async (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
if (query.trim()) {

Choose a reason for hiding this comment

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

query.trim() move into const and reuse

@minimal005
Copy link
Author

I changed the code a bit, rewrote it, added 'reduce'

Copy link

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