« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/generateAlbumGalleryNoTrackArtworksLine.js7
-rw-r--r--src/content/dependencies/generateAlbumGalleryPage.js7
-rw-r--r--src/content/dependencies/generateAlbumNavAccent.js16
-rw-r--r--src/page/album.js3
-rw-r--r--src/strings-default.json1
5 files changed, 24 insertions, 10 deletions
diff --git a/src/content/dependencies/generateAlbumGalleryNoTrackArtworksLine.js b/src/content/dependencies/generateAlbumGalleryNoTrackArtworksLine.js
new file mode 100644
index 00000000..ad99cb87
--- /dev/null
+++ b/src/content/dependencies/generateAlbumGalleryNoTrackArtworksLine.js
@@ -0,0 +1,7 @@
+export default {
+  extraDependencies: ['html', 'language'],
+
+  generate: ({html, language}) =>
+    html.tag('p', {class: 'quick-info'},
+      language.$('albumGalleryPage.noTrackArtworksLine')),
+};
diff --git a/src/content/dependencies/generateAlbumGalleryPage.js b/src/content/dependencies/generateAlbumGalleryPage.js
index b98abc46..9551eb98 100644
--- a/src/content/dependencies/generateAlbumGalleryPage.js
+++ b/src/content/dependencies/generateAlbumGalleryPage.js
@@ -3,6 +3,7 @@ import {compareArrays, stitchArrays} from '#sugar';
 export default {
   contentDependencies: [
     'generateAlbumGalleryCoverArtistsLine',
+    'generateAlbumGalleryNoTrackArtworksLine',
     'generateAlbumGalleryStatsLine',
     'generateAlbumNavAccent',
     'generateAlbumStyleRules',
@@ -62,6 +63,11 @@ export default {
     relations.statsLine =
       relation('generateAlbumGalleryStatsLine', album);
 
+    if (album.tracks.every(track => !track.hasUniqueCoverArt)) {
+      relations.noTrackArtworksLine =
+        relation('generateAlbumGalleryNoTrackArtworksLine');
+    }
+
     if (query.coverArtistsForAllTracks) {
       relations.coverArtistsLine =
         relation('generateAlbumGalleryCoverArtistsLine', query.coverArtistsForAllTracks);
@@ -131,6 +137,7 @@ export default {
         mainContent: [
           relations.statsLine,
           relations.coverArtistsLine,
+          relations.noTrackArtworksLine,
 
           relations.coverGrid
             .slots({
diff --git a/src/content/dependencies/generateAlbumNavAccent.js b/src/content/dependencies/generateAlbumNavAccent.js
index c79219bb..7eb1dac0 100644
--- a/src/content/dependencies/generateAlbumNavAccent.js
+++ b/src/content/dependencies/generateAlbumNavAccent.js
@@ -33,10 +33,8 @@ export default {
       }
     }
 
-    if (album.tracks.some(t => t.hasUniqueCoverArt)) {
-      relations.albumGalleryLink =
-        relation('linkAlbumGallery', album);
-    }
+    relations.albumGalleryLink =
+      relation('linkAlbumGallery', album);
 
     if (album.commentary || album.tracks.some(t => t.commentary)) {
       relations.albumCommentaryLink =
@@ -49,6 +47,7 @@ export default {
   data(album, track) {
     return {
       hasMultipleTracks: album.tracks.length > 1,
+      galleryIsStub: album.tracks.every(t => !t.hasUniqueCoverArt),
       isTrackPage: !!track,
     };
   },
@@ -66,10 +65,11 @@ export default {
     const {content: extraLinks = []} =
       slots.showExtraLinks &&
         {content: [
-          relations.albumGalleryLink?.slots({
-            attributes: {class: slots.currentExtra === 'gallery' && 'current'},
-            content: language.$('albumPage.nav.gallery'),
-          }),
+          (!data.galleryIsStub || slots.currentExtra === 'gallery') &&
+            relations.albumGalleryLink?.slots({
+              attributes: {class: slots.currentExtra === 'gallery' && 'current'},
+              content: language.$('albumPage.nav.gallery'),
+            }),
 
           relations.albumCommentaryLink?.slots({
             attributes: {class: slots.currentExtra === 'commentary' && 'current'},
diff --git a/src/page/album.js b/src/page/album.js
index 69fcabcf..af410763 100644
--- a/src/page/album.js
+++ b/src/page/album.js
@@ -5,7 +5,6 @@ export function targets({wikiData}) {
 }
 
 export function pathsForTarget(album) {
-  const hasGalleryPage = album.tracks.some(t => t.hasUniqueCoverArt);
   const hasCommentaryPage = !!album.commentary || album.tracks.some(t => t.commentary);
 
   return [
@@ -19,7 +18,7 @@ export function pathsForTarget(album) {
       },
     },
 
-    hasGalleryPage && {
+    {
       type: 'page',
       path: ['albumGallery', album.directory],
 
diff --git a/src/strings-default.json b/src/strings-default.json
index 0ad7a516..af44fc7e 100644
--- a/src/strings-default.json
+++ b/src/strings-default.json
@@ -267,6 +267,7 @@
   "albumGalleryPage.statsLine": "{TRACKS} totaling {DURATION}.",
   "albumGalleryPage.statsLine.withDate": "{TRACKS} totaling {DURATION}. Released {DATE}.",
   "albumGalleryPage.coverArtistsLine": "All track artwork by {ARTISTS}.",
+  "albumGalleryPage.noTrackArtworksLine": "This album doesn't have any track artwork.",
   "albumCommentaryPage.title": "{ALBUM} - Commentary",
   "albumCommentaryPage.infoLine": "{WORDS} across {ENTRIES}.",
   "albumCommentaryPage.nav.album": "Album: {ALBUM}",