« 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/generateChronologyLinks.js23
-rw-r--r--src/content/dependencies/generateScopedTrackChronologyLinks.js2
-rw-r--r--src/content/util/getChronologyRelations.js5
3 files changed, 22 insertions, 8 deletions
diff --git a/src/content/dependencies/generateChronologyLinks.js b/src/content/dependencies/generateChronologyLinks.js
index 8ec6ee0a..0158ffd5 100644
--- a/src/content/dependencies/generateChronologyLinks.js
+++ b/src/content/dependencies/generateChronologyLinks.js
@@ -4,6 +4,11 @@ export default {
   extraDependencies: ['html', 'language'],
 
   slots: {
+    showOnly: {
+      type: 'boolean',
+      default: false,
+    },
+
     chronologyInfoSets: {
       validate: v =>
         v.strictArrayOf(
@@ -24,9 +29,17 @@ export default {
       return html.blank();
     }
 
+    let infoSets = slots.chronologyInfoSets;
+
+    if (!slots.showOnly) {
+      infoSets = infoSets
+        .filter(({nextLink, previousLink}) =>
+          nextLink || previousLink);
+    }
+
     const totalContributionCount =
       accumulateSum(
-        slots.chronologyInfoSets,
+        infoSets,
         ({contributions}) => contributions.length);
 
     if (totalContributionCount === 0) {
@@ -39,7 +52,7 @@ export default {
     }
 
     return html.tags(
-      slots.chronologyInfoSets.map(({
+      infoSets.map(({
         headingString,
         contributions,
       }) =>
@@ -52,7 +65,11 @@ export default {
           const heading =
             html.tag('span', {class: 'heading'},
               language.$(headingString, {
-                index: language.formatIndex(index),
+                index:
+                  (previousLink || nextLink
+                    ? language.formatIndex(index)
+                    : language.formatString('misc.chronology.heading.onlyIndex')),
+
                 artist: artistLink,
               }));
 
diff --git a/src/content/dependencies/generateScopedTrackChronologyLinks.js b/src/content/dependencies/generateScopedTrackChronologyLinks.js
index fb43203b..7cb9ee63 100644
--- a/src/content/dependencies/generateScopedTrackChronologyLinks.js
+++ b/src/content/dependencies/generateScopedTrackChronologyLinks.js
@@ -96,6 +96,8 @@ export default {
           })),
 
         relations.chronologyLinks.slots({
+          showOnly: true,
+
           chronologyInfoSets: [
             {
               headingString: 'misc.chronology.heading.track',
diff --git a/src/content/util/getChronologyRelations.js b/src/content/util/getChronologyRelations.js
index c4a62dad..7a67c6f9 100644
--- a/src/content/util/getChronologyRelations.js
+++ b/src/content/util/getChronologyRelations.js
@@ -37,13 +37,8 @@ export default function getChronologyRelations(thing, {
       return;
     }
 
-    // Don't show a line if this contribution is the *only* item in the
-    // artist's chronology (since there's nothing to navigate there).
     const previous = things[index - 1];
     const next = things[index + 1];
-    if (!previous && !next) {
-      return;
-    }
 
     return {
       index: index + 1,