« get me outta code hell

search, client: basic flash search 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 08:30:45 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-05-31 12:11:51 -0300
commit4fbc81726b14ee34a7f85ce013df8f8b1f1797be (patch)
tree63e5510989c67dbee0f62504e96d889f15f8de48
parent0d6d23925df8800f4ab0f8e1d3eac1401fb64a6f (diff)
search, client: basic flash search results
-rw-r--r--src/static/js/client.js28
-rw-r--r--src/util/search-spec.js4
2 files changed, 25 insertions, 7 deletions
diff --git a/src/static/js/client.js b/src/static/js/client.js
index 97a046e5..771d2011 100644
--- a/src/static/js/client.js
+++ b/src/static/js/client.js
@@ -194,9 +194,10 @@ function getVisuallyContainingElement(child) {
 const getLinkHref = (type, directory) => rebase(`${type}/${directory}`);
 */
 
-const openAlbum = (d) => rebase(`album/${d}`);
-const openTrack = (d) => rebase(`track/${d}`);
-const openArtist = (d) => rebase(`artist/${d}`);
+const openAlbum = d => rebase(`album/${d}`);
+const openArtist = d => rebase(`artist/${d}`);
+const openFlash = d => rebase(`flash/${d}`);
+const openTrack = d => rebase(`track/${d}`);
 
 // TODO: This should also use urlSpec.
 
@@ -3831,16 +3832,23 @@ function generateSidebarSearchResult(result) {
   };
 
   switch (result.referenceType) {
-    case 'track': {
+    case 'artist': {
       preparedSlots.href =
-        openTrack(result.directory);
+        openArtist(result.directory);
 
       break;
     }
 
-    case 'artist': {
+    case 'flash': {
       preparedSlots.href =
-        openArtist(result.directory);
+        openFlash(result.directory);
+
+      break;
+    }
+
+    case 'track': {
+      preparedSlots.href =
+        openTrack(result.directory);
 
       break;
     }
@@ -3860,6 +3868,12 @@ function getSearchResultImageSource(result) {
   const [kind, ...opts] = artwork;
 
   switch (kind) {
+    case 'flash':
+      return rebase(
+        ('flash-art'
+       + `/${result.directory}.small.jpg`),
+        'rebaseThumb');
+
     case 'track':
       return rebase(
         (`album-art`
diff --git a/src/util/search-spec.js b/src/util/search-spec.js
index de71776c..08717d92 100644
--- a/src/util/search-spec.js
+++ b/src/util/search-spec.js
@@ -2,6 +2,10 @@
 
 function prepareArtwork(thing) {
   switch (thing.constructor[Symbol.for('Thing.referenceType')]) {
+    case 'flash': {
+      return ['flash', thing.coverArtFileExtension];
+    }
+
     case 'track': {
       if (thing.hasUniqueCoverArt) {
         if (thing.coverArtFileExtension === 'gif')