« get me outta code hell

content: sprawl divideTrackListsByGroups - 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>2023-05-26 10:09:16 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-05-26 10:09:16 -0300
commit6efb1212dd643dc98e71e272a1a66f042884edb9 (patch)
treeadc250ac6fc8941a48ddd1c1f1e7d641c9fdac7f
parentf8ca7148d52d656506862bf5c89f4a00a3805534 (diff)
content: sprawl divideTrackListsByGroups
...Instead of tangling it in from generateTrackInfoPage, page/track.js,
and top-level page evaluation itself. This is why sprawling is better!
-rw-r--r--src/content/dependencies/generateTrackInfoPage.js4
-rw-r--r--src/content/dependencies/generateTrackInfoPageContent.js7
-rw-r--r--src/page/track.js6
-rw-r--r--src/write/bind-utilities.js6
-rw-r--r--src/write/build-modes/live-dev-server.js2
5 files changed, 9 insertions, 16 deletions
diff --git a/src/content/dependencies/generateTrackInfoPage.js b/src/content/dependencies/generateTrackInfoPage.js
index 61b2b165..5900b27e 100644
--- a/src/content/dependencies/generateTrackInfoPage.js
+++ b/src/content/dependencies/generateTrackInfoPage.js
@@ -16,7 +16,7 @@ export default {
 
   extraDependencies: ['language'],
 
-  relations(relation, track, {topLevelGroups}) {
+  relations(relation, track) {
     return {
       layout: relation('generatePageLayout'),
 
@@ -57,7 +57,7 @@ export default {
       albumNavLinks: relation('generateAlbumNavLinks', track.album, track),
       chronologyLinks: relation('generateChronologyLinks'),
 
-      content: relation('generateTrackInfoPageContent', track, {topLevelGroups}),
+      content: relation('generateTrackInfoPageContent', track),
       sidebar: relation('generateAlbumSidebar', track.album, track),
       albumStyleRules: relation('generateAlbumStyleRules', track.album),
       colorStyleRules: relation('generateColorStyleRules', track.color),
diff --git a/src/content/dependencies/generateTrackInfoPageContent.js b/src/content/dependencies/generateTrackInfoPageContent.js
index ed2662e6..c3a1c051 100644
--- a/src/content/dependencies/generateTrackInfoPageContent.js
+++ b/src/content/dependencies/generateTrackInfoPageContent.js
@@ -19,11 +19,12 @@ export default {
 
   sprawl({wikiInfo}) {
     return {
+      divideTrackListsByGroups: wikiInfo.divideTrackListsByGroups,
       enableFlashesAndGames: wikiInfo.enableFlashesAndGames,
     };
   },
 
-  relations(relation, sprawl, track, {topLevelGroups}) {
+  relations(relation, sprawl, track) {
     const {album} = track;
 
     const relations = {};
@@ -126,7 +127,7 @@ export default {
       referencedBy.list =
         relation('generateTrackListDividedByGroups',
           track.referencedByTracks,
-          topLevelGroups);
+          sprawl.divideTrackListsByGroups);
     }
 
     // Section: Sampled tracks
@@ -152,7 +153,7 @@ export default {
       sampledBy.list =
         relation('generateTrackListDividedByGroups',
           track.sampledByTracks,
-          topLevelGroups);
+          sprawl.divideTrackListsByGroups);
     }
 
     // Section: Flashes that feature
diff --git a/src/page/track.js b/src/page/track.js
index 9b3867c9..e75b6958 100644
--- a/src/page/track.js
+++ b/src/page/track.js
@@ -6,7 +6,7 @@ export function targets({wikiData}) {
   return wikiData.trackData;
 }
 
-export function pathsForTarget(track, {wikiInfo}) {
+export function pathsForTarget(track) {
   return [
     {
       type: 'page',
@@ -14,9 +14,7 @@ export function pathsForTarget(track, {wikiInfo}) {
 
       contentFunction: {
         name: 'generateTrackInfoPage',
-        args: [track, {
-          topLevelGroups: wikiInfo.divideTrackListsByGroups,
-        }],
+        args: [track],
       },
     },
   ];
diff --git a/src/write/bind-utilities.js b/src/write/bind-utilities.js
index a31e02f7..d6053353 100644
--- a/src/write/bind-utilities.js
+++ b/src/write/bind-utilities.js
@@ -106,12 +106,6 @@ export function bindUtilities({
     language,
   });
 
-  bound.generateTrackListDividedByGroups = bindOpts(generateTrackListDividedByGroups, {
-    html,
-    language,
-    wikiData,
-  });
-
   bound.getGridHTML = bindOpts(getGridHTML, {
     [bindOpts.bindIndex]: 0,
     img: bound.img,
diff --git a/src/write/build-modes/live-dev-server.js b/src/write/build-modes/live-dev-server.js
index d4b7472d..3cd3ed6b 100644
--- a/src/write/build-modes/live-dev-server.js
+++ b/src/write/build-modes/live-dev-server.js
@@ -102,7 +102,7 @@ export async function go({
     }) => () =>
       targetless
         ? [pageSpec.writeTargetless({wikiData})]
-        : pageSpec.pathsForTarget(target, {wikiInfo: wikiData.wikiInfo}))).flat();
+        : pageSpec.pathsForTarget(target))).flat();
 
   logInfo`Will be serving a total of ${pages.length} pages.`;