Skip to content

Commit

Permalink
Fixed tag sorting on "Search" page
Browse files Browse the repository at this point in the history
  • Loading branch information
Bergbok committed Mar 13, 2024
1 parent 99ec44c commit a843e5d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CustomApps/playlist-tags/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "playlist-tags",
"version": "1.1.8",
"version": "1.1.9",
"private": true,
"scripts": {
"build": "spicetify-creator",
Expand Down
12 changes: 11 additions & 1 deletion CustomApps/playlist-tags/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,17 @@ const App = () => {
</div>
<div className='tag-list-wrapper'>
{
tagList.map((tag) => {
tagList.sort((a, b) => {
const a_in_filter = filterQuery.split(' ').includes(a);
const b_in_filter = filterQuery.split(' ').includes(b);
if (a_in_filter && !b_in_filter) {
return -1;
} else if (!a_in_filter && b_in_filter) {
return 1;
} else {
return 0;
}
}).map((tag) => {
const last_term: string = (filterQuery.split(' ').pop() as string) || '';
if (tag.includes(last_term)) {
return (
Expand Down

0 comments on commit a843e5d

Please sign in to comment.