diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-07-30 21:05:30 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-07-30 21:05:30 -0300 |
commit | ac00cb19d57f79b784461ef924f9858260a48333 (patch) | |
tree | fe84d4bfb8e5040b27a4a90d76f3c5525c36f1a9 /src/content/dependencies/listTracksByName.js | |
parent | 12531f8e178e0ae34ee66d441966fdc9a33dba5b (diff) | |
parent | 4cbde0e670e5812254509f1f5da39241304dacc0 (diff) |
Merge branch 'data-steps' of github.com:hsmusic/hsmusic-wiki into data-steps
Diffstat (limited to 'src/content/dependencies/listTracksByName.js')
-rw-r--r-- | src/content/dependencies/listTracksByName.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/content/dependencies/listTracksByName.js b/src/content/dependencies/listTracksByName.js new file mode 100644 index 00000000..dd989e98 --- /dev/null +++ b/src/content/dependencies/listTracksByName.js @@ -0,0 +1,36 @@ +import {sortAlphabetically} from '../../util/wiki-data.js'; + +export default { + contentDependencies: ['generateListingPage', 'linkTrack'], + extraDependencies: ['wikiData'], + + sprawl({trackData}) { + return {trackData}; + }, + + query({trackData}, spec) { + return { + spec, + tracks: sortAlphabetically(trackData.slice()), + }; + }, + + relations(relation, query) { + return { + page: relation('generateListingPage', query.spec), + + trackLinks: + query.tracks + .map(track => relation('linkTrack', track)), + }; + }, + + generate(relations) { + return relations.page.slots({ + type: 'rows', + rows: + relations.trackLinks + .map(link => ({track: link})), + }); + }, +}; |