« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateArtistInfoPageChunk.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/dependencies/generateArtistInfoPageChunk.js')
-rw-r--r--src/content/dependencies/generateArtistInfoPageChunk.js85
1 files changed, 35 insertions, 50 deletions
diff --git a/src/content/dependencies/generateArtistInfoPageChunk.js b/src/content/dependencies/generateArtistInfoPageChunk.js
index 80429912..3fa46c61 100644
--- a/src/content/dependencies/generateArtistInfoPageChunk.js
+++ b/src/content/dependencies/generateArtistInfoPageChunk.js
@@ -8,17 +8,12 @@ export default {
 
     id: {type: 'string'},
 
-    albumLink: {
+    link: {
       type: 'html',
       mutable: false,
     },
 
-    flashActLink: {
-      type: 'html',
-      mutable: false,
-    },
-
-    items: {
+    list: {
       type: 'html',
       mutable: false,
     },
@@ -51,50 +46,43 @@ export default {
     }
 
     let accentedLink;
-
-    accent: {
-      switch (slots.mode) {
-        case 'album': {
-          accentedLink = slots.albumLink;
-
-          const options = {album: accentedLink};
-          const parts = ['artistPage.creditList.album'];
-
-          if (onlyDate) {
-            parts.push('withDate');
-            options.date = language.formatDate(onlyDate);
-          }
-
-          if (slots.duration) {
-            parts.push('withDuration');
-            options.duration =
-              language.formatDuration(slots.duration, {
-                approximate: slots.durationApproximate,
-              });
-          }
-
-          accentedLink = language.formatString(...parts, options);
-          break;
+    switch (slots.mode) {
+      case 'album': {
+        const options = {album: slots.link};
+        const parts = ['artistPage.creditList.album'];
+
+        if (onlyDate) {
+          parts.push('withDate');
+          options.date = language.formatDate(onlyDate);
         }
 
-        case 'flash': {
-          accentedLink = slots.flashActLink;
-
-          const options = {act: accentedLink};
-          const parts = ['artistPage.creditList.flashAct'];
+        if (slots.duration) {
+          parts.push('withDuration');
+          options.duration =
+            language.formatDuration(slots.duration, {
+              approximate: slots.durationApproximate,
+            });
+        }
 
-          if (onlyDate) {
-            parts.push('withDate');
-            options.date = language.formatDate(onlyDate);
-          } else if (earliestDate && latestDate) {
-            parts.push('withDateRange');
-            options.dateRange =
-              language.formatDateRange(earliestDate, latestDate);
-          }
+        accentedLink = language.formatString(...parts, options);
+        break;
+      }
 
-          accentedLink = language.formatString(...parts, options);
-          break;
+      case 'flash': {
+        const options = {act: slots.link};
+        const parts = ['artistPage.creditList.flashAct'];
+
+        if (onlyDate) {
+          parts.push('withDate');
+          options.date = language.formatDate(onlyDate);
+        } else if (earliestDate && latestDate) {
+          parts.push('withDateRange');
+          options.dateRange =
+            language.formatDateRange(earliestDate, latestDate);
         }
+
+        accentedLink = language.formatString(...parts, options);
+        break;
       }
     }
 
@@ -103,10 +91,7 @@ export default {
         slots.id && {id: slots.id},
         accentedLink),
 
-      html.tag('dd',
-        html.tag('ul',
-          {class: 'offset-tooltips'},
-          slots.items)),
+      html.tag('dd', slots.list),
     ]);
   },
 };