« get me outta code hell

search, client: custom display for results w/ artwork warnings - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-05-13 09:18:15 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-05-31 12:11:52 -0300
commit685cbad73cab59210f7f8842e4399d0550f03905 (patch)
treed27578ce708ae6a8be078341ccece5020b5c46e5 /src/util
parentfa0b2b56ec1d69d4c74918ca587f572bb4a9e1d0 (diff)
search, client: custom display for results w/ artwork warnings
Diffstat (limited to 'src/util')
-rw-r--r--src/util/search-spec.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/util/search-spec.js b/src/util/search-spec.js
index 6c6ad221..e9e0a6f9 100644
--- a/src/util/search-spec.js
+++ b/src/util/search-spec.js
@@ -39,6 +39,9 @@ function prepareArtwork(thing, {
   getThumbnailEqualOrSmaller,
   urls,
 }) {
+  const hasWarnings =
+    thing.artTags?.some(artTag => artTag.isContentWarning);
+
   const artworkPath =
     getArtworkPath(thing);
 
@@ -56,7 +59,9 @@ function prepareArtwork(thing, {
   }
 
   const selectedSize =
-    getThumbnailEqualOrSmaller('adorb', mediaSrc);
+    getThumbnailEqualOrSmaller(
+      (hasWarnings ? 'mini' : 'adorb'),
+      mediaSrc);
 
   const mediaSrcJpeg =
     mediaSrc.replace(/\.(png|jpg)$/, `.${selectedSize}.jpg`);