« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/generateFlashIndexPage.js29
-rw-r--r--src/content/dependencies/generateFlashInfoPage.js38
-rw-r--r--src/content/dependencies/listAllMidiProjectFiles.js28
-rw-r--r--src/content/dependencies/listAllSheetMusicFiles.js28
-rw-r--r--src/content/dependencies/listRandomPageLinks.js28
-rw-r--r--src/listing-spec.js19
-rw-r--r--src/page/flash.js26
-rw-r--r--src/page/index.js2
8 files changed, 193 insertions, 5 deletions
diff --git a/src/content/dependencies/generateFlashIndexPage.js b/src/content/dependencies/generateFlashIndexPage.js
new file mode 100644
index 00000000..24f9c861
--- /dev/null
+++ b/src/content/dependencies/generateFlashIndexPage.js
@@ -0,0 +1,29 @@
+export default {
+  contentDependencies: ['generatePageLayout'],
+  extraDependencies: ['html', 'language'],
+
+  relations(relation) {
+    const relations = {};
+
+    relations.layout =
+      relation('generatePageLayout');
+
+    return relations;
+  },
+
+  generate(relations, {html, language}) {
+    return relations.layout.slots({
+      title: language.$('flashIndex.title'),
+
+      mainContent: [
+        html.tag('p', `Alright alright, this is a stub page! Coming soon!`),
+      ],
+
+      navLinkStyle: 'hierarchical',
+      navLinks: [
+        {auto: 'home'},
+        {auto: 'current'},
+      ],
+    });
+  },
+};
diff --git a/src/content/dependencies/generateFlashInfoPage.js b/src/content/dependencies/generateFlashInfoPage.js
new file mode 100644
index 00000000..4316d7c1
--- /dev/null
+++ b/src/content/dependencies/generateFlashInfoPage.js
@@ -0,0 +1,38 @@
+export default {
+  contentDependencies: ['generatePageLayout'],
+  extraDependencies: ['html', 'language'],
+
+  relations(relation) {
+    const relations = {};
+
+    relations.layout =
+      relation('generatePageLayout');
+
+    return relations;
+  },
+
+  data(flash) {
+    return {
+      name: flash.name,
+    };
+  },
+
+  generate(data, relations, {html, language}) {
+    return relations.layout.slots({
+      title:
+        language.$('flashPage.title', {
+          flash: data.name,
+        }),
+
+      mainContent: [
+        html.tag('p', `Alright alright, this is a stub page! Coming soon!`),
+      ],
+
+      navLinkStyle: 'hierarchical',
+      navLinks: [
+        {auto: 'home'},
+        {auto: 'current'},
+      ],
+    });
+  },
+};
diff --git a/src/content/dependencies/listAllMidiProjectFiles.js b/src/content/dependencies/listAllMidiProjectFiles.js
new file mode 100644
index 00000000..28a925ac
--- /dev/null
+++ b/src/content/dependencies/listAllMidiProjectFiles.js
@@ -0,0 +1,28 @@
+export default {
+  contentDependencies: ['generateListingPage'],
+  extraDependencies: ['html', 'wikiData'],
+
+  sprawl() {
+    return {};
+  },
+
+  query(sprawl, spec) {
+    return {
+      spec,
+    };
+  },
+
+  relations(relation, query) {
+    return {
+      page: relation('generateListingPage', query.spec),
+    };
+  },
+
+  generate(relations, {html}) {
+    return relations.page.slots({
+      type: 'custom',
+      content:
+        html.tag('p', `Alright alright, this is a stub page! Coming soon!`),
+    });
+  },
+};
diff --git a/src/content/dependencies/listAllSheetMusicFiles.js b/src/content/dependencies/listAllSheetMusicFiles.js
new file mode 100644
index 00000000..28a925ac
--- /dev/null
+++ b/src/content/dependencies/listAllSheetMusicFiles.js
@@ -0,0 +1,28 @@
+export default {
+  contentDependencies: ['generateListingPage'],
+  extraDependencies: ['html', 'wikiData'],
+
+  sprawl() {
+    return {};
+  },
+
+  query(sprawl, spec) {
+    return {
+      spec,
+    };
+  },
+
+  relations(relation, query) {
+    return {
+      page: relation('generateListingPage', query.spec),
+    };
+  },
+
+  generate(relations, {html}) {
+    return relations.page.slots({
+      type: 'custom',
+      content:
+        html.tag('p', `Alright alright, this is a stub page! Coming soon!`),
+    });
+  },
+};
diff --git a/src/content/dependencies/listRandomPageLinks.js b/src/content/dependencies/listRandomPageLinks.js
new file mode 100644
index 00000000..28a925ac
--- /dev/null
+++ b/src/content/dependencies/listRandomPageLinks.js
@@ -0,0 +1,28 @@
+export default {
+  contentDependencies: ['generateListingPage'],
+  extraDependencies: ['html', 'wikiData'],
+
+  sprawl() {
+    return {};
+  },
+
+  query(sprawl, spec) {
+    return {
+      spec,
+    };
+  },
+
+  relations(relation, query) {
+    return {
+      page: relation('generateListingPage', query.spec),
+    };
+  },
+
+  generate(relations, {html}) {
+    return relations.page.slots({
+      type: 'custom',
+      content:
+        html.tag('p', `Alright alright, this is a stub page! Coming soon!`),
+    });
+  },
+};
diff --git a/src/listing-spec.js b/src/listing-spec.js
index 9ca75747..82503174 100644
--- a/src/listing-spec.js
+++ b/src/listing-spec.js
@@ -212,6 +212,7 @@ listingSpec.push({
   featureFlag: 'enableArtTagUI',
 });
 
+/*
 function listAdditionalFilesInProperty(property, {
   directory,
   stringsKey,
@@ -272,24 +273,33 @@ function listAdditionalFilesInProperty(property, {
       ]),
   };
 }
+*/
 
-listingSpec.push(listAdditionalFilesInProperty('sheetMusicFiles', {
+listingSpec.push({
+  /* listAdditionalFilesInProperty('sheetMusicFiles') */
   directory: 'all-sheet-music-files',
   stringsKey: 'other.allSheetMusic',
+  contentFunction: 'listAllSheetMusicFiles',
   seeAlso: ['tracks/with-sheet-music-files'],
-}));
+  groupUnderOther: true,
+});
 
-listingSpec.push(listAdditionalFilesInProperty('midiProjectFiles', {
+listingSpec.push({
+  /* listAdditionalFilesInProperty('midiProjectFiles') */
   directory: 'all-midi-project-files',
   stringsKey: 'other.allMidiProjectFiles',
+  contentFunction: 'listAllMidiProjectFiles',
   seeAlso: ['tracks/with-midi-project-files'],
-}));
+  groupUnderOther: true,
+});
 
 listingSpec.push({
   directory: 'random',
   stringsKey: 'other.randomPages',
+  contentFunction: 'listRandomPageLinks',
   groupUnderOther: true,
 
+  /*
   data: ({wikiData: {albumData}}) => [
     {
       name: 'Official',
@@ -377,6 +387,7 @@ listingSpec.push({
         ]),
       ]),
     ]),
+  */
 });
 
 {
diff --git a/src/page/flash.js b/src/page/flash.js
index 2f5778e8..f5d73475 100644
--- a/src/page/flash.js
+++ b/src/page/flash.js
@@ -13,6 +13,31 @@ export function targets({wikiData}) {
   return wikiData.flashData;
 }
 
+export function pathsForTarget(flash) {
+  return [
+    {
+      type: 'page',
+      path: ['flash', flash.directory],
+
+      contentFunction: {
+        name: 'generateFlashInfoPage',
+        args: [flash],
+      },
+    },
+  ];
+}
+
+export function pathsTargetless() {
+  return [
+    {
+      type: 'page',
+      path: ['flashIndex'],
+      contentFunction: {name: 'generateFlashIndexPage'},
+    },
+  ];
+}
+
+/*
 export function write(flash, {wikiData}) {
   const page = {
     type: 'page',
@@ -337,3 +362,4 @@ function generateSidebarForFlash(flash, {
     ],
   };
 }
+*/
diff --git a/src/page/index.js b/src/page/index.js
index a2cdbbdf..e62241d9 100644
--- a/src/page/index.js
+++ b/src/page/index.js
@@ -10,7 +10,7 @@
 export * as album from './album.js';
 export * as artist from './artist.js';
 export * as artistAlias from './artist-alias.js';
-// export * as flash from './flash.js';
+export * as flash from './flash.js';
 export * as group from './group.js';
 export * as homepage from './homepage.js';
 export * as listing from './listing.js';