Skip to content

add task solution#1799

Open
rlysunets wants to merge 5 commits into
mate-academy:masterfrom
rlysunets:develop
Open

add task solution#1799
rlysunets wants to merge 5 commits into
mate-academy:masterfrom
rlysunets:develop

Conversation

@rlysunets

Copy link
Copy Markdown

@CyborgNinjaHat CyborgNinjaHat left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Great job! However, I can't approve your pull request - the table is not sortable by columns, and that's a key requirement of the task. Fix that, and you're good to go.

@rlysunets rlysunets requested a review from CyborgNinjaHat June 3, 2026 10:25

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

There are critical bugs that block task completion. First, typos in the sorting logic in PeoplePage.tsx — comparing a.born with a.born and a.died with a.died instead of comparing with the second parameter b. This breaks sorting by birth and death years entirely. Second, the sex filter is not connected to PeoplePage's filtering logic — the sex search param is read but never used in the filter condition. Third, the PeopleFilters component is rendered unconditionally in App.tsx (line 135), but requirement #3 specifies filters should only appear when people are loaded — this needs conditional rendering based on the loading state. Please fix these three issues before resubmission.


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

Important

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

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread src/pages/PeoplePage.tsx
Comment on lines +72 to +73

case 'born':

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Typo: comparing a.born with itself always returns 0. Should be a.born - b.born. This breaks sorting by birth year.

Comment thread src/pages/PeoplePage.tsx
Comment on lines +76 to +77

case 'died':

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Typo: comparing a.died with itself always returns 0. Should be a.died - b.died. This breaks sorting by death year.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

There's a critical bug in src/components/PeopleFilters.tsx where URL construction is malformed. When params.toString() returns an empty string, the current code returns ? instead of ., which creates invalid URLs with double question marks like ?query=mae?sort=name&order=asc. The fix should check if the query string is empty and return . for the current path instead:


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

Important

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

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment on lines +29 to +35
params.delete('query');
}

setSearchParams(params);
};

const toggleCentury = (value: number) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Critical bug: When params.toString() is empty, this returns ? creating malformed URLs like ?sort=name&order=asc or ?query=mae?sort=name (double ?). Should return . when params are empty to avoid this issue.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

This is an educational approval to help you progress while learning. Your core implementation is strong - the filter and sort logic using URL search params is well done in PeoplePage.tsx, PeopleFilters.tsx, and PeopleTable.tsx. However, there's one critical bug that needs fixing: PersonLink.tsx uses a hardcoded path /people/${person.slug} without preserving current search params. When a user clicks a person's name, they lose all their filters and sorting settings, which violates checklist item #3. To fix this, use the SearchLink component (import it from ../SearchLink) or get the current search params with useSearchParams() and append them to your link. For example: <SearchLink params={{ query: search }} to={...}>. This is a common pattern in React apps and mastering it will serve you well. The good news is fixing one file (PersonLink.tsx) will resolve the issue across all the affected files since they all use this component.


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

Footnotes

  1. Rate AI review example

}

setSearchParams(params);
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This navigation doesn't preserve search params. Per requirement #2, clicking on a person should keep the current filters/sort active. Use the SearchLink component or construct a link with the current search params included.

Comment thread src/components/Navbar.tsx
Comment on lines +17 to +20
classNames('navbar-item', {
'has-background-grey-lighter': isActive,
})
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The link uses a hardcoded path /people/${person.slug} without preserving search params. When navigating to a person's details, the user's active filters and sort settings are lost. Use the SearchLink component or include the current search params in the URL to preserve the filter/sort state as required by checklist item #3.

Comment thread src/App.tsx
<Navbar />

<div className="section">
<div className="container">

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This link navigates to /people/${person.slug} without preserving search params. According to checklist item #3, search params must be preserved when navigating within the People page (selecting a person). Use SearchLink component with preserved params instead.


export const PeopleTable = ({ people = [], slug }: PeopleTableProps) => {
const [searchParams] = useSearchParams();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This link navigates to /people/${person.slug} without preserving search params. According to checklist item #3, search params must be preserved when navigating within the People page. Use the SearchLink component with preserved search params, or construct the URL to include the current search string from useSearchParams.

const isFemale = person.sex === 'f';

return (
<Link

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This link navigates to /people/${person.slug} without preserving search params. According to requirement #3, search params must be preserved when navigating within the People page (selecting a person). Use useSearchParams to append the current search string, or refactor to use the SearchLink component that already exists in the codebase.

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