From 860b9fbf12315362d2c33864521c3f081fd66545 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 21 Nov 2022 20:05:27 -0400 Subject: use html.fragment instead of ternary most places --- src/page/group.js | 69 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 34 deletions(-) (limited to 'src/page/group.js') 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); + })), + ]), ], }, -- cgit 1.3.0-6-gf8a5