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

add task solution #2700

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

Conversation

Andrew77788
Copy link

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.


Thank you for your hard work on this project! 😊 While your implementation is mostly correct and meets many of the task requirements, there are a few critical issues that need to be addressed before we can approve the pull request:

  1. Dynamic Email Address: The email address in the anchor tag is currently hardcoded. It's important to dynamically set this based on the user object to ensure it reflects the correct user's email.

  2. Loading State Logic: The logic for setting the loading state is inefficient. It sets the loading state to true and then immediately to false after a timeout. This should be revised to better reflect the actual loading state of the application.

  3. Typo in Variable Name: There's a typo in the variable name updatedToods. It should be corrected to updatedTodos to maintain consistency and clarity in your code.

Please address these issues to ensure the functionality and clarity of your code. Once these changes are made, we can proceed with the approval. Keep up the great work, and don't hesitate to reach out if you need any assistance! 🚀

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

🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review button in the Reviewers tab.

src/App.tsx Outdated

useEffect(() => {
setLoading(true);
let updatedToods = [...todos];

Choose a reason for hiding this comment

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

There is a typo in the variable name updatedToods. It should be updatedTodos to match the context of the code.

src/App.tsx Outdated
Comment on lines 45 to 62
setLoading(true);
let updatedToods = [...todos];

if (filter === 'active') {
updatedToods = updatedToods.filter(event => !event.completed);
} else if (filter === 'completed') {
updatedToods = updatedToods.filter(event => event.completed);
}

if (searchFilter) {
updatedToods = updatedToods.filter(todo =>
todo.title.toLowerCase().includes(searchFilter.toLowerCase()),
);
}

setTimeout(() => {
setFilterTodos(updatedToods);
setLoading(false);

Choose a reason for hiding this comment

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

The logic for setting the loading state is inefficient. The loading state is set to true and then immediately set to false after a timeout. Consider revising this logic to better reflect the actual loading state of the application.


{' by '}

<a href="mailto:[email protected]">Leanne Graham</a>
<a href="mailto:[email protected]">{user?.name}</a>

Choose a reason for hiding this comment

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

The email address in the anchor tag is hardcoded. Consider dynamically setting the email address based on the user object to ensure it reflects the correct user's email.

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 solution! 🎉 While there are a few critical issues to address, such as dynamically setting the email address based on the user object, correcting the typo in updatedTodos, and revising the loading state logic for efficiency, your code meets the task requirements. These improvements will enhance the functionality and clarity of your code. Remember to review the comments and learn from these points to refine your skills further. Keep up the good work and continue to improve! 💪

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

useEffect(() => {
if (selectedTodo?.userId) {
setLoadingModal(true);
getUser(selectedTodo?.userId).then(fetchedUser => setUser(fetchedUser));

Choose a reason for hiding this comment

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

The email address in the anchor tag should be dynamically set based on the user object to ensure it reflects the correct user's email. Please update this logic accordingly.

Comment on lines +31 to +33
setTimeout(() => {
setLoadingModal(false);
}, 500);

Choose a reason for hiding this comment

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

The logic for setting the loading state is inefficient. It sets the loading state to true and then immediately to false after a timeout. This should be revised to better reflect the actual loading state of the application.


useEffect(() => {
setLoading(true);
let updatedTodos = [...todos];

Choose a reason for hiding this comment

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

There's a typo in the variable name updatedToods. It should be corrected to updatedTodos to maintain consistency and clarity in your code.


{' by '}

<a href="mailto:[email protected]">Leanne Graham</a>
<a href={`mailto:${user?.email}`}>{user?.name}</a>

Choose a reason for hiding this comment

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

Ensure that the email address is dynamically set based on the user object. This is important to reflect the correct user's email in the anchor tag.

Copy link

@volodymyr-soltys97 volodymyr-soltys97 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 code
You need to fix these failed tests, you need to add additional class for eye icon and data attribute, if you need some help feel free in the fe_chat
image

src/App.tsx Outdated
Comment on lines 48 to 50
if (filter === 'active') {
updatedTodos = updatedTodos.filter(event => !event.completed);
} else if (filter === 'completed') {

Choose a reason for hiding this comment

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

Create a enum for 'all', 'active', 'completed' and use it everywhere

</td>
<td className="is-vcentered is-expanded">
<p className={todo.completed ? 'has-text-success' : 'has-text-danger'}>
{todo.title}{' '}

Choose a reason for hiding this comment

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

Suggested change
{todo.title}{' '}
{todo.title}

)}
</td>
<td className="is-vcentered is-expanded">
<p className={todo.completed ? 'has-text-success' : 'has-text-danger'}>

Choose a reason for hiding this comment

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

Use the classnames library for add classes with condition, fix it everywhere

Copy link

@volodymyr-soltys97 volodymyr-soltys97 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 code


export const App: React.FC = () => {
const [todos, setTodo] = useState<Todo[]>([]);
const [filterTodos, setFilterTodos] = useState<Todo[]>([]);

Choose a reason for hiding this comment

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

Don't need to create additional state for filtered todos, use only one state

Suggested change
const [filterTodos, setFilterTodos] = useState<Todo[]>([]);

src/App.tsx Outdated

export const App: React.FC = () => {
const [todos, setTodo] = useState<Todo[]>([]);
const [filterTodos, setFilterTodos] = useState<Todo[]>([]);
const [filter, setFilter] = useState<string>('all');

Choose a reason for hiding this comment

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

Use enum here for 'all'

src/App.tsx Outdated
Comment on lines 54 to 58
if (filter === FilterType.Active) {
updatedTodos = updatedTodos.filter(event => !event.completed);
} else if (filter === FilterType.Completed) {
updatedTodos = updatedTodos.filter(event => event.completed);
}

Choose a reason for hiding this comment

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

Use switch case here, it will be better

src/App.tsx Outdated
let updatedTodos = [...todos];

if (filter === FilterType.Active) {
updatedTodos = updatedTodos.filter(event => !event.completed);

Choose a reason for hiding this comment

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

Suggested change
updatedTodos = updatedTodos.filter(event => !event.completed);
updatedTodos = updatedTodos.filter(todo => !todo.completed);

Comment on lines 26 to 28
<option value="all">All</option>
<option value="active">Active</option>
<option value="completed">Completed</option>

Choose a reason for hiding this comment

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

Also, use a created enum here

'has-text-danger': !todo.completed,
})}
>
{todo.title}

Choose a reason for hiding this comment

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

Use destructuting for todo

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.

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