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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

tania-kuzmenko
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.

Great job on implementing the task requirements! 🎉 The code is well-structured and meets the core functionality. While there are a few minor issues, such as the sorting logic and some error messages, they don't significantly impact the overall functionality. Consider addressing these minor points for future improvements. Keep up the good work! 😊

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

import { App } from './App';
import { PeopleProvider } from './store/PeopleContext';
import { HomePage } from './Pages/HomePage';
import { PeoplePage } from './components/PeoplePage';

Choose a reason for hiding this comment

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

The import path for PeoplePage should be ../components/PeoplePage instead of ./components/PeoplePage to match the file structure.

Comment on lines +21 to +27
switch (sex) {
case 'Male':
normalizedSex = 'm';
break;
case 'Female':
normalizedSex = 'f';
}

Choose a reason for hiding this comment

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

The switch statement does not have a default case. It's a good practice to include a default case to handle unexpected values, even if it's just to return the current state or log an error.

Comment on lines +32 to +34
{!isLoading && !errorMsg && filteredPeople.length === 0 && (
<p data-cy="noPeopleMessage">{errorMsg}</p>
)}

Choose a reason for hiding this comment

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

The condition for displaying the 'no people' message uses errorMsg, which might not be appropriate if there is no error but simply no people to display. Consider using a different message or condition to handle this case.

Comment on lines +9 to +11
function isPersonFemale(person: Person | undefined): boolean {
return person?.sex === 'f';
}

Choose a reason for hiding this comment

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

The isPersonFemale function checks if a person is female. It currently handles undefined by returning false, which is fine, but consider adding a comment to clarify this behavior for future maintainability.

const context = useContext(FilterContext);

if (!context) {
throw new Error('usePeopleContext must be used within a FilterProvider');

Choose a reason for hiding this comment

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

The error message in the useFilters hook should refer to 'FilterProvider' instead of 'usePeopleContext'. This seems to be a copy-paste error.

Comment on lines +62 to +63
if (valueA === null || valueB === null) {
return 0;

Choose a reason for hiding this comment

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

The sorting logic currently returns 0 if either valueA or valueB is null. This might not be the desired behavior if you want to handle null values differently, such as placing them at the end of the list. Consider adjusting this logic if needed.

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