« 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
diff options
context:
space:
mode:
Diffstat (limited to 'src/content')
-rw-r--r--src/content/dependencies/generateArtistInfoPage.js9
-rw-r--r--src/content/dependencies/generateCoverArtwork.js2
-rw-r--r--src/content/dependencies/generatePageLayout.js2
-rw-r--r--src/content/dependencies/generateStickyHeadingContainer.js8
-rw-r--r--src/content/dependencies/generateTrackInfoPage.js1
-rw-r--r--src/content/dependencies/generateTrackInfoPageContent.js19
-rw-r--r--src/content/dependencies/image.js8
7 files changed, 40 insertions, 9 deletions
diff --git a/src/content/dependencies/generateArtistInfoPage.js b/src/content/dependencies/generateArtistInfoPage.js
index 821512b8..a91eebf2 100644
--- a/src/content/dependencies/generateArtistInfoPage.js
+++ b/src/content/dependencies/generateArtistInfoPage.js
@@ -585,7 +585,7 @@ export function write(artist, {wikiData}) {
 
   let flashes, flashListChunks;
   if (wikiInfo.enableFlashesAndGames) {
-    flashes = sortChronologically(artist.flashesAsContributor.slice());
+    flashes = sortFlashesChronologically(artist.flashesAsContributor.slice());
     flashListChunks = chunkByProperties(
       flashes.map((flash) => ({
         act: flash.act,
@@ -760,6 +760,13 @@ export function write(artist, {wikiData}) {
     },
   };
 
+  const artThingsGallery = sortAlbumsTracksChronologically(
+    [
+      ...(artist.albumsAsCoverArtist ?? []),
+      ...(artist.tracksAsCoverArtist ?? []),
+    ],
+    {latestFirst: true, getDate: (o) => o.coverArtDate});
+
   const galleryPage = hasGallery && {
     type: 'page',
     path: ['artistGallery', artist.directory],
diff --git a/src/content/dependencies/generateCoverArtwork.js b/src/content/dependencies/generateCoverArtwork.js
index 68680060..a7a7f859 100644
--- a/src/content/dependencies/generateCoverArtwork.js
+++ b/src/content/dependencies/generateCoverArtwork.js
@@ -51,6 +51,7 @@ export default {
                   alt: slots.alt,
                   thumb: 'medium',
                   id: 'cover-art',
+                  reveal: true,
                   link: true,
                   square: true,
                 }),
@@ -68,6 +69,7 @@ export default {
                 path: slots.path,
                 alt: slots.alt,
                 thumb: 'small',
+                reveal: false,
                 link: false,
                 square: true,
               });
diff --git a/src/content/dependencies/generatePageLayout.js b/src/content/dependencies/generatePageLayout.js
index 32effbfe..55f5b940 100644
--- a/src/content/dependencies/generatePageLayout.js
+++ b/src/content/dependencies/generatePageLayout.js
@@ -102,6 +102,7 @@ export default {
       slots: {
         title: {type: 'html'},
         cover: {type: 'html'},
+        coverNeedsReveal: {type: 'boolean'},
 
         socialEmbed: {type: 'html'},
 
@@ -201,6 +202,7 @@ export default {
                 relations.stickyHeadingContainer.slots({
                   title: slots.title,
                   cover: slots.cover,
+                  needsReveal: slots.coverNeedsReveal,
                 });
               break;
             case 'static':
diff --git a/src/content/dependencies/generateStickyHeadingContainer.js b/src/content/dependencies/generateStickyHeadingContainer.js
index c08ca08d..fb6d8307 100644
--- a/src/content/dependencies/generateStickyHeadingContainer.js
+++ b/src/content/dependencies/generateStickyHeadingContainer.js
@@ -8,6 +8,7 @@ export default {
       slots: {
         title: {type: 'html'},
         cover: {type: 'html'},
+        needsReveal: {type: 'boolean', default: false},
       },
 
       content(slots) {
@@ -26,7 +27,12 @@ export default {
 
               hasCover &&
                 html.tag('div', {class: 'content-sticky-heading-cover-container'},
-                  html.tag('div', {class: 'content-sticky-heading-cover'},
+                  html.tag('div',
+                    {class: [
+                      'content-sticky-heading-cover',
+                      slots.needsReveal &&
+                        'content-sticky-heading-cover-needs-reveal',
+                    ]},
                     slots.cover.slot('displayMode', 'thumbnail')))
             ]),
 
diff --git a/src/content/dependencies/generateTrackInfoPage.js b/src/content/dependencies/generateTrackInfoPage.js
index 4795bac6..ee68f534 100644
--- a/src/content/dependencies/generateTrackInfoPage.js
+++ b/src/content/dependencies/generateTrackInfoPage.js
@@ -84,6 +84,7 @@ export default {
         additionalStyleRules: [relations.albumStyleRules],
 
         cover: relations.content.cover,
+        coverNeedsReveal: relations.content.coverNeedsReveal,
         mainContent: relations.content.main.content,
 
         navLinkStyle: 'hierarchical',
diff --git a/src/content/dependencies/generateTrackInfoPageContent.js b/src/content/dependencies/generateTrackInfoPageContent.js
index 67975cb4..c33c2f62 100644
--- a/src/content/dependencies/generateTrackInfoPageContent.js
+++ b/src/content/dependencies/generateTrackInfoPageContent.js
@@ -1,5 +1,5 @@
 import {empty} from '../../util/sugar.js';
-import {sortChronologically} from '../../util/wiki-data.js';
+import {sortFlashesChronologically} from '../../util/wiki-data.js';
 
 export default {
   contentDependencies: [
@@ -12,6 +12,7 @@ export default {
     'linkAlbum',
     'linkContribution',
     'linkExternal',
+    'linkFlash',
     'linkTrack',
     'transformContent',
   ],
@@ -32,8 +33,10 @@ export default {
     const sections = relations.sections = {};
 
     const contributionLinksRelation = contribs =>
-      contribs.map(contrib =>
-        relation('linkContribution', contrib.who, contrib.what));
+      contribs
+        .slice(0, 4)
+        .map(contrib =>
+          relation('linkContribution', contrib.who, contrib.what));
 
     const additionalFilesSection = additionalFiles => ({
       heading: relation('generateContentHeading'),
@@ -161,7 +164,7 @@ export default {
 
     if (sprawl.enableFlashesAndGames) {
       const sortedFeatures =
-        sortChronologically(
+        sortFlashesChronologically(
           [track, ...track.otherReleases].flatMap(track =>
             track.featuredInFlashes.map(flash => ({
               // These aren't going to be exposed directly, they're processed
@@ -169,9 +172,8 @@ export default {
               flash, track,
 
               // These properties are only used for the sort.
+              act: flash.act,
               date: flash.date,
-              name: flash.name,
-              directory: flash.directory,
             }))));
 
       if (!empty(sortedFeatures)) {
@@ -250,6 +252,7 @@ export default {
       data.albumCoverArtDirectory = album.directory;
       data.trackCoverArtDirectory = track.directory;
       data.coverArtFileExtension = track.coverArtFileExtension;
+      data.coverNeedsReveal = track.artTags.some(t => t.isContentWarning);
 
       if (track.coverArtDate && +track.coverArtDate !== +track.date) {
         data.coverArtDate = track.coverArtDate;
@@ -257,6 +260,7 @@ export default {
     } else if (track.album.hasCoverArt) {
       data.albumCoverArtDirectory = album.directory;
       data.coverArtFileExtension = album.coverArtFileExtension;
+      data.coverNeedsReveal = album.artTags.some(t => t.isContentWarning);
     }
 
     if (!empty(track.additionalFiles)) {
@@ -291,6 +295,7 @@ export default {
             data.coverArtFileExtension,
           ],
         });
+      content.coverNeedsReveal = data.coverNeedsReveal;
     } else if (data.hasAlbumCoverArt) {
       content.cover = relations.cover
         .slots({
@@ -300,8 +305,10 @@ export default {
             data.coverArtFileExtension,
           ],
         });
+      content.coverNeedsReveal = data.coverNeedsReveal;
     } else {
       content.cover = null;
+      content.coverNeedsReveal = null;
     }
 
     content.main = {
diff --git a/src/content/dependencies/image.js b/src/content/dependencies/image.js
index 822a8996..f9cb00bf 100644
--- a/src/content/dependencies/image.js
+++ b/src/content/dependencies/image.js
@@ -45,6 +45,7 @@ export default {
 
         thumb: {type: 'string'},
 
+        reveal: {type: 'boolean', default: true},
         link: {type: 'boolean', default: false},
         lazy: {type: 'boolean', default: false},
         square: {type: 'boolean', default: false},
@@ -75,7 +76,12 @@ export default {
               : originalSrc);
 
         const willLink = typeof slots.link === 'string' || slots.link;
-        const willReveal = originalSrc && !empty(data.contentWarnings);
+
+        const willReveal =
+          slots.reveal &&
+          originalSrc &&
+          !empty(data.contentWarnings);
+
         const willSquare = slots.square;
 
         const idOnImg = willLink ? null : slots.id;