-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Website/sort and search #949
Website/sort and search #949
Conversation
Hmm. Not sure I agree with disabling the ability to sort when searching. I sometimes find myself searching for a subcategory (e.g. I'd prefer having the sorting how it is now (search update = fuzzy, then users can enable color/alphabetical sorting for the current matches) while reversing to whichever mode was enabled pre-search on empty searches (as you've done in this PR). It would be nice to be able to disable the color/alphabetical sorting to revert to fuzzy by clicking the enabled sorting mode, but that's a bit trickier. |
Alright, that could be possible. However, then what happens when I 1) searched for "goo", 2) order alphabetically, and finally 3) add "g" to my search query. Does it go back to fuzzy search or should it maintain the alphabetical search?
It would be indeed, but I think we should try to create a button (or something else?) to allow for this. If not in this PR, then in another one. |
When (or if) a button is created for going back to fuzzy search, the preferable way would probably be to have the sorting mode remembered when changing the search (and going back to whichever non-fuzzy mode was last chosen when the search empties while fuzzy is chosen), such that adding "g" would maintain the alphabetical sorting. Until then, I think reverting to fuzzy mode when the search updates is preferable to not being able to choose color/alphabetical sorting while searching. |
In that case I feel like a button for the "fuzzy sort ordering" is more or less a requirement... I've got a few options listed below:
Some things to note about how I would implement this:
|
As discussed in #949. Relatedly also removed the functionality that disabled the "sort by color" and "sort alphabetically" buttons (and related styling).
Refactored to sorting algorithms into a single function and updated relevant code. The "sort by relenvance" button is now functional, and is automatically actived when the user starts searching, but not when updating their search query.
Updated 😃 I also did some refactoring of the websites JavaScript. It's not perfect yet, but it makes the existing code a bit more readable |
👍 Sorry I haven't gotten around to testing this in the last few days. It's looking good, and functions great! Thanks for your work on this! |
Addresses the problem described in and closes #908
Previously, when there was a search query and you pressed on of the sort buttons (color or alphabetically), the search query was more or less forgotten. My solution is to disable the sort buttons when there is an active search query, as they're not relevant anyway. They're not relevant because we use a fuzzy search algorithm which orders the icons resulting from the search based on a scoring system. Note that when the search query is removed (i.e.
query === ""
) the ordering that was last active is used automatically.