diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-06-06 20:17:22 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-09-24 15:51:50 -0300 |
commit | 1c3d50b059b3848f685ff6655242f5cb6815ddd6 (patch) | |
tree | 55a4094dedbd20d811676aee61048e6cd8283871 /src | |
parent | 84686df07e1029bcad91b9fda47b6f3bd280ee56 (diff) |
content: generateAlbumSidebarTrackSection: be mildly more versatile
Diffstat (limited to 'src')
-rw-r--r-- | src/content/dependencies/generateAlbumSidebarTrackSection.js | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/content/dependencies/generateAlbumSidebarTrackSection.js b/src/content/dependencies/generateAlbumSidebarTrackSection.js index d71b0bdb..e8c0377d 100644 --- a/src/content/dependencies/generateAlbumSidebarTrackSection.js +++ b/src/content/dependencies/generateAlbumSidebarTrackSection.js @@ -33,10 +33,19 @@ export default { } } + data.trackDirectories = + trackSection.tracks + .map(track => track.directory); + return data; }, - generate(data, relations, {getColors, html, language}) { + slots: { + anchor: {type: 'boolean'}, + open: {type: 'boolean'}, + }, + + generate(slots, data, relations, {getColors, html, language}) { const sectionName = html.tag('span', {class: 'group-name'}, (data.isDefaultTrackSection @@ -59,7 +68,13 @@ export default { 'current', }, language.$('albumSidebar.trackList.item', { - track: trackLink, + track: + (slots.anchor + ? trackLink.slots({ + anchor: true, + hash: data.trackDirectories[index], + }) + : trackLink), }))); return html.tag('details', @@ -67,6 +82,11 @@ export default { class: data.includesCurrentTrack && 'current', open: ( + // Allow forcing open via a template slot. + // This isn't exactly janky, but the rest of this function + // kind of is when you contextualize it in a template... + slots.open || + // Leave sidebar track sections collapsed on album info page, // since there's already a view of the full track listing // in the main content area. |