« get me outta code hell

content: generate{Album,Track,}ReferencingArtworksPage - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateAlbumReferencingArtworksPage.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-11-19 09:22:42 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-11-19 09:22:42 -0400
commit1eee031a7e1b5eb1e2fd3d3fb7411bb7a8a841ef (patch)
tree309f70b712778e3b2469cc24cd78e956a2e8a5b8 /src/content/dependencies/generateAlbumReferencingArtworksPage.js
parentd2bc9d725c83ab8d6131598b7763c7e711f9697a (diff)
content: generate{Album,Track,}ReferencingArtworksPage
Diffstat (limited to 'src/content/dependencies/generateAlbumReferencingArtworksPage.js')
-rw-r--r--src/content/dependencies/generateAlbumReferencingArtworksPage.js68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/content/dependencies/generateAlbumReferencingArtworksPage.js b/src/content/dependencies/generateAlbumReferencingArtworksPage.js
new file mode 100644
index 00000000..8f2349f9
--- /dev/null
+++ b/src/content/dependencies/generateAlbumReferencingArtworksPage.js
@@ -0,0 +1,68 @@
+export default {
+  contentDependencies: [
+    'generateAlbumCoverArtwork',
+    'generateAlbumStyleRules',
+    'generateBackToAlbumLink',
+    'generateReferencingArtworksPage',
+    'linkAlbum',
+  ],
+
+  extraDependencies: ['html', 'language'],
+
+  relations: (relation, album) => ({
+    page:
+      relation('generateReferencingArtworksPage', album.referencedByArtworks),
+
+    albumStyleRules:
+      relation('generateAlbumStyleRules', album, null),
+
+    albumLink:
+      relation('linkAlbum', album),
+
+    backToAlbumLink:
+      relation('generateBackToAlbumLink', album),
+
+    cover:
+      relation('generateAlbumCoverArtwork', album),
+  }),
+
+  data: (album) => ({
+    name:
+      album.name,
+
+    color:
+      album.color,
+  }),
+
+  generate: (data, relations, {html, language}) =>
+    relations.page.slots({
+      title:
+        language.$('albumPage.title', {
+          album:
+            data.name,
+        }),
+
+      color: data.color,
+      styleRules: [relations.albumStyleRules],
+
+      cover: relations.cover,
+
+      navLinks: [
+        {auto: 'home'},
+
+        {
+          html:
+            relations.albumLink
+              .slot('attributes', {class: 'current'}),
+
+          accent:
+            html.tag('a', {href: ''},
+              {class: 'current'},
+
+              language.$('referencingArtworksPage.subtitle')),
+        },
+      ],
+
+      navBottomRowContent: relations.backToAlbumLink,
+    }),
+};