« get me outta code hell

content, client: memorable details, collapsed crediting/ref sources - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateFlashInfoPage.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-10-06 15:23:25 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-10-06 15:23:25 -0300
commit6a99486d361b1fb8af6be08cb9c1adbbcd0b0e8f (patch)
tree21e457e2a3b168c6e257c8f5209aef3be89ad508 /src/content/dependencies/generateFlashInfoPage.js
parentf820d83e94cf014e34857c69598261680c72329c (diff)
content, client: memorable details, collapsed crediting/ref sources preview
Diffstat (limited to 'src/content/dependencies/generateFlashInfoPage.js')
-rw-r--r--src/content/dependencies/generateFlashInfoPage.js44
1 files changed, 25 insertions, 19 deletions
diff --git a/src/content/dependencies/generateFlashInfoPage.js b/src/content/dependencies/generateFlashInfoPage.js
index a7c23eae..effc07ff 100644
--- a/src/content/dependencies/generateFlashInfoPage.js
+++ b/src/content/dependencies/generateFlashInfoPage.js
@@ -1,11 +1,24 @@
 import {empty} from '#sugar';
 
+function checkInterrupted(which, relations, {html}) {
+  if (
+    !html.isBlank(relations.contributorContributionList) ||
+    !html.isBlank(relations.featuredTracksList)
+  ) return true;
+
+  if (which === 'crediting-sources') {
+    if (!html.isBlank(relations.artistCommentaryEntries)) return true;
+  }
+
+  return false;
+}
+
 export default {
   contentDependencies: [
     'generateAdditionalNamesBox',
+    'generateCollapsedContentEntrySection',
     'generateCommentaryEntry',
     'generateCommentaryContentHeading',
-    'generateContentContentHeading',
     'generateContentHeading',
     'generateContributionList',
     'generateFlashActSidebar',
@@ -56,9 +69,6 @@ export default {
     contentHeading:
       relation('generateContentHeading'),
 
-    contentContentHeading:
-      relation('generateContentContentHeading', flash),
-
     commentaryContentHeading:
       relation('generateCommentaryContentHeading', flash),
 
@@ -81,9 +91,10 @@ export default {
       flash.commentary
         .map(entry => relation('generateCommentaryEntry', entry)),
 
-    creditSourceEntries:
-      flash.creditingSources
-        .map(entry => relation('generateCommentaryEntry', entry)),
+    creditingSourcesSection:
+      relation('generateCollapsedContentEntrySection',
+        flash.creditingSources,
+        flash),
   }),
 
   data: (_query, flash) => ({
@@ -135,11 +146,11 @@ export default {
             {[html.joinChildren]: html.tag('br')},
 
             language.encapsulate('releaseInfo', capsule => [
-              (!html.isBlank(relations.contributorContributionList) ||
-               !html.isBlank(relations.featuredTracksList)) &&
+              checkInterrupted('commentary', relations, {html}) &&
                 relations.readCommentaryLine,
 
-              !html.isBlank(relations.creditSourceEntries) &&
+              checkInterrupted('crediting-sources', relations, {html}) &&
+              !html.isBlank(relations.creditingSourcesSection) &&
                 language.encapsulate(capsule, 'readCreditingSources', capsule =>
                   language.$(capsule, {
                     link:
@@ -179,15 +190,10 @@ export default {
             relations.artistCommentaryEntries,
           ]),
 
-          html.tags([
-            relations.contentContentHeading.clone()
-              .slots({
-                attributes: {id: 'crediting-sources'},
-                string: 'misc.creditingSources',
-              }),
-
-            relations.creditSourceEntries,
-          ]),
+          relations.creditingSourcesSection.slots({
+            id: 'crediting-sources',
+            string: 'misc.creditingSources',
+          }),
         ],
 
         navLinkStyle: 'hierarchical',