From ba2e5e70900fb9f8f3cbf781e9ebdb74d42fd6cf Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 16 Nov 2020 11:52:35 -0400 Subject: bug fixes and divided artist listings plus some tweaks to changelog formatting --- static/site.css | 27 ++++++-- upd8.js | 188 +++++++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 163 insertions(+), 52 deletions(-) diff --git a/static/site.css b/static/site.css index 3d33a5bb..2d47385a 100644 --- a/static/site.css +++ b/static/site.css @@ -34,7 +34,7 @@ a:hover { text-decoration: underline; } -.columns { +.layout-columns { display: flex; } @@ -103,16 +103,29 @@ a:hover { fill: var(--fg-color); } +.content-columns { + columns: 2; +} + +.content-columns .column { + break-inside: avoid; +} + +.content-columns .column h2 { + margin-top: 0; + font-size: 1em; +} + @media (max-width: 780px) { #sidebar:not(.no-hide) { display: none; } - .columns.vertical-when-thin { + .layout-columns.vertical-when-thin { flex-direction: column; } - .columns.vertical-when-thin > *:not(:last-child) { + .layout-columns.vertical-when-thin > *:not(:last-child) { margin-bottom: 10px; } @@ -123,6 +136,12 @@ a:hover { } } +@media (max-width: 600px) { + .content-columns { + columns: 1; + } +} + #sidebar, #content, #header { background-color: rgba(var(--bg-shade), var(--bg-shade), var(--bg-shade), 0.6); border: 1px dotted var(--fg-color); @@ -131,7 +150,7 @@ a:hover { #sidebar { flex: 1 1 20%; - min-width: 200px; + min-width: 150px; max-width: 250px; flex-basis: 250px; float: left; diff --git a/upd8.js b/upd8.js index 9fe75521..3218c472 100644 --- a/upd8.js +++ b/upd8.js @@ -1026,7 +1026,7 @@ async function writePage(directoryParts, { const layoutHTML = [ navHTML, sidebar.content ? fixWS` -
+
${sidebarHTML} ${mainHTML}
@@ -1617,7 +1617,7 @@ async function writeArtistPage(artistName) { ${track.name} ${track.artists.includes(artistName) && track.artists.length > 1 && `(with ${getArtistString(track.artists.filter(a => a !== artistName))})` || ``} ${contrib.what && `(${getContributionString(contrib) || 'contributed'})` || ``} - ${flashes.length && `
(Featured in ${joinNoOxford(flashes.map(getFlashLinkHTML))})
` || ``} + ${flashes.length && `
(Featured in ${joinNoOxford(flashes.map(flash => getFlashLinkHTML(flash)))})
` || ``} `; }); @@ -1690,7 +1690,7 @@ async function writeArtistPage(artistName) { ${thing.album ? fixWS` ${thing.name} ` : '(album commentary)'} - ${flashes.length && `
(Featured in ${joinNoOxford(flashes.map(getFlashLinkHTML))})
`} + ${flashes.length && `
(Featured in ${joinNoOxford(flashes.map(flash => getFlashLinkHTML(flash)))})
`} ` }, false)} @@ -1905,6 +1905,8 @@ async function writeFlashPage(flash) { function writeListingPages() { const allArtists = artistNames.slice().sort(); + const reversedTracks = allTracks.slice().reverse(); + const reversedThings = justEverythingMan.slice().reverse(); const getAlbumLI = (album, extraText = '') => fixWS`
  • @@ -1954,11 +1956,61 @@ function writeListingPages() { (${commentary} ${commentary === 1 ? 'entry' : 'entries'})
  • `)], - [['artists', 'by-contribs'], `Artists - by Contributions`, allArtists - .map(name => ({name, contribs: C.getArtistNumContributions(name, {albumData, allTracks, flashData})})) - .sort((a, b) => b.contribs - a.contribs) - .map(({ name }) => name) - .map(getArtistLI)], + [['artists', 'by-contribs'], `Artists - by Contributions`, fixWS` +
    +
    +

    Track Contributors

    +
      + ${allArtists + .map(name => ({ + name, + contribs: allTracks.filter(({ album, artists, contributors }) => + album?.directory !== C.UNRELEASED_TRACKS_DIRECTORY && + [ + ...artists, + ...contributors + ].some(({ who }) => who === name)).length + })) + .sort((a, b) => b.contribs - a.contribs) + .filter(({ contribs }) => contribs) + .map(({ name, contribs }) => fixWS` +
    • + ${name} + (${contribs} c.) +
    • + `) + .join('\n') + } +
    +
    +
    +

    Art & Flash Contributors

    +
      + ${allArtists + .map(name => ({ + name, + contribs: justEverythingMan.filter(({ album, contributors, coverArtists }) => ( + album?.directory !== C.UNRELEASED_TRACKS_DIRECTORY && + [ + ...!album && contributors || [], + ...coverArtists || [] + ].some(({ who }) => who === name) + )).length + })) + .sort((a, b) => b.contribs - a.contribs) + .filter(({ contribs }) => contribs) + .map(({ name, contribs }) => fixWS` +
    • + ${name} + (${contribs} c.) +
    • + `) + .join('\n') + } +
    +
    +
    + `], [['artists', 'by-duration'], `Artists - by Duration`, allArtists .map(name => ({name, duration: getTotalDuration( getTracksByArtist(name).filter(track => track.album.directory !== C.UNRELEASED_TRACKS_DIRECTORY)) @@ -1971,23 +2023,57 @@ function writeListingPages() { (~${getDurationString(duration)}) `)], - [['artists', 'by-latest'], `Artists - by Latest Contribution`, C.sortByDate(allArtists - .map(name => ({name, things: C.getThingsArtistContributedTo(name, {albumData, allTracks, flashData})})) - .map(({ name, things }) => ({name, things: things.filter(thing => !thing.album || thing.album.directory !== C.UNRELEASED_TRACKS_DIRECTORY)})) - .filter(({ things }) => things.length) - .map(({ name, things }) => ({name, date: new Date(things.reduce((date, thing) => Math.max(date, - (thing.coverArtists?.some(({ who }) => who === name) - ? thing.coverArtDate - : thing.date)), 0))})) - .sort((a, b) => a.name < b.name ? 1 : a.name > b.name ? -1 : 0) - ) - .reverse() - .map(({ name, date }) => fixWS` -
  • - ${name} - (${getDateString({date})}) -
  • - `)], + [['artists', 'by-latest'], `Artists - by Latest Contribution`, fixWS` +
    +
    +

    Track Contributors

    +
      + ${C.sortByDate(allArtists + .map(name => ({ + name, + date: reversedTracks.find(({ album, artists, contributors }) => ( + album.directory !== C.UNRELEASED_TRACKS_DIRECTORY && + [...artists, ...contributors].some(({ who }) => who === name) + ))?.date + })) + .filter(({ date }) => date) + .sort((a, b) => a.name < b.name ? 1 : a.name > b.name ? -1 : 0) + ).reverse().map(({ name, date }) => fixWS` +
    • + ${name} + (${getDateString({date})}) +
    • + `).join('\n')} +
    +
    +
    +

    Art & Flash Contributors

    +
      + ${C.sortByDate(allArtists + .map(name => { + const thing = reversedThings.find(({ album, coverArtists, contributors }) => ( + album?.directory !== C.UNRELEASED_TRACKS_DIRECTORY && + [...coverArtists || [], ...!album && contributors || []].some(({ who }) => who === name) + )); + return thing && { + name, + date: (thing.coverArtists?.some(({ who }) => who === name) + ? thing.coverArtDate + : thing.date) + }; + }) + .filter(Boolean) + .sort((a, b) => a.name < b.name ? 1 : a.name > b.name ? -1 : 0) + ).reverse().map(({ name, date }) => fixWS` +
    • + ${name} + (${getDateString({date})}) +
    • + `).join('\n')} +
    +
    +
    + `], [['tracks', 'by-name'], `Tracks - by Name`, allTracks.slice() .sort(sortByName) .map(track => fixWS` @@ -2068,7 +2154,7 @@ function writeListingPages() { -
    +
    @@ -2085,7 +2171,7 @@ function writeListingPages() { -
    +
    @@ -2138,7 +2224,7 @@ function writeListingPages() { -
    +
    @@ -2174,26 +2260,32 @@ function writeListingPages() { } function writeListingPage(directoryParts, title, items, listingDescriptors) { - return OLD_writePage([C.LISTING_DIRECTORY, ...directoryParts], title, fixWS` - - -
    - -
    -

    ${title}

    - ${typeof items === 'string' ? items : fixWS` -
      - ${items.join('\n')} -
    - `} -
    -
    - - `); + return writePage([C.LISTING_DIRECTORY, ...directoryParts], { + title, + + main: { + content: fixWS` +

    ${title}

    + ${typeof items === 'string' ? items : fixWS` +
      + ${items.join('\n')} +
    + `} + ` + }, + + sidebar: { + content: generateSidebarForListings(listingDescriptors, directoryParts) + }, + + nav: { + links: [ + ['./', 'HSMusic'], + [`${C.LISTING_DIRECTORY}/`, 'Listings'], + [`${C.LISTING_DIRECTORY}/${directoryParts.join('/')}/`, title] + ] + } + }); } function generateHeaderForListings(listingDescriptors, currentDirectoryParts) { -- cgit 1.3.0-6-gf8a5