Sort add card views alphabetically #816

Merged
a22erigr merged 3 commits from 603-sort-cards-alphabetically into team_2_week_5 2026-05-08 11:14:00 +00:00
Collaborator

This PR adds automatic alphabetical sorting for cards in the Add Card modal.

Changes:

Added alphabetical sorting using localeCompare
Sorting is now applied automatically before rendering the card list
Newly added cards will automatically appear in alphabetical order

This PR adds automatic alphabetical sorting for cards in the Add Card modal. Changes: Added alphabetical sorting using localeCompare Sorting is now applied automatically before rendering the card list Newly added cards will automatically appear in alphabetical order
a22erigr 2026-05-07 13:23:16 +00:00
b24idalu requested changes 2026-05-07 13:52:48 +00:00
Dismissed
b24idalu left a comment
Collaborator

Review on #816

Whats done

Added automatic alphabetical sorting for cards in the Add Card modal.

Tested on Windows using Chrome & Firefox

  • App starts
    • Tested loading the addcards modal, cards appeared in alphabetical order.

Inspected following files

  • frontend/src/features/addCardModal/AddCardModal.js
    • Indentation/code styling
      • Looks good
    • Naming convention
      • Using a and b could be a bit unclear, would be better with for example viewA and viewB
    • Comments
      • Comment is good.
    • General code quality
      • Not sure slice() is needed.

What needs to be done

  • frontend/src/features/addCardModal/AddCardModal.js
    • Remove slice()
    • Change from a,b to viewA,viewB

Conclusion

  • Almost ready to merge.
  • Unsure what slice() does in this regard, tried removing it and it looked like it still worked.
# Review on #816 ## Whats done Added automatic alphabetical sorting for cards in the Add Card modal. ### Tested on Windows using Chrome & Firefox + App starts + Tested loading the addcards modal, cards appeared in alphabetical order. ### Inspected following files + frontend/src/features/addCardModal/AddCardModal.js + Indentation/code styling + Looks good + Naming convention + Using a and b could be a bit unclear, would be better with for example viewA and viewB + Comments + Comment is good. + General code quality + Not sure slice() is needed. ## What needs to be done + frontend/src/features/addCardModal/AddCardModal.js + Remove slice() + Change from a,b to viewA,viewB ## Conclusion + Almost ready to merge. + Unsure what slice() does in this regard, tried removing it and it looked like it still worked.
Collaborator

@b25marem Can you fix the changes @b24idalu suggested before i merge?

@b25marem Can you fix the changes @b24idalu suggested before i merge?
Author
Collaborator

Thanks for the review.

The reason I originally used slice() was to create a copy of the array before sorting, since .sort() mutates the original array directly. This is often used as a safer approach in React to avoid modifying props unintentionally.

However, since the current implementation works fine without it and to keep the code simpler, I removed slice() as suggested.

I also renamed the sorting variables from a and b to viewA and viewB for better readability.

Thanks for the review. The reason I originally used slice() was to create a copy of the array before sorting, since .sort() mutates the original array directly. This is often used as a safer approach in React to avoid modifying props unintentionally. However, since the current implementation works fine without it and to keep the code simpler, I removed slice() as suggested. I also renamed the sorting variables from a and b to viewA and viewB for better readability.
b24idalu requested changes 2026-05-08 08:24:53 +00:00
Dismissed
b24idalu left a comment
Collaborator

Looks good, changes has been applied and everything still works good.
Did not know that slice() makes things safer, could be good for future implementations if that is the case even though it currently works without.
Ready to be merged after adding it back.

Looks good, changes has been applied and everything still works good. Did not know that slice() makes things safer, could be good for future implementations if that is the case even though it currently works without. Ready to be merged after adding it back.
b24idalu approved these changes 2026-05-08 11:11:08 +00:00
b24idalu left a comment
Collaborator

Looks good, is ready to be merged

Looks good, is ready to be merged
a22erigr merged commit 847ce517b9 into team_2_week_5 2026-05-08 11:14:00 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Andras/BoundlessFlowCampus2K!816
No description provided.