« get me outta code hell

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:
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,
+    }),
+};