diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-06-23 20:01:21 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-06-23 20:01:21 -0300 |
commit | c8332bb4e9b719eae0bc8f758ab1835ea1b4d0e8 (patch) | |
tree | 12476c2eee53d6ed95b9f63f16818e66ac13c7a1 | |
parent | 89e79008b02331b69660bb16b6ca737e37483e61 (diff) |
content: use stitchArrays in various places
-rw-r--r-- | src/content/dependencies/generateAlbumCommentaryPage.js | 24 | ||||
-rw-r--r-- | src/content/dependencies/generateAlbumGalleryPage.js | 20 | ||||
-rw-r--r-- | src/content/dependencies/generateArtistGalleryPage.js | 10 |
3 files changed, 32 insertions, 22 deletions
diff --git a/src/content/dependencies/generateAlbumCommentaryPage.js b/src/content/dependencies/generateAlbumCommentaryPage.js index 15d43a32..ea31292c 100644 --- a/src/content/dependencies/generateAlbumCommentaryPage.js +++ b/src/content/dependencies/generateAlbumCommentaryPage.js @@ -1,3 +1,5 @@ +import {stitchArrays} from '../../util/sugar.js'; + export default { contentDependencies: [ 'generateAlbumNavAccent', @@ -127,18 +129,20 @@ export default { relations.albumCommentaryContent), ], - relations.trackCommentaryContent.map((commentaryContent, i) => [ - relations.trackCommentaryHeadings[i] - .slots({ + stitchArrays({ + heading: relations.trackCommentaryHeadings, + link: relations.trackCommentaryLinks, + directory: data.trackCommentaryDirectories, + content: relations.trackCommentaryContent, + colorVariables: relations.trackCommentaryColorVariables, + }).map(({heading, link, directory, content, colorVariables}) => [ + heading.slots({ tag: 'h3', - id: data.trackCommentaryDirectories[i], - title: relations.trackCommentaryLinks[i], + id: directory, + title: link, }), - - html.tag('blockquote', - {style: relations.trackCommentaryColorVariables[i]}, - relations.trackCommentaryContent[i]), - ]), + html.tag('blockquote', {style: colorVariables}, content), + ]), ], navLinkStyle: 'hierarchical', diff --git a/src/content/dependencies/generateAlbumGalleryPage.js b/src/content/dependencies/generateAlbumGalleryPage.js index 354c8401..71cd477b 100644 --- a/src/content/dependencies/generateAlbumGalleryPage.js +++ b/src/content/dependencies/generateAlbumGalleryPage.js @@ -1,3 +1,5 @@ +import {stitchArrays} from '../../util/sugar.js'; + export default { contentDependencies: [ 'generateAlbumGalleryInfoLine', @@ -89,14 +91,16 @@ export default { links: relations.links, names: data.names, images: - relations.images.map((image, i) => - image.slots({ - path: data.paths[i], - missingSourceContent: - language.$('misc.albumGalleryGrid.noCoverArt', { - name: data.names[i], - }), - })), + stitchArrays({ + image: relations.images, + path: data.paths, + name: data.names, + }).map(({image, path, name}) => + image.slots({ + path, + missingSourceContent: + language.$('misc.albumGalleryGrid.noCoverArt', {name}), + })), }), ], diff --git a/src/content/dependencies/generateArtistGalleryPage.js b/src/content/dependencies/generateArtistGalleryPage.js index 41758d59..d1ec3efe 100644 --- a/src/content/dependencies/generateArtistGalleryPage.js +++ b/src/content/dependencies/generateArtistGalleryPage.js @@ -1,3 +1,4 @@ +import {stitchArrays} from '../../util/sugar.js'; import {sortAlbumsTracksChronologically} from '../../util/wiki-data.js'; // TODO: Very awkward we have to duplicate this functionality in relations and data. @@ -92,10 +93,11 @@ export default { links: relations.links, names: data.names, images: - relations.images.map((image, i) => - image.slots({ - path: data.paths[i], - })), + stitchArrays({ + image: relations.images, + path: data.paths, + }).map(({image, path}) => + image.slot('path', path)), }), ], |