From 27d366fd2de98d816ef0698a1a6d5b4d59b388ca Mon Sep 17 00:00:00 2001
From: "(quasar) nebula" ${
diff --git a/src/page/artist.js b/src/page/artist.js
index 38ca76d6..146b75a5 100644
--- a/src/page/artist.js
+++ b/src/page/artist.js
@@ -8,10 +8,6 @@ import fixWS from 'fix-whitespace';
import * as html from '../util/html.js';
-import {
- UNRELEASED_TRACKS_DIRECTORY
-} from '../util/magic-constants.js';
-
import {
bindOpts,
unique
@@ -82,9 +78,6 @@ export function write(artist, {wikiData}) {
...artist.tracksAsContributor ?? []
]));
- const unreleasedTracks = allTracks.filter(track => track.album.directory === UNRELEASED_TRACKS_DIRECTORY);
- const releasedTracks = allTracks.filter(track => track.album.directory !== UNRELEASED_TRACKS_DIRECTORY);
-
const chunkTracks = tracks => (
chunkByProperties(tracks.map(track => ({
track,
@@ -107,10 +100,8 @@ export function write(artist, {wikiData}) {
duration: getTotalDuration(chunk),
})));
- const unreleasedTrackListChunks = chunkTracks(unreleasedTracks);
- const releasedTrackListChunks = chunkTracks(releasedTracks);
-
- const totalReleasedDuration = getTotalDuration(releasedTracks);
+ const trackListChunks = chunkTracks(allTracks);
+ const totalDuration = getTotalDuration(allTracks);
const countGroups = things => {
const usedGroups = things.flatMap(thing => thing.groups || thing.album?.groups || []);
@@ -123,7 +114,7 @@ export function write(artist, {wikiData}) {
.sort((a, b) => b.contributions - a.contributions);
};
- const musicGroups = countGroups(releasedTracks);
+ const musicGroups = countGroups(allTracks);
const artGroups = countGroups(artThingsAll);
let flashes, flashListChunks;
@@ -176,11 +167,20 @@ export function write(artist, {wikiData}) {
}) => fixWS`
${chunks.map(({date, album, chunk, duration}) => fixWS`
-
${(chunk
.map(({track, ...props}) => ({
@@ -256,10 +256,7 @@ export function write(artist, {wikiData}) {
tracks: {
asArtist: artist.tracksAsArtist.map(serializeArtistsAndContrib('artistContribs')),
asContributor: artist.tracksAsContributor.map(serializeArtistsAndContrib('contributorContribs')),
- chunked: {
- released: serializeTrackListChunks(releasedTrackListChunks),
- unreleased: serializeTrackListChunks(unreleasedTrackListChunks)
- }
+ chunked: serializeTrackListChunks(trackListChunks)
}
};
}
@@ -312,22 +309,17 @@ export function write(artist, {wikiData}) {
})}
${strings('misc.jumpTo.withLinks', { links: strings.list.unit([ - [ - [...releasedTracks, ...unreleasedTracks].length && `${strings('artistPage.trackList.title')}`, - unreleasedTracks.length && `(${strings('artistPage.unreleasedTrackList.title')})` - ].filter(Boolean).join(' '), + allTracks.length && `${strings('artistPage.trackList.title')}`, artThingsAll.length && `${strings('artistPage.artList.title')}`, wikiInfo.enableFlashesAndGames && flashes.length && `${strings('artistPage.flashList.title')}`, commentaryThings.length && `${strings('artistPage.commentaryList.title')}` ].filter(Boolean)) })}
- ${(releasedTracks.length || unreleasedTracks.length) && fixWS` + ${allTracks.length && fixWS`${strings('artistPage.contributedDurationLine', { artist: artist.name, - duration: strings.count.duration(totalReleasedDuration, {approximate: true, unit: true}) + duration: strings.count.duration(totalDuration, {approximate: true, unit: true}) })}
${strings('artistPage.musicGroupsLine', { groups: strings.list.unit(musicGroups @@ -336,11 +328,7 @@ export function write(artist, {wikiData}) { contributions: strings.count.contributions(contributions) }))) })}
- ${generateTrackList(releasedTrackListChunks)} - `} - ${unreleasedTracks.length && fixWS` -${ strings('groupGalleryPage.infoLine', { - tracks: `${strings.count.tracks(releasedTracks.length, {unit: true})}`, - albums: `${strings.count.albums(releasedAlbums.length, {unit: true})}`, + tracks: `${strings.count.tracks(tracks.length, {unit: true})}`, + albums: `${strings.count.albums(albums.length, {unit: true})}`, time: `${strings.count.duration(totalDuration, {unit: true})}` }) }
diff --git a/src/page/track.js b/src/page/track.js index 960f00ce..c27b2b65 100644 --- a/src/page/track.js +++ b/src/page/track.js @@ -13,8 +13,7 @@ import { import * as html from '../util/html.js'; import { - OFFICIAL_GROUP_DIRECTORY, - UNRELEASED_TRACKS_DIRECTORY + OFFICIAL_GROUP_DIRECTORY } from '../util/magic-constants.js'; import { @@ -181,7 +180,7 @@ export function write(track, {wikiData}) { showIcons: true }) }), - album.directory !== UNRELEASED_TRACKS_DIRECTORY && strings('releaseInfo.released', { + track.date && strings('releaseInfo.released', { date: strings.count.date(track.date) }), (track.coverArtDate && diff --git a/src/strings-default.json b/src/strings-default.json index 1fc6d8a4..1c5fbc68 100644 --- a/src/strings-default.json +++ b/src/strings-default.json @@ -172,6 +172,7 @@ "artistPage.title": "{ARTIST}", "artistPage.creditList.album": "{ALBUM}", "artistPage.creditList.album.withDate": "{ALBUM} ({DATE})", + "artistPage.creditList.album.withDuration": "{ALBUM} ({DURATION})", "artistPage.creditList.album.withDate.withDuration": "{ALBUM} ({DATE}; {DURATION})", "artistPage.creditList.flashAct": "{ACT}", "artistPage.creditList.flashAct.withDateRange": "{ACT} ({DATE_RANGE})", @@ -191,7 +192,6 @@ "artistPage.artGroupsLine": "Contributed art to groups: {GROUPS}", "artistPage.groupsLine.item": "{GROUP} ({CONTRIBUTIONS})", "artistPage.trackList.title": "Tracks", - "artistPage.unreleasedTrackList.title": "Unreleased Tracks", "artistPage.artList.title": "Art", "artistPage.flashList.title": "Flashes & Games", "artistPage.commentaryList.title": "Commentary", @@ -217,6 +217,7 @@ "groupInfoPage.viewAlbumGallery.link": "album gallery", "groupInfoPage.albumList.title": "Albums", "groupInfoPage.albumList.item": "({YEAR}) {ALBUM}", + "groupInfoPage.albumList.item.withoutYear": "{ALBUM}", "groupInfoPage.albumList.item.withAccent": "{ITEM} {ACCENT}", "groupInfoPage.albumList.item.otherGroupAccent": "(from {GROUP})", "groupGalleryPage.title": "{GROUP} - Gallery", diff --git a/src/util/wiki-data.js b/src/util/wiki-data.js index 6891a4c6..6d0db2c7 100644 --- a/src/util/wiki-data.js +++ b/src/util/wiki-data.js @@ -83,7 +83,24 @@ export function sortByDate(data, dateKey = 'date') { // Just to 8e clear: sort is a mutating function! I only return the array // 8ecause then you don't have to define it as a separate varia8le 8efore // passing it into this function. - return data.sort((a, b) => a[dateKey] - b[dateKey]); + return data.sort(({ [dateKey]: a }, { [dateKey]: b }) => { + // It's possible for objects with and without dates to be mixed + // together in the same array. If that's the case, we put all items + // without dates at the end. + if (a && b) { + return a - b; + } else if (a) { + return -1; + } else if (b) { + return 1; + } else { + // If neither of the items being compared have a date, don't move + // them relative to each other. This is basically the same as + // filtering out all non-date items and then pushing them at the + // end after sorting the rest. + return 0; + } + }); } // Same details as the sortByDate, 8ut for covers~ -- cgit 1.3.0-6-gf8a5