« get me outta code hell

content: generateAlbumInfoPageContent: remaining functionality - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-04-04 15:59:59 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-04-04 15:59:59 -0300
commit575fef166cfe915b743d89a2007e259c3fcb4904 (patch)
tree66dd61ad95a944220b3667bbf252d2afe496e686 /src/content/dependencies
parent1832328c39bb1608d14e1079698c187510d924c3 (diff)
content: generateAlbumInfoPageContent: remaining functionality
Diffstat (limited to 'src/content/dependencies')
-rw-r--r--src/content/dependencies/generateAlbumInfoPageContent.js66
1 files changed, 16 insertions, 50 deletions
diff --git a/src/content/dependencies/generateAlbumInfoPageContent.js b/src/content/dependencies/generateAlbumInfoPageContent.js
index 3d0fe9fc..41c9d309 100644
--- a/src/content/dependencies/generateAlbumInfoPageContent.js
+++ b/src/content/dependencies/generateAlbumInfoPageContent.js
@@ -4,6 +4,7 @@ export default {
   contentDependencies: [
     'generateAdditionalFilesShortcut',
     'generateAlbumAdditionalFilesList',
+    'generateAlbumTrackList',
     'generateContributionLinks',
     'generateContentHeading',
     'linkAlbumCommentary',
@@ -57,6 +58,8 @@ export default {
           relation('linkExternal', url, {type: 'album'}));
     }
 
+    relations.trackList = relation('generateAlbumTrackList', album);
+
     if (!empty(album.additionalFiles)) {
       relations.additionalFilesShortcut =
         relation('generateAdditionalFilesShortcut', album.additionalFiles);
@@ -93,6 +96,7 @@ export default {
       data.numAdditionalFiles = album.additionalFiles.length;
     }
 
+    data.dateAddedToWiki = album.dateAddedToWiki;
     data.artistCommentary = album.commentary;
 
     return data;
@@ -182,57 +186,19 @@ export default {
               links: language.formatDisjunctionList(relations.externalLinks),
             })),
 
-        /*
-          !empty(album.urls) &&
-            html.tag('p',
-              language.$('releaseInfo.listenOn', {
-                links: language.formatDisjunctionList(
-                  album.urls.map(url => fancifyURL(url, {album: true}))
-                ),
-              })),
-
-          displayTrackSections &&
-          !empty(album.trackSections) &&
-            html.tag('dl',
-              {class: 'album-group-list'},
-              album.trackSections.flatMap(({
-                name,
-                startIndex,
-                tracks,
-              }) => [
-                html.tag('dt',
-                  {class: ['content-heading']},
-                  language.$('trackList.section.withDuration', {
-                    duration: language.formatDuration(getTotalDuration(tracks), {
-                      approximate: tracks.length > 1,
-                    }),
-                    section: name,
-                  })),
-                html.tag('dd',
-                  html.tag(listTag,
-                    listTag === 'ol' ? {start: startIndex + 1} : {},
-                    tracks.map(trackToListItem))),
-              ])),
-
-          !displayTrackSections &&
-          !empty(album.tracks) &&
-            html.tag(listTag,
-              album.tracks.map(trackToListItem)),
+        relations.trackList,
 
-          html.tag('p',
-            {
-              [html.onlyIfContent]: true,
-              [html.joinChildren]: '<br>',
-            },
-            [
-              album.dateAddedToWiki &&
-                language.$('releaseInfo.addedToWiki', {
-                  date: language.formatDate(
-                    album.dateAddedToWiki
-                  ),
-                })
-            ]),
-        */
+        html.tag('p',
+          {
+            [html.onlyIfContent]: true,
+            [html.joinChildren]: '<br>',
+          },
+          [
+            data.dateAddedToWiki &&
+              language.$('releaseInfo.addedToWiki', {
+                date: language.formatDate(data.dateAddedToWiki),
+              }),
+          ]),
 
         relations.additionalFilesList && [
           relations.additionalFilesHeading