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

Closed
wants to merge 4 commits into from
Closed

add task solution #487

wants to merge 4 commits into from

Conversation

Vayts
Copy link

@Vayts Vayts commented Oct 3, 2023

Copy link

@roman-mirzoian roman-mirzoian left a comment

Choose a reason for hiding this comment

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

Nice work, but the demo link doesn't work

>
{motherName}
</Link>
) : (motherName || '-')}

Choose a reason for hiding this comment

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

const NOT_SET_VALUE = '-';
...
) : (motherName || NOT_SET_VALUE)}

Choose a reason for hiding this comment

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

Not fixed 😢

Comment on lines 44 to 47
father: peopleFormServer
.find(father => father.name === person.fatherName),
mother: peopleFormServer
.find(mother => mother.name === person.motherName),

Choose a reason for hiding this comment

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

Suggested change
father: peopleFormServer
.find(father => father.name === person.fatherName),
mother: peopleFormServer
.find(mother => mother.name === person.motherName),
father: peopleFormServer
.find(({ name })=> name === person.fatherName),
mother: peopleFormServer
.find(({ name }) => name === person.motherName),

Comment on lines 19 to 21
person => person.name.toLowerCase().includes(normalizedQuery)
|| person.fatherName?.toLowerCase().includes(normalizedQuery)
|| person.motherName?.toLowerCase().includes(normalizedQuery),

Choose a reason for hiding this comment

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

You use a similar action three times - this can be taken as a helper function

}: FilterParams): Person[] => {
let filteredPeople = [...people];

if (query.trim() !== '') {

Choose a reason for hiding this comment

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

Suggested change
if (query.trim() !== '') {
if (!!query.trim()) {

);
}

if (centuries.length > 0) {

Choose a reason for hiding this comment

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

Suggested change
if (centuries.length > 0) {
if (!!centuries.length) {


if (centuries.length > 0) {
filteredPeople = filteredPeople.filter((person) => {
return centuries.includes(Math.ceil(person.born / 100).toString());

Choose a reason for hiding this comment

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

Avoid using "magiv values" (100 is magic value)

sort,
order,
}: FilterParams): Person[] => {
let filteredPeople = [...people];

Choose a reason for hiding this comment

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

The filter array method returns a copy of the array, so you don't need to do it manually

@Vayts Vayts requested a review from roman-mirzoian October 4, 2023 14:35
Copy link

@roman-mirzoian roman-mirzoian left a comment

Choose a reason for hiding this comment

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

Nice fixes, but now the table is not sortable.
image

>
{motherName}
</Link>
) : (motherName || '-')}

Choose a reason for hiding this comment

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

Not fixed 😢

@Vayts Vayts requested a review from roman-mirzoian October 6, 2023 08:13
Copy link

@roman-mirzoian roman-mirzoian 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 👍

@Vayts Vayts closed this by deleting the head repository Dec 13, 2023
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.

2 participants