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

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

Conversation

taniabarkovskya
Copy link

Copy link

@chelsea7smile chelsea7smile left a comment

Choose a reason for hiding this comment

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

LGTM 🔥

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Great job on implementing the task! 🎉 Your code meets the core requirements, and the functionality is working as expected. While there is a minor issue with not using the classnames library for conditional class definitions, it doesn't significantly impact the functionality. Keep up the good work, and consider addressing this in future projects to enhance code maintainability. Keep learning and coding! 🚀

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

Copy link

@BudnikOleksii BudnikOleksii left a comment

Choose a reason for hiding this comment

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

Good work 👍
Let's improve your solution slightly

src/App.tsx Outdated
const [isLoading, setIsLoading] = useState(false);
const [selectedTodo, setSelectedTodo] = useState<Todo | null>(null);
const [query, setQuery] = useState('');
const [status, setStatus] = useState('all');

Choose a reason for hiding this comment

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

Create a corresponding type or enum for status

</span>

{query && (
<span className="icon is-right" style={{ pointerEvents: 'all' }}>

Choose a reason for hiding this comment

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

Avoid inline styles, use classes instead

<tbody>
{todos.map(todo => (
<tr
data-cy="todo"

Choose a reason for hiding this comment

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

Create a todo component

Comment on lines 40 to 46
<td className="is-vcentered">
<span className="icon" data-cy="iconCompleted">
<i className="fas fa-check" />
</span>
</td>
) : (
<td className="is-vcentered" />

Choose a reason for hiding this comment

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

You have <td className="is-vcentered" /> in both case only content is different

<span className="icon">
<i
className={
todo.id === selectedTodo?.id

Choose a reason for hiding this comment

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

You compare todo.id === selectedTodo?.id twice, create a variable

Comment on lines 9 to 13
if (status === 'completed') {
return todo.completed === true;
}

if (status === 'active') {

Choose a reason for hiding this comment

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

  • completed/active are magic values
  • Use switch case instead

)
.filter(todo => {
if (status === 'completed') {
return todo.completed === true;

Choose a reason for hiding this comment

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

You don't need to compare with true, it's already boolean

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.

I'm approving it, looks much more better🔥

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.

5 participants