« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/misc-templates.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc-templates.js')
-rw-r--r--src/misc-templates.js65
1 files changed, 25 insertions, 40 deletions
diff --git a/src/misc-templates.js b/src/misc-templates.js
index 8a61bf7f..1c6dda55 100644
--- a/src/misc-templates.js
+++ b/src/misc-templates.js
@@ -49,46 +49,31 @@ function unbound_generateAdditionalFilesList(additionalFiles, {
 }) {
   if (empty(additionalFiles)) return [];
 
-  const fileCount = additionalFiles.flatMap((g) => g.files).length;
-
-  return html.fragment([
-    html.tag('p',
-      {
-        id: 'additional-files',
-        class: ['content-heading'],
-      },
-      language.$('releaseInfo.additionalFiles.heading', {
-        additionalFiles: language.countAdditionalFiles(fileCount, {
-          unit: true,
-        }),
-      })),
-
-    html.tag('dl',
-      additionalFiles.flatMap(({title, description, files}) => [
-        html.tag('dt',
-          (description
-            ? language.$('releaseInfo.additionalFiles.entry.withDescription', {
-                title,
-                description,
-              })
-            : language.$('releaseInfo.additionalFiles.entry', {title}))),
-
-        html.tag('dd',
-          html.tag('ul',
-            files.map((file) => {
-              const size = getFileSize(file);
-              return html.tag('li',
-                (size
-                  ? language.$('releaseInfo.additionalFiles.file.withSize', {
-                      file: linkFile(file),
-                      size: language.formatFileSize(size),
-                    })
-                  : language.$('releaseInfo.additionalFiles.file', {
-                      file: linkFile(file),
-                    })));
-            }))),
-      ])),
-  ]);
+  return html.tag('dl',
+    additionalFiles.flatMap(({title, description, files}) => [
+      html.tag('dt',
+        (description
+          ? language.$('releaseInfo.additionalFiles.entry.withDescription', {
+              title,
+              description,
+            })
+          : language.$('releaseInfo.additionalFiles.entry', {title}))),
+
+      html.tag('dd',
+        html.tag('ul',
+          files.map((file) => {
+            const size = (getFileSize && getFileSize(file));
+            return html.tag('li',
+              (size
+                ? language.$('releaseInfo.additionalFiles.file.withSize', {
+                    file: linkFile(file),
+                    size: language.formatFileSize(size),
+                  })
+                : language.$('releaseInfo.additionalFiles.file', {
+                    file: linkFile(file),
+                  })))
+          }))),
+    ]));
 }
 
 // Artist strings