« get me outta code hell

search, client: group results - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-05-13 09:30:28 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-05-31 12:11:52 -0300
commit8019e8957ebd94bd53bf35002c24aa2dcdbe65c5 (patch)
tree4e1a665037f4ad62dbd5f753a86140f590ea9fdf /src
parent05f4385dc72df17eea850fd27b4b77d7b4f6f840 (diff)
search, client: group results
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/generateSearchSidebarBox.js3
-rw-r--r--src/static/js/client.js15
-rw-r--r--src/strings-default.yaml1
-rw-r--r--src/util/search-spec.js3
4 files changed, 22 insertions, 0 deletions
diff --git a/src/content/dependencies/generateSearchSidebarBox.js b/src/content/dependencies/generateSearchSidebarBox.js
index 3758f209..796cfe28 100644
--- a/src/content/dependencies/generateSearchSidebarBox.js
+++ b/src/content/dependencies/generateSearchSidebarBox.js
@@ -31,6 +31,9 @@ export default {
 
         html.tag('template', {class: 'wiki-search-artist-result-kind-string'},
           language.$('misc.search.resultKind.artist')),
+
+        html.tag('template', {class: 'wiki-search-group-result-kind-string'},
+          language.$('misc.search.resultKind.group')),
       ],
     }),
 };
diff --git a/src/static/js/client.js b/src/static/js/client.js
index 5b762c49..ceaec460 100644
--- a/src/static/js/client.js
+++ b/src/static/js/client.js
@@ -197,6 +197,7 @@ const getLinkHref = (type, directory) => rebase(`${type}/${directory}`);
 const openAlbum = d => rebase(`album/${d}`);
 const openArtist = d => rebase(`artist/${d}`);
 const openFlash = d => rebase(`flash/${d}`);
+const openGroup = d => rebase(`group/${d}`);
 const openTrack = d => rebase(`track/${d}`);
 
 // TODO: This should also use urlSpec.
@@ -3590,6 +3591,7 @@ const sidebarSearchInfo = initInfo('sidebarSearchInfo', {
   endSearchString: null,
 
   artistResultKindString: null,
+  groupResultKindString: null,
 
   state: {
     stoppedTypingTimeout: null,
@@ -3632,6 +3634,9 @@ function getSidebarSearchReferences() {
 
   info.artistResultKindString =
     findString('artist-result-kind');
+
+  info.groupResultKindString =
+    findString('group-result-kind');
 }
 
 function mutateSidebarSearchContent() {
@@ -3849,6 +3854,16 @@ function generateSidebarSearchResult(result) {
       break;
     }
 
+    case 'group': {
+      preparedSlots.href =
+        openGroup(result.directory);
+
+      preparedSlots.kindString =
+        info.groupResultKindString;
+
+      break;
+    }
+
     case 'flash': {
       preparedSlots.href =
         openFlash(result.directory);
diff --git a/src/strings-default.yaml b/src/strings-default.yaml
index 7bc215b8..a06882c1 100644
--- a/src/strings-default.yaml
+++ b/src/strings-default.yaml
@@ -631,6 +631,7 @@ misc:
 
     resultKind:
       artist: "(artist)"
+      group: "(group)"
 
   # skippers:
   #
diff --git a/src/util/search-spec.js b/src/util/search-spec.js
index e9e0a6f9..5aba2194 100644
--- a/src/util/search-spec.js
+++ b/src/util/search-spec.js
@@ -83,6 +83,7 @@ export const searchSpec = {
       albumData,
       artistData,
       flashData,
+      groupData,
       trackData,
     }) => [
       albumData,
@@ -92,6 +93,8 @@ export const searchSpec = {
 
       flashData,
 
+      groupData,
+
       trackData
         // Exclude rereleases - there's no reasonable way to differentiate
         // them from the main release as part of this query.