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

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

Solution #1160

wants to merge 3 commits into from

Conversation

MakksymSly
Copy link

Copy link

@taniabarkovskya taniabarkovskya left a comment

Choose a reason for hiding this comment

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

you did good job and interesting solution ( I really like it :) )
but please fix some task requirements and make it perfect! 🚀

Comment on lines +26 to +34
<NavLink
aria-current="page"
className="navbar-item has-background-grey-lighter"
href="#/people"
className={({ isActive }) =>
cn('navbar-item', isTabActive({ isActive }))
}
to="people"
>
People
</a>
</NavLink>

Choose a reason for hiding this comment

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

here you forgot to add this. make sure to do this here and in all People link in table

"Keep search params when navigating within the People page (when selecting a person or clicking the People link)."

Comment on lines 8 to 15
const query = searchParams.get('query') || '';

const handleQuery = (event: React.ChangeEvent<HTMLInputElement>) => {
const params = new URLSearchParams(searchParams);

params.set('query', event.target.value);
setSearchParams(params);
};

Choose a reason for hiding this comment

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

you need to make sure, that if query is empty, it should be deleted from searchParams

Comment on lines 17 to 26
const handleGenderChange = (
gender: Sex,
event: React.MouseEvent<HTMLAnchorElement, MouseEvent>,
) => {
event.preventDefault();
const params = new URLSearchParams(searchParams);

params.set('sex', gender);
setSearchParams(params);
};

Choose a reason for hiding this comment

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

and for sex as well as for query - empty parameter should not be in search params

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 your implementation! 🎉 Your code meets the task requirements and constraints effectively. While there are a few minor issues related to routing and sorting logic, they don't significantly impact the overall functionality. Keep up the good work, and consider addressing these minor points to further enhance your code. Happy coding! 😊

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

Comment on lines +93 to +96
case 'born':
case 'died':
const result3 = filteredPeople.sort((person1, person2) => {
return person1.born - person2.born;

Choose a reason for hiding this comment

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

The sorting logic for 'born' and 'died' cases is currently identical, both sorting by 'born'. If you intend to sort by 'died' as well, you should adjust the logic to compare 'person1.died - person2.died' for the 'died' case.

@@ -32,9 +112,14 @@ export const PeopleTable = () => {
<th>
<span className="is-flex is-flex-wrap-nowrap">
Born
<a href="#/people?sort=born&amp;order=desc">
<a
href="#/people?sort=born&amp;order=desc"

Choose a reason for hiding this comment

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

The href attribute in the 'Born' column header includes &amp;order=desc, which might not be necessary since the handleSortByCategory function manages the order state. Consider removing it to avoid potential confusion.

Comment on lines +23 to +24
<Route path="people" element={<PeoplePage />}>
<Route path=":slug?" element={<PeoplePage />} />

Choose a reason for hiding this comment

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

The nested route <Route path=":slug?" element={<PeoplePage />} /> inside the people route might cause the PeoplePage component to render twice when a slug is present. Consider reviewing the routing logic to ensure the component is rendered as intended.

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