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

table_advansed #639

Closed
wants to merge 3 commits into from
Closed

table_advansed #639

wants to merge 3 commits into from

Conversation

MaksymKos
Copy link

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.

Looks good.
Compare your implementation with working example.
А couple mismatches founded.

  • when exists some searchParams and click on person link - searchParams shouldn't be resetted
  • when order in desc direction- should be visible only bottom arrow
    actual:
    actual
    working example:
    working_example


const sex = searchParams.get('sex');
const centuries = searchParams.getAll('centuries');
const query = searchParams.get('query') || '';

Choose a reason for hiding this comment

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

suggest to make enum for all possible searchParams

Copy link

@etojeDenys etojeDenys left a comment

Choose a reason for hiding this comment

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

i cannot find PeopleTable component in github

src/components/PeoplePage.tsx Outdated Show resolved Hide resolved
Comment on lines 64 to 74
case 'name':
{
prepared.sort((a, b) => a.name.localeCompare(b.name));
break;
}

case 'sex':
{
prepared.sort((a, b) => a.sex.localeCompare(b.sex));
break;
}

Choose a reason for hiding this comment

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

Suggested change
case 'name':
{
prepared.sort((a, b) => a.name.localeCompare(b.name));
break;
}
case 'sex':
{
prepared.sort((a, b) => a.sex.localeCompare(b.sex));
break;
}
case 'name':
case 'sex':
{
prepared.sort((a, b) => a[sort].localeCompare(b[sort]));
break;
}

you can group some cases

Comment on lines 76 to 85
case 'born': {
prepared.sort((a, b) => a.born - b.born);
break;
}

case 'died': {
prepared.sort((a, b) => a.died - b.died);
break;
}

Choose a reason for hiding this comment

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

same here

setLoading(true);
getPeople()
.then(peopleOnServer)
.then(preparedPeople => setPeople(preparedPeople))

Choose a reason for hiding this comment

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

Suggested change
.then(preparedPeople => setPeople(preparedPeople))
.then(setPeople)

we can simplify it

@MaksymKos MaksymKos requested a review from etojeDenys December 9, 2023 08:32
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.

Well done.

@MaksymKos MaksymKos closed this by deleting the head repository Oct 14, 2024
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