diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-03-01 16:19:10 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-03-01 16:19:10 -0400 |
commit | 62f64b3aa019747e9c764eda853591b321850ca0 (patch) | |
tree | 62e183680ebb4bc5a0015eda957ba367ab11030c /src/page/album.js | |
parent | 7bf9489f14735f9e44af37f2ade14890a119b403 (diff) | |
parent | 1f0924cc94ea10320afe951a2e8fb4906b5e6106 (diff) |
Merge branch 'preview' into image-overlay
Diffstat (limited to 'src/page/album.js')
-rw-r--r-- | src/page/album.js | 57 |
1 files changed, 43 insertions, 14 deletions
diff --git a/src/page/album.js b/src/page/album.js index 897e5110..24033b1d 100644 --- a/src/page/album.js +++ b/src/page/album.js @@ -50,6 +50,8 @@ export function write(album, {wikiData}) { }; const hasAdditionalFiles = !empty(album.additionalFiles); + const numAdditionalFiles = album.additionalFiles.flatMap((g) => g.files).length; + const albumDuration = getTotalDuration(album.tracks); const displayTrackSections = @@ -336,18 +338,22 @@ export function write(album, {wikiData}) { ]), ...html.fragment( - hasAdditionalFiles && - generateAdditionalFilesList(album.additionalFiles, { - // TODO: Kinda near the metal here... - getFileSize: (file) => - getSizeOfAdditionalFile( - urls.from('media.root').to( - 'media.albumAdditionalFile', - album.directory, - file)), - linkFile: (file) => - link.albumAdditionalFile({album, file}), - })), + hasAdditionalFiles && [ + html.tag('p', + {id: 'additional-files', class: ['content-heading']}, + language.$('releaseInfo.additionalFiles.heading', { + additionalFiles: language.countAdditionalFiles(numAdditionalFiles, { + unit: true, + }), + })), + + generateAlbumAdditionalFilesList(album, album.additionalFiles, { + generateAdditionalFilesList, + getSizeOfAdditionalFile, + link, + urls, + }), + ]), ...html.fragment( album.commentary && [ @@ -543,7 +549,7 @@ export function generateAlbumSidebar(album, currentTrack, { html.tag( 'summary', {style: getLinkThemeString(color)}, - [ + html.tag('span', [ listTag === 'ol' && language.$('albumSidebar.trackList.group.withRange', { group: groupName, @@ -555,7 +561,7 @@ export function generateAlbumSidebar(album, currentTrack, { language.$('albumSidebar.trackList.group', { group: groupName, }), - ]), + ])), html.tag(listTag, listTag === 'ol' ? {start: startIndex + 1} : {}, tracks.map(trackToListItem)), @@ -834,3 +840,26 @@ export function generateAlbumChronologyLinks(album, currentTrack, { })), ]); } + +export function generateAlbumAdditionalFilesList(album, additionalFiles, { + fileSize = true, + + generateAdditionalFilesList, + getSizeOfAdditionalFile, + link, + urls, +}) { + return generateAdditionalFilesList(additionalFiles, { + getFileSize: + (fileSize + ? (file) => + // TODO: Kinda near the metal here... + getSizeOfAdditionalFile( + urls + .from('media.root') + .to('media.albumAdditionalFile', album.directory, file)) + : () => null), + linkFile: (file) => + link.albumAdditionalFile({album, file}), + }); +} |