« get me outta code hell

data: Track.needsLyrics - 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>2025-08-23 15:23:12 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-08-23 15:23:12 -0300
commit71df79dd12516b97a5ccaa8dc82c139c1747138a (patch)
treee4cdd23bbc73bc7a4ae163cda43aef7d5924221f
parentcc808943c239744e936c0b0e7f16a9abb2e8115c (diff)
data: Track.needsLyrics
-rw-r--r--src/data/things/content.js4
-rw-r--r--src/data/things/track.js32
2 files changed, 35 insertions, 1 deletions
diff --git a/src/data/things/content.js b/src/data/things/content.js
index d2cf32dc..a3dfc183 100644
--- a/src/data/things/content.js
+++ b/src/data/things/content.js
@@ -187,6 +187,10 @@ export class LyricsEntry extends ContentEntry {
       part: input.value('wiki lyrics'),
     }),
 
+    helpNeeded: hasAnnotationPart({
+      part: input.value('help needed'),
+    }),
+
     hasSquareBracketAnnotations: [
       withHasAnnotationPart({
         part: input.value('wiki lyrics'),
diff --git a/src/data/things/track.js b/src/data/things/track.js
index 18faebc3..da6b3227 100644
--- a/src/data/things/track.js
+++ b/src/data/things/track.js
@@ -22,7 +22,7 @@ import {
   parseLyrics,
 } from '#yaml';
 
-import {withPropertyFromObject} from '#composite/data';
+import {withPropertyFromList, withPropertyFromObject} from '#composite/data';
 
 import {
   exitWithoutDependency,
@@ -245,6 +245,32 @@ export class Track extends Thing {
       exposeDependency({dependency: '#album.color'}),
     ],
 
+    needsLyrics: [
+      exposeUpdateValueOrContinue({
+        mode: input.value('falsy'),
+        validate: input.value(isBoolean),
+      }),
+
+      exitWithoutDependency({
+        dependency: 'lyrics',
+        mode: input.value('empty'),
+        value: input.value(false),
+      }),
+
+      withPropertyFromList({
+        list: 'lyrics',
+        property: input.value('helpNeeded'),
+      }),
+
+      {
+        dependencies: ['#lyrics.helpNeeded'],
+        compute: ({
+          ['#lyrics.helpNeeded']: helpNeeded,
+        }) =>
+          helpNeeded.includes(true)
+      },
+    ],
+
     urls: urls(),
 
     // > Update & expose - Artworks
@@ -574,6 +600,10 @@ export class Track extends Thing {
 
       'Color': {property: 'color'},
 
+      'Needs Lyrics': {
+        property: 'needsLyrics',
+      },
+
       'URLs': {property: 'urls'},
 
       // Artworks