« get me outta code hell

search, client: album results - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-05-13 09:43:30 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-05-31 12:11:52 -0300
commit3a1aa3d7232ba24725b1b9215c296747bb8b242c (patch)
treef67e10d5416f2a493f67d4d61f55394a15bb5d10
parent8019e8957ebd94bd53bf35002c24aa2dcdbe65c5 (diff)
search, client: album results
-rw-r--r--src/content/dependencies/generateSearchSidebarBox.js3
-rw-r--r--src/static/js/client.js14
-rw-r--r--src/strings-default.yaml1
-rw-r--r--src/util/search-spec.js8
4 files changed, 26 insertions, 0 deletions
diff --git a/src/content/dependencies/generateSearchSidebarBox.js b/src/content/dependencies/generateSearchSidebarBox.js
index 796cfe28..22c5c773 100644
--- a/src/content/dependencies/generateSearchSidebarBox.js
+++ b/src/content/dependencies/generateSearchSidebarBox.js
@@ -29,6 +29,9 @@ export default {
         html.tag('template', {class: 'wiki-search-end-search-string'},
           language.$('misc.search.endSearch')),
 
+        html.tag('template', {class: 'wiki-search-album-result-kind-string'},
+          language.$('misc.search.resultKind.album')),
+
         html.tag('template', {class: 'wiki-search-artist-result-kind-string'},
           language.$('misc.search.resultKind.artist')),
 
diff --git a/src/static/js/client.js b/src/static/js/client.js
index ceaec460..dab1ea37 100644
--- a/src/static/js/client.js
+++ b/src/static/js/client.js
@@ -3590,6 +3590,7 @@ const sidebarSearchInfo = initInfo('sidebarSearchInfo', {
   currentResultString: null,
   endSearchString: null,
 
+  albumResultKindString: null,
   artistResultKindString: null,
   groupResultKindString: null,
 
@@ -3632,6 +3633,9 @@ function getSidebarSearchReferences() {
   info.endSearchString =
     findString('end-search');
 
+  info.albumResultKindString =
+    findString('album-result-kind');
+
   info.artistResultKindString =
     findString('artist-result-kind');
 
@@ -3844,6 +3848,16 @@ function generateSidebarSearchResult(result) {
   };
 
   switch (result.referenceType) {
+    case 'album': {
+      preparedSlots.href =
+        openAlbum(result.directory);
+
+      preparedSlots.kindString =
+        info.albumResultKindString;
+
+      break;
+    }
+
     case 'artist': {
       preparedSlots.href =
         openArtist(result.directory);
diff --git a/src/strings-default.yaml b/src/strings-default.yaml
index a06882c1..23f67ce6 100644
--- a/src/strings-default.yaml
+++ b/src/strings-default.yaml
@@ -630,6 +630,7 @@ misc:
     endSearch: "(OK, I'm done searching now.)"
 
     resultKind:
+      album: "(album)"
       artist: "(artist)"
       group: "(group)"
 
diff --git a/src/util/search-spec.js b/src/util/search-spec.js
index 5aba2194..f9d2a035 100644
--- a/src/util/search-spec.js
+++ b/src/util/search-spec.js
@@ -2,6 +2,14 @@
 
 function getArtworkPath(thing) {
   switch (thing.constructor[Symbol.for('Thing.referenceType')]) {
+    case 'album': {
+      return [
+        'media.albumCover',
+        thing.directory,
+        thing.coverArtFileExtension,
+      ];
+    }
+
     case 'flash': {
       return [
         'media.flashArt',