diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-10-06 08:12:15 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-10-06 08:12:15 -0300 |
commit | bc68ac93a4dfc1f80209ea26e0af333ddc25d6b3 (patch) | |
tree | a21dfeb824390d0faf4f2f808f5425e8dcfe05b7 /src/content/dependencies/generateAlbumSidebarTrackSection.js | |
parent | 97d9a13846654b8fa5b7520254f0f5ebc575305b (diff) | |
parent | 33f622ca94cdac2b7b6b1d3bbd57a96248e57035 (diff) |
Merge branch 'commentary-sidebar' into preview
Diffstat (limited to 'src/content/dependencies/generateAlbumSidebarTrackSection.js')
-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..00e9b621 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(data, relations, slots, {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. |