« get me outta code hell

content: generateTrackInfoPage: simpler reverse ref list layout - 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-06-12 13:33:32 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-06-18 22:56:08 -0300
commit70fe734841a7e95f7d7959f1d74d74abe5a1fd31 (patch)
tree2cf49ada3867f4a6dc3acc7a7c1564d614f14239
parentefbe6ce31006cdb76e5b1c2b4129d83f26f4ae5b (diff)
content: generateTrackInfoPage: simpler reverse ref list layout
-rw-r--r--src/content/dependencies/generateTrackInfoPage.js38
1 files changed, 15 insertions, 23 deletions
diff --git a/src/content/dependencies/generateTrackInfoPage.js b/src/content/dependencies/generateTrackInfoPage.js
index fed073e6..336cebbb 100644
--- a/src/content/dependencies/generateTrackInfoPage.js
+++ b/src/content/dependencies/generateTrackInfoPage.js
@@ -112,25 +112,17 @@ export default {
 
     // Section: Tracks that reference
 
-    if (!empty(track.referencedByTracks)) {
-      const referencedBy = sections.referencedBy = {};
-
-      referencedBy.list =
-        relation('generateTrackListDividedByGroups',
-          track.referencedByTracks,
-          sprawl.divideTrackListsByGroups);
-    }
+    relations.referencedByTracksList =
+      relation('generateTrackListDividedByGroups',
+        track.referencedByTracks,
+        sprawl.divideTrackListsByGroups);
 
     // Section: Tracks that sample
 
-    if (!empty(track.sampledByTracks)) {
-      const sampledBy = sections.sampledBy = {};
-
-      sampledBy.list =
-        relation('generateTrackListDividedByGroups',
-          track.sampledByTracks,
-          sprawl.divideTrackListsByGroups);
-    }
+    relations.sampledByTracksList =
+      relation('generateTrackListDividedByGroups',
+        track.sampledByTracks,
+        sprawl.divideTrackListsByGroups);
 
     // Section: Flashes that feature
 
@@ -321,7 +313,7 @@ export default {
             relations.sampledTracksList,
           ]),
 
-          sec.referencedBy && [
+          html.tags([
             relations.contentHeading.clone()
               .slots({
                 attributes: {id: 'referenced-by'},
@@ -335,16 +327,16 @@ export default {
                   language.$('releaseInfo.tracksThatReference.sticky'),
               }),
 
-            sec.referencedBy.list
+            relations.referencedByTracksList
               .slots({
                 headingString: 'releaseInfo.tracksThatReference',
               }),
-          ],
+          ]),
 
-          sec.sampledBy && [
+          html.tags([
             relations.contentHeading.clone()
               .slots({
-                attributes: {id: 'referenced-by'},
+                attributes: {id: 'sampled-by'},
 
                 title:
                   language.$('releaseInfo.tracksThatSample', {
@@ -355,11 +347,11 @@ export default {
                   language.$('releaseInfo.tracksThatSample.sticky'),
               }),
 
-            sec.sampledBy.list
+            relations.sampledByTracksList
               .slots({
                 headingString: 'releaseInfo.tracksThatSample',
               }),
-          ],
+          ]),
 
           sec.flashesThatFeature && [
             relations.contentHeading.clone()