« get me outta code hell

client: stub interesting search internals - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/static/js/client.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-05-05 14:45:02 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-05-31 12:11:50 -0300
commitda951b7f18b8a67c60de96b1b506a1b1a825bbbd (patch)
tree4b0528d0b2d7d830e15dc20eb6bde49cc70306a8 /src/static/js/client.js
parentb76fdc3b5ef0ce800c78014bfb879a5acc0329a9 (diff)
client: stub interesting search internals
Diffstat (limited to 'src/static/js/client.js')
-rw-r--r--src/static/js/client.js26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/static/js/client.js b/src/static/js/client.js
index 560a0d36..d8828ad2 100644
--- a/src/static/js/client.js
+++ b/src/static/js/client.js
@@ -3696,16 +3696,15 @@ function showSidebarSearchResults(results) {
 
   const flatResults =
     Object.entries(results)
+      .filter(([index]) => index === 'generic')
       .flatMap(([index, results]) => results
-        .flatMap(({field, result}) => result
-          .flatMap(({doc, id}) => ({
-            index,
-            field,
-            reference: id ?? null,
-            referenceType: (id ? id.split(':')[0] : null),
-            directory: (id ? id.split(':')[1] : null),
-            data: doc,
-          }))));
+        .flatMap(({doc, id}) => ({
+          index,
+          reference: id ?? null,
+          referenceType: (id ? id.split(':')[0] : null),
+          directory: (id ? id.split(':')[1] : null),
+          data: doc,
+        })));
 
   while (info.results.firstChild) {
     info.results.firstChild.remove();
@@ -3714,8 +3713,6 @@ function showSidebarSearchResults(results) {
   cssProp(info.resultsContainer, 'display', 'block');
 
   for (const result of flatResults) {
-    if (result.index !== 'generic') continue;
-
     const el = generateSidebarSearchResult(result);
     if (!el) continue;
 
@@ -3743,6 +3740,13 @@ function generateSidebarSearchResult(result) {
       break;
     }
 
+    case 'artist': {
+      preparedSlots.href =
+        openArtist(result.directory);
+
+      break;
+    }
+
     default:
       return null;
   }