« get me outta code hell

use html.fragment instead of ternary most places - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/page/group.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2022-11-21 20:05:27 -0400
committer(quasar) nebula <qznebula@protonmail.com>2022-11-21 20:05:27 -0400
commit860b9fbf12315362d2c33864521c3f081fd66545 (patch)
tree0a1dec47c9e8beb901417f186eb68177d9d1e9d9 /src/page/group.js
parentb7633208507e3cd25ef7f7018759a0402c13a2f8 (diff)
use html.fragment instead of ternary most places
Diffstat (limited to 'src/page/group.js')
-rw-r--r--src/page/group.js69
1 files changed, 35 insertions, 34 deletions
diff --git a/src/page/group.js b/src/page/group.js
index ef3813f..0ff04ae 100644
--- a/src/page/group.js
+++ b/src/page/group.js
@@ -55,42 +55,43 @@ export function write(group, {wikiData}) {
             html.tag('blockquote',
               transformMultiline(group.description)),
 
-          ...group.albums ? [
-            html.tag('h2',
-              language.$('groupInfoPage.albumList.title')),
-
-            html.tag('p',
-              language.$('groupInfoPage.viewAlbumGallery', {
-                link: link.groupGallery(group, {
-                  text: language.$('groupInfoPage.viewAlbumGallery.link'),
-                }),
-              })),
+          ...html.fragment(
+            group.albums && [
+              html.tag('h2',
+                language.$('groupInfoPage.albumList.title')),
+
+              html.tag('p',
+                language.$('groupInfoPage.viewAlbumGallery', {
+                  link: link.groupGallery(group, {
+                    text: language.$('groupInfoPage.viewAlbumGallery.link'),
+                  }),
+                })),
 
-            html.tag('ul',
-              albumLines.map(({album, otherGroup}) => {
-                const item = album.date
-                  ? language.$('groupInfoPage.albumList.item', {
-                      year: album.date.getFullYear(),
-                      album: link.album(album),
-                    })
-                  : language.$('groupInfoPage.albumList.item.withoutYear', {
-                      album: link.album(album),
-                    });
-                return html.tag('li',
-                  otherGroup
-                    ? language.$('groupInfoPage.albumList.item.withAccent', {
-                        item,
-                        accent: html.tag('span',
-                          {class: 'other-group-accent'},
-                          language.$('groupInfoPage.albumList.item.otherGroupAccent', {
-                            group: link.groupInfo(otherGroup, {
-                              color: false,
-                            }),
-                          })),
+              html.tag('ul',
+                albumLines.map(({album, otherGroup}) => {
+                  const item = album.date
+                    ? language.$('groupInfoPage.albumList.item', {
+                        year: album.date.getFullYear(),
+                        album: link.album(album),
                       })
-                    : item);
-              })),
-          ] : [],
+                    : language.$('groupInfoPage.albumList.item.withoutYear', {
+                        album: link.album(album),
+                      });
+                  return html.tag('li',
+                    otherGroup
+                      ? language.$('groupInfoPage.albumList.item.withAccent', {
+                          item,
+                          accent: html.tag('span',
+                            {class: 'other-group-accent'},
+                            language.$('groupInfoPage.albumList.item.otherGroupAccent', {
+                              group: link.groupInfo(otherGroup, {
+                                color: false,
+                              }),
+                            })),
+                        })
+                      : item);
+                })),
+            ]),
         ],
       },