diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2022-05-05 19:36:59 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2022-05-05 19:36:59 -0300 |
commit | 27d366fd2de98d816ef0698a1a6d5b4d59b388ca (patch) | |
tree | 9f87d11391153ec7acd4f1c88eb46f39517e488f /src/misc-templates.js | |
parent | 9525ec4e143d17329c303e4ad09242a6dab9a9b9 (diff) |
support albums and tracks without release dates
Diffstat (limited to 'src/misc-templates.js')
-rw-r--r-- | src/misc-templates.js | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/misc-templates.js b/src/misc-templates.js index 995aaa2b..6289a737 100644 --- a/src/misc-templates.js +++ b/src/misc-templates.js @@ -11,10 +11,6 @@ import { } 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) |