« get me outta code hell

content, client: generalize "random pages" listing to wiki dividing groups - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/listRandomPageLinks.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-10-29 09:27:23 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-10-29 09:27:23 -0300
commitc59545f5faafc826ff24ff779c20318ef14ae123 (patch)
treefeeef4bb5b14e63448f7e39d64480aba23d59c00 /src/content/dependencies/listRandomPageLinks.js
parentbfa1953e79a562ee675940b7acc52b5b29d22d8f (diff)
content, client: generalize "random pages" listing to wiki dividing groups
Diffstat (limited to 'src/content/dependencies/listRandomPageLinks.js')
-rw-r--r--src/content/dependencies/listRandomPageLinks.js28
1 files changed, 9 insertions, 19 deletions
diff --git a/src/content/dependencies/listRandomPageLinks.js b/src/content/dependencies/listRandomPageLinks.js
index 43bf7dd..57ecb04 100644
--- a/src/content/dependencies/listRandomPageLinks.js
+++ b/src/content/dependencies/listRandomPageLinks.js
@@ -6,19 +6,16 @@ export default {
 
   extraDependencies: ['html', 'language', 'wikiData'],
 
-  sprawl({groupData}) {
-    return {groupData};
+  sprawl({wikiInfo}) {
+    return {wikiInfo};
   },
 
   query(sprawl, spec) {
-    const group = directory =>
-      sprawl.groupData.find(group => group.directory === directory);
-
     return {
       spec,
-      officialGroup: group('official'),
-      fandomGroup: group('fandom'),
-      beyondGroup: group('beyond'),
+
+      groups:
+        sprawl.wikiInfo.divideTrackListsByGroups,
     };
   },
 
@@ -26,14 +23,9 @@ export default {
     return {
       page: relation('generateListingPage', query.spec),
 
-      officialSection:
-        relation('generateListRandomPageLinksGroupSection', query.officialGroup),
-
-      fandomSection:
-        relation('generateListRandomPageLinksGroupSection', query.fandomGroup),
-
-      beyondSection:
-        relation('generateListRandomPageLinksGroupSection', query.beyondGroup),
+      groupSections:
+        query.groups
+          .map(group => relation('generateListRandomPageLinksGroupSection', group)),
     };
   },
 
@@ -81,9 +73,7 @@ export default {
                   language.$('listingPage.other.randomPages.misc.randomTrackWholeSite'))),
             ])),
 
-          relations.officialSection,
-          relations.fandomSection,
-          relations.beyondSection,
+          relations.groupSections,
         ]),
       ],
     });