From 27d366fd2de98d816ef0698a1a6d5b4d59b388ca Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 5 May 2022 19:36:59 -0300 Subject: support albums and tracks without release dates --- src/misc-templates.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src/misc-templates.js') diff --git a/src/misc-templates.js b/src/misc-templates.js index 995aaa2..6289a73 100644 --- a/src/misc-templates.js +++ b/src/misc-templates.js @@ -10,10 +10,6 @@ import { getColors } from './util/colors.js'; -import { - UNRELEASED_TRACKS_DIRECTORY -} from './util/magic-constants.js'; - import { unique } from './util/sugar.js'; @@ -75,19 +71,15 @@ export function generateChronologyLinks(currentThing, { } return contributions.map(({ who: artist }) => { - const things = sortByDate(unique(getThings(artist)), dateKey); - const releasedThings = things.filter(thing => { - const album = albumData.includes(thing) ? thing : thing.album; - return !(album && album.directory === UNRELEASED_TRACKS_DIRECTORY); - }); - const index = releasedThings.indexOf(currentThing); + const things = sortByDate(unique(getThings(artist)).filter(t => t[dateKey]), dateKey); + const index = things.indexOf(currentThing); if (index === -1) return ''; // TODO: This can pro8a8ly 8e made to use generatePreviousNextLinks? // We'd need to make generatePreviousNextLinks use toAnythingMan tho. - const previous = releasedThings[index - 1]; - const next = releasedThings[index + 1]; + const previous = things[index - 1]; + const next = things[index + 1]; const parts = [ previous && linkAnythingMan(previous, { color: false, @@ -99,6 +91,10 @@ export function generateChronologyLinks(currentThing, { }) ].filter(Boolean); + if (!parts.length) { + return ''; + } + const stringOpts = { index: strings.count.index(index + 1, {strings}), artist: link.artist(artist) -- cgit 1.3.0-6-gf8a5