Lissy93 / dashy

🚀 A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!
https://dashy.to
MIT License
18.15k stars 1.37k forks source link

[FEATURE_REQUEST] Allow case insensitive alphabetical sorting #352

Closed BOZG closed 2 years ago

BOZG commented 2 years ago

Is your feature request related to a problem? If so, please describe.

Choosing "alphabetical" as the "Sort by" option is case sensitive meaning that 'A' and 'a' are not sorted together.

Describe the solution you'd like

If feasible, an option to ignore case sensitivity when sorting alphabetically would be nice. Just making sorting case insensitive doesn't strike me as an alternative as I'm sure there are others out there who prefer sorting as it is.

This is obviously a very personal peeve and easily mitigated by me renaming services so I don't expect it to be a priority in any way.

Priority

Low (Nice-to-have)

Is this something you would be keen to implement

No response

Lissy93 commented 2 years ago

Hiya @BOZG - Thanks for your suggestion :) I agree, it would make more sense for sorting to be non-case sensitive. It was probably a mistake that it isn't currently case sensitive, and I hadn't noticed since all my links start with a capital. I will implement the change this week, and update you here when done :)

liss-bot commented 2 years ago

This issue has been marked as a good first issue for first-time contributors to implement! This is a great way to support the project, while also improving your skills, you'll also be credited as a contributor once your PR is merged. If you're new to web development, here are a collection of resources to help you get started. You can also find step-by-step tutorials for common tasks within Dashy, on the Dev Guides page. If you need any support at all, feel free to reach out via GitHub Discussions.


I am a bot, and this is an automated message 🤖

Lissy93 commented 2 years ago

I can make this change either later this evening, or tomorrow. Unless anyone else would like to pick it up, this should be a pretty easy task to implement, sorting is done within the Section component:

https://github.com/Lissy93/dashy/blob/2032481980949c8451a8a167412bfd621be4c706/src/components/LinkItems/Section.vue#L196-L199

So using toLowerCase() within the sort function should mean titles can be effectively compared. Something like this:

sortAlphabetically(items) {
  return items.sort((a, b) => (a.title.toLowerCase() > b.title.toLowerCase() ? 1 : -1));
},

The reverse-alphabetical sort uses the same method, and then just reverses the order, so the change is only needed in one place.

Lissy93 commented 2 years ago

Implemented in #354 :)