« get me outta code hell

Tracks - with Sheet Music / MIDI & Project Files listings - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-03-01 16:04:50 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-03-01 16:04:50 -0400
commit1f0924cc94ea10320afe951a2e8fb4906b5e6106 (patch)
treefa4b2898b62884469feaf023e4a3a525c3097ff7 /src
parent6d8f75dd5873f1427a343971edd0e0ea40b015a5 (diff)
Tracks - with Sheet Music / MIDI & Project Files listings
Diffstat (limited to 'src')
-rw-r--r--src/listing-spec.js68
-rw-r--r--src/strings-default.json8
2 files changed, 76 insertions, 0 deletions
diff --git a/src/listing-spec.js b/src/listing-spec.js
index ef51fe90..29b7645c 100644
--- a/src/listing-spec.js
+++ b/src/listing-spec.js
@@ -826,6 +826,74 @@ const listingSpec = [
   },
 
   {
+    directory: 'tracks/with-sheet-music-files',
+    stringsKey: 'listTracks.withSheetMusicFiles',
+
+    data: ({wikiData: {albumData}}) =>
+      albumData
+        .map(album => ({
+          album,
+          tracks: album.tracks.filter(t => !empty(t.sheetMusicFiles)),
+        }))
+        .filter(({tracks}) => !empty(tracks)),
+
+    html: (data, {html, language, link}) =>
+      html.tag('dl',
+        data.flatMap(({album, tracks}) => [
+          html.tag('dt',
+            {class: 'content-heading'},
+            language.$('listingPage.listTracks.withSheetMusicFiles.album', {
+              album: link.album(album),
+              date: language.formatDate(album.date),
+            })),
+
+          html.tag('dd',
+            html.tag('ul',
+              tracks.map(track =>
+                html.tag('li',
+                  language.$('listingPage.listTracks.withSheetMusicFiles.track', {
+                    track: link.track(track, {
+                      hash: 'sheet-music-files',
+                    }),
+                  }))))),
+        ])),
+  },
+
+  {
+    directory: 'tracks/with-midi-project-files',
+    stringsKey: 'listTracks.withMidiProjectFiles',
+
+    data: ({wikiData: {albumData}}) =>
+      albumData
+        .map(album => ({
+          album,
+          tracks: album.tracks.filter(t => !empty(t.midiProjectFiles)),
+        }))
+        .filter(({tracks}) => !empty(tracks)),
+
+    html: (data, {html, language, link}) =>
+      html.tag('dl',
+        data.flatMap(({album, tracks}) => [
+          html.tag('dt',
+            {class: 'content-heading'},
+            language.$('listingPage.listTracks.withMidiProjectFiles.album', {
+              album: link.album(album),
+              date: language.formatDate(album.date),
+            })),
+
+          html.tag('dd',
+            html.tag('ul',
+              tracks.map(track =>
+                html.tag('li',
+                  language.$('listingPage.listTracks.withMidiProjectFiles.track', {
+                    track: link.track(track, {
+                      hash: 'midi-project-files',
+                    }),
+                  }))))),
+        ])),
+  },
+
+  {
     directory: 'tags/by-name',
     stringsKey: 'listTags.byName',
 
diff --git a/src/strings-default.json b/src/strings-default.json
index 97be1f02..0c775e34 100644
--- a/src/strings-default.json
+++ b/src/strings-default.json
@@ -390,6 +390,14 @@
   "listingPage.listTracks.withLyrics.title.short": "...with Lyrics",
   "listingPage.listTracks.withLyrics.album": "{ALBUM} ({DATE})",
   "listingPage.listTracks.withLyrics.track": "{TRACK}",
+  "listingPage.listTracks.withSheetMusicFiles.title": "Tracks - with Sheet Music Files",
+  "listingPage.listTracks.withSheetMusicFiles.title.short": "...with Sheet Music Files",
+  "listingPage.listTracks.withSheetMusicFiles.album": "{ALBUM} ({DATE})",
+  "listingPage.listTracks.withSheetMusicFiles.track": "{TRACK}",
+  "listingPage.listTracks.withMidiProjectFiles.title": "Tracks - with MIDI & Project Files",
+  "listingPage.listTracks.withMidiProjectFiles.title.short": "...with MIDI & Project Files",
+  "listingPage.listTracks.withMidiProjectFiles.album": "{ALBUM} ({DATE})",
+  "listingPage.listTracks.withMidiProjectFiles.track": "{TRACK}",
   "listingPage.listTags.byName.title": "Tags - by Name",
   "listingPage.listTags.byName.title.short": "...by Name",
   "listingPage.listTags.byName.item": "{TAG} ({TIMES_USED})",