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

first try #605

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

first try #605

wants to merge 3 commits into from

Conversation

Ayogoharo
Copy link

Copy link

@tilugdmytro tilugdmytro 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! Everything works as expected

Copy link

@vmiskiv vmiskiv left a comment

Choose a reason for hiding this comment

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

Overall looks fine but need to add some changes

<a className="is-active" href="#/people">All</a>
<a className="" href="#/people?sex=m">Male</a>
<a className="" href="#/people?sex=f">Female</a>
<SearchLink
Copy link

Choose a reason for hiding this comment

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

You could map the search links

Comment on lines 63 to 68
setSearchParams(
getSearchWith(
searchParams,
(event.target.value.trim())
? { query: event.target.value.trim().toLocaleLowerCase() }
: { query: null },
Copy link

Choose a reason for hiding this comment

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

Would be better to move the logic separately in a handle function

const [error, setError] = useState(false);
const [isLoading, setIsLoading] = useState(false);

// const [people, setPeople] = useState(peopleFromServer);
Copy link

Choose a reason for hiding this comment

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

Don't forget to remove commented out lines


// #region getVisiblePeople

let visiblePeople = [...peopleFromServer];
Copy link

@vmiskiv vmiskiv Nov 22, 2023

Choose a reason for hiding this comment

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

Should be used a separate function to filter and sort from line 45 to line 89 which will return a filtered array

<p>There are no people matching the current search criteria</p>

<PeopleTable />
{(() => {
Copy link

Choose a reason for hiding this comment

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

Immediately invoked function with switch case using directly in JSX decrease readability. It would be better to use conditional rendering here. It is much more simplify and readable

@Ayogoharo Ayogoharo requested a review from vmiskiv November 28, 2023 19:12
Copy link

@StasSokolov StasSokolov 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 to me, only one minor comment🔥

if (sort) {
result.sort((a, b) => {
switch (sort) {
case 'name':

Choose a reason for hiding this comment

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

will be better create enum for types and reuse

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