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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Andrii-Yanchuk
Copy link

Copy link

@Fridrif27 Fridrif27 left a comment

Choose a reason for hiding this comment

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

Everything is done correctly

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 requirements! 🎉 The code is well-structured and follows React best practices. Although there are a few minor issues, such as verifying imports and ensuring naming conventions, these do not significantly impact the functionality. Keep up the good work and consider addressing these minor points to further enhance your code quality. 😊

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

import { TodoList } from './components/TodoList';
import { TodoFilter } from './components/TodoFilter';
import { TodoModal } from './components/TodoModal';
import { Loader } from './components/Loader';
import { getTodos } from './api';

Choose a reason for hiding this comment

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

Ensure that the getTodos function is correctly imported from the ./api file. Verify that the ./api file exists and exports the getTodos function as expected.

import { Loader } from '../Loader';
import { Todo } from '../../types/Todo';
import { User } from '../../types/User';
import { getUser } from '../../api';

Choose a reason for hiding this comment

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

Ensure that the getUser function is correctly imported from the ../../api file. Verify that the ../../api file exists and exports the getUser function as expected.

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 👍
Approved, but left a few comments to improve your solution

const [selectedTodo, setSelectedTodo] = useState<Todo | null>(null);
const [isLoading, setIsLoading] = useState(false);
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.

all/active/completed are magic values

Comment on lines +37 to +41
if (userStatus === 'completed') {
return todo.completed === true;
}

if (userStatus === 'active') {

Choose a reason for hiding this comment

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

Use switch case instead

Comment on lines +37 to +41
<i className="fas fa-magnifying-glass" />
</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 cases, 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

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.

4 participants