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

Sorted filter checkboxes in alphabet order in materials page #516

Conversation

NabokinAlexandr
Copy link
Collaborator

No description provided.

@NabokinAlexandr NabokinAlexandr added bug Something isn't working frontend Tasks for React team labels Aug 12, 2021
sortBy: string | undefined = 'name',
): IDirection[] => {
return array?.sort((prev, current) => {
if (prev[sortBy] > current[sortBy]) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (prev[sortBy] > current[sortBy]) {
return prev[sortBy] - current[sortBy]

};
const translatedOrigin = { ...origin };
translatedOrigin.name = translations[origin.id] || origin.name;
return translatedOrigin;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This block of code is completely unreadable. Using let and do a conditional assignment is an antipattern.

I suggest at least leaving a comment describing what this does and leaving a @TODO comment for future refactoring.

}
const postTypes = useSelector(selectPostTypes);
const postTypesInPlural: IPostType[] = [];
let postTypesInPlural: IPostType[] = [];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here

}

const directions = useSelector(selectDirections);
let directionsInPlural: IDirection[] = [];
Copy link
Collaborator

Choose a reason for hiding this comment

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

And here

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@NabokinAlexandr NabokinAlexandr merged commit 90fb0be into develop Aug 12, 2021
@NabokinAlexandr NabokinAlexandr deleted the Sort-filter-checkboxes-in-alphabet-order-in-Materials-page branch August 12, 2021 19:37
NabokinAlexandr added a commit that referenced this pull request Aug 12, 2021
* fixed soring to material card (#498)

* fixed soring to material card

* fixTestSuite

* create error message (#499)

* bugFix #145 fix Authors cards are displayed on the 'Автори' page when all checkboxes are unmarked (#501)

* fix bug with items size and accord. arrow color (#500)

* bug fixed

* bugfix

* Fix items width acc to diff breakpoints

* bug fixed

* Update ScrollToTop component

* Fix responsiveness of the Main View page (#511)

* Move Pages directory (#512)

* Fix app crash in create video component (#517)

* Fixed formatDate

* fixed formatDate

* Sorted filter checkboxes in alphabet order in materials page (#516)

* bug fix

* removed sorting from origins and post types

* fixed according to comments in review

* Fix Materials page responsiveness (#513)

* fix: poslist responsiveness

* chore: move thene into new directory

* bugFix#171 changed link on TranslationPostPreviewCard.tsx (#515)

* bugFix#171 changed link on TranslationPostPreviewCard.tsx

* bugFix#171 changed link on TranslationPostPreviewCard.tsx

* bugFix#171 changed link on TranslationPostPreviewCard.tsx

* Bugfix #153 and #154 Fix filters on the author`s profile page when no materials is added by the user (#507)

* Fix filters when no materials is added by the user

* Refactor bugfix#153 and #154

Co-authored-by: 0shar0 <71778107+0shar0@users.noreply.github.com>
Co-authored-by: Valentyna Chudik <valentyna_chudik@ukr.net>
Co-authored-by: shedanny <shedanny23@gmail.com>
Co-authored-by: Danylo Shevchenko <60629098+shedanny@users.noreply.github.com>
Co-authored-by: michalenr <42828375+michalenr@users.noreply.github.com>
NabokinAlexandr added a commit that referenced this pull request Aug 13, 2021
* Develop to release

* Fix bug with posts by important image sort

* Fix origins, post types label names order, correct the post type label name

* fixed response with setPage

* Fixed styles in PostView component

* bugFix #157

Change copyright-text which dispayed on the footer

* change Footer.tsx allRightsReserved field

* add Link to ExpertPhotoDataCard (#495)

* #489 / remove text fields from carousel & link with post (#493)

* Implemented task

* fixed eslint warning

* removed obsolete tests

* Add ScrollToTop component (#492)

* changed variable materialLink (#491)

* Bugfix #155 redirecting in material's card (#490)

* created redirection in Material's card

* code optimization

* debugger removed

* fixed formatting

* fixed linter errors

* Fix Accordion component dispay (#488)

* Fix missing posts in MaterialView after navigating to it back. (#487)

* Fix missing posts in MaterialView after navigating to it back.

* Update src/old/modules/materials/components/MaterialsView.tsx

Co-authored-by: michalenr <42828375+michalenr@users.noreply.github.com>

* Changed back src/old/modules/materials/components/MaterialsView.tsx
because that changes broke code

Co-authored-by: michalenr <42828375+michalenr@users.noreply.github.com>

* Develop to Release (#521)

* fixed soring to material card (#498)

* fixed soring to material card

* fixTestSuite

* create error message (#499)

* bugFix #145 fix Authors cards are displayed on the 'Автори' page when all checkboxes are unmarked (#501)

* fix bug with items size and accord. arrow color (#500)

* bug fixed

* bugfix

* Fix items width acc to diff breakpoints

* bug fixed

* Update ScrollToTop component

* Fix responsiveness of the Main View page (#511)

* Move Pages directory (#512)

* Fix app crash in create video component (#517)

* Fixed formatDate

* fixed formatDate

* Sorted filter checkboxes in alphabet order in materials page (#516)

* bug fix

* removed sorting from origins and post types

* fixed according to comments in review

* Fix Materials page responsiveness (#513)

* fix: poslist responsiveness

* chore: move thene into new directory

* bugFix#171 changed link on TranslationPostPreviewCard.tsx (#515)

* bugFix#171 changed link on TranslationPostPreviewCard.tsx

* bugFix#171 changed link on TranslationPostPreviewCard.tsx

* bugFix#171 changed link on TranslationPostPreviewCard.tsx

* Bugfix #153 and #154 Fix filters on the author`s profile page when no materials is added by the user (#507)

* Fix filters when no materials is added by the user

* Refactor bugfix#153 and #154

Co-authored-by: 0shar0 <71778107+0shar0@users.noreply.github.com>
Co-authored-by: Valentyna Chudik <valentyna_chudik@ukr.net>
Co-authored-by: shedanny <shedanny23@gmail.com>
Co-authored-by: Danylo Shevchenko <60629098+shedanny@users.noreply.github.com>
Co-authored-by: michalenr <42828375+michalenr@users.noreply.github.com>

Co-authored-by: Valentyna-Chudik <valentyna_chudik@ukr.net>
Co-authored-by: Bohdan <bodiasharko@gmail.com>
Co-authored-by: 0shar0 <71778107+0shar0@users.noreply.github.com>
Co-authored-by: Danylo Shevchenko <60629098+shedanny@users.noreply.github.com>
Co-authored-by: michalenr <42828375+michalenr@users.noreply.github.com>
Co-authored-by: shedanny <shedanny23@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working frontend Tasks for React team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sort filter checkboxes in alphabet order in Materials page
2 participants